ESlint javascript 配置 - 删除数组中第一个对象之前的新行

ESlint javascript config - new line before first object in array removed

我正在使用 VS Code 及其格式化选项。启用后,它总是删除数组中第一个对象上的空行。

格式化前示例:

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

变成:

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

格式化后。这搞乱了我的代码折叠。为此,ESlint 中的配置是什么?

Eslint 当前配置:

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,
  },
}

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

强制将对象属性放在不同的行上 (object-property-newline)。