ESLint - 对象卷曲换行符
ESLint - object-curly-newline
有没有办法允许 {}
(空对象)同时保持其余部分不变?
"object-curly-newline": [
"error",
{
"ObjectExpression": "always",
"ObjectPattern": { "multiline": true },
"ImportDeclaration": { "multiline": true, "minProperties": 4 },
"ExportDeclaration": "never"
}
]
空对象 {}
是 ObjectExpression
,因此它总是通过指定 always
来打破您的规则。您可以通过配置 minProperties
> 1
:
来保留空对象而不换行
{
"ObjectExpression": { "multiline": true, "minProperties": 1 },
}
有没有办法允许 {}
(空对象)同时保持其余部分不变?
"object-curly-newline": [
"error",
{
"ObjectExpression": "always",
"ObjectPattern": { "multiline": true },
"ImportDeclaration": { "multiline": true, "minProperties": 4 },
"ExportDeclaration": "never"
}
]
空对象 {}
是 ObjectExpression
,因此它总是通过指定 always
来打破您的规则。您可以通过配置 minProperties
> 1
:
{
"ObjectExpression": { "multiline": true, "minProperties": 1 },
}