Adding new line between objects and comments in Prettier or ESLint

946 Views Asked by At

I use VS Code with Prettier and ESLint installed. I wonder whether I can have rules like these:

  1. Adding a new line between end of a code block and a comment(in all types of files - html, css, js etc):
        //comment something
        function make() {
          doSomething();
        }
        //formatter adds this line to separate the bracket above from the comment below
        //comment something
        function make() {
          doSomething();
        }
  1. Similar rule for objects and nested objects without comments:
const obj = {

    prop: {
    foo: 'bar'
    },

    prop2: {
    foo: 'bar'
    }

}
0

There are 0 best solutions below