fix: 调整lint执行顺序
使用核心 no-nested-ternary 规则替代 Unicorn 自动修复,避免嵌套三元表达式被错误加括号 调整 oxlint、oxfmt、eslint 和 stylelint 的执行顺序,保证commit与format流程一致
This commit is contained in:
@@ -28,6 +28,8 @@ const javascript: OxlintConfig = {
|
||||
'default-case-last': 'error',
|
||||
eqeqeq: ['error', 'always'],
|
||||
'eslint/no-unreachable': 'error',
|
||||
// 抛出嵌套三元运算格式错误,禁止使用嵌套三元运算。
|
||||
'no-nested-ternary': 'error',
|
||||
'new-cap': [
|
||||
'error',
|
||||
{
|
||||
|
||||
@@ -43,7 +43,8 @@ const unicorn: OxlintConfig = {
|
||||
'unicorn/no-magic-array-flat-depth': 'error',
|
||||
'unicorn/no-negated-condition': 'error',
|
||||
'unicorn/no-negation-in-equality-check': 'error',
|
||||
'unicorn/no-nested-ternary': 'error',
|
||||
// 禁止通过“添加括号”自动修复嵌套三元运算
|
||||
'unicorn/no-nested-ternary': 'off',
|
||||
'unicorn/no-new-array': 'error',
|
||||
'unicorn/no-new-buffer': 'error',
|
||||
'unicorn/no-object-as-default-parameter': 'error',
|
||||
|
||||
@@ -112,17 +112,17 @@ async function runLint({ format, threads }: LintCommandOptions) {
|
||||
|
||||
if (format) {
|
||||
await runSerial([
|
||||
['stylelint', ['**/*.{vue,css,less,scss}', '--cache', '--fix']],
|
||||
['oxfmt', [threadsArg]],
|
||||
['oxlint', ['--fix', '--type-aware', threadsArg]],
|
||||
['oxfmt', [threadsArg]],
|
||||
['eslint', ['.', '--cache', '--fix']],
|
||||
['stylelint', ['**/*.{vue,css,less,scss}', '--cache', '--fix']],
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
const commands: Command[] = [
|
||||
['oxfmt', ['--check', threadsArg]],
|
||||
['oxlint', ['--type-aware', threadsArg]],
|
||||
['oxfmt', ['--check', threadsArg]],
|
||||
['eslint', ['.', '--cache']],
|
||||
['stylelint', ['**/*.{vue,css,less,scss}', '--cache']],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user