[英]ESLint - object-curly-newline
Is there a way to allow for {}
(an empty object) while keeping the rest as is?有没有办法允许{}
(一个空对象)同时保持其余部分不变?
"object-curly-newline": [
"error",
{
"ObjectExpression": "always",
"ObjectPattern": { "multiline": true },
"ImportDeclaration": { "multiline": true, "minProperties": 4 },
"ExportDeclaration": "never"
}
]
An empty object {}
is ObjectExpression
, so it always breaks line with your rule by specifying always
.一个空对象{}
是ObjectExpression
,所以它总是通过指定always
来打破你的规则。 You can keep empty object without breaking line by configuring minProperties
> 1
:您可以通过配置minProperties
> 1
来保留空对象而不会断线:
{
"ObjectExpression": { "multiline": true, "minProperties": 1 },
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.