javascript - ESlint javascript config - 删除数组中第一个对象之前的新行
问题描述
我正在使用 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,
},
}
解决方案
这弄乱了我的代码折叠。ESlint 中的配置是什么?
强制将对象属性放置在单独的行上(object-property-newline)。
推荐阅读
- php - 如何从 ACTIVE IT ZONE 中删除此 $.getScript("https://activeitzone.com/check/larashop.js")
- php - 如何将一个数组中的值合并到另一个数组中?
- python - 访问函数内部的变量进行计算
- log4j - 如何在不更改任何导入语句的情况下升级到 log4j 2.x
- windows - windows脚本创建一个可点击的Beyond Compare报告,但现在停止工作
- bash - 在 bash 中,有没有办法将输出重定向到打开以供读取的文件?
- php - PHP stripos() 只返回 false
- vb.net - VB.Net中的三元运算
- jboss - 如何使用 CLI 从standalone.conf 中读取 Xmx 和 Xms 值?
- java - 如何解决 Spring Boot 中 Microsoft SQL 的“无法投射对象”问题?