0

I'm using VS Code and the formatting option for it. When enabled it always removes empty lines on the first object in an array.

Example for Before formatting:

  var arr = [
    {
      id: 1
    },
    {
      id: 2
    }
  ]

becomes:

  var arr = [{
      id: 1
    },
    {
      id: 2
    }
  ]

after formatting. This messes up my code folding. What is the config in ESlint for this?

Eslint config as of now:

module.exports = {
  root: true,

  extends: ['eslint:recommended', 'plugin:vue/essential'],

  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-undef': 'off',
    'no-unused-vars': 'off',
  },

  parserOptions: {
    parser: 'babel-eslint',
  },

  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)',
      ],
      env: {
        mocha: true,
      },
    },
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)',
      ],
      env: {
        mocha: true,
      },
    },
  ],

  env: {
    node: true,
  },
}
Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
Edis Golubich
  • 187
  • 1
  • 11

1 Answers1

1

This messes up my code folding. What is the config in ESlint for this?

Enforce placing object properties on separate lines (object-property-newline).

Wenfang Du
  • 8,804
  • 9
  • 59
  • 90