问题描述
我希望能够像这样格式化我的代码:
const {
header,
note,
otherStuff
} = labels;
const { thisDestructuredObject } = _.get(labels,`some.thing.here`,`some.default.value`);
Eslint 格式如下:
const {
header, note, otherStuff
} = labels;
const { thisDestructuredObject } = _.get(labels,
`some.thing.here`,
`some.default.value`);
然而,我设定了两个规则:
"function-paren-newline": ["error", { "minItems": 4 }],
"object-curly-newline": [
"error",
{
"ObjectExpression": { "multiline": true, "minProperties": 2 },
"ObjectPattern": { "multiline": true, "minProperties": 2 },
"ImportDeclaration": "never",
"ExportDeclaration": { "multiline": true, "minProperties": 3 }
}
]
我为React
启用了预设,并为 ESLint 推荐了设置。
此外,还设置了React
和React-hooks
插件。
有没有人试过做这样的事情?
1楼
目前没有针对此的内置规则,但有一个。 包有几个规则来执行此操作,直到它被烘烤。