feat: fix oxlint error for oxlint upgrade (#7756)

1. remove unknown rule out of oxlint
2. add the corresponding back to eslint-config
3. fixed the eslint error for package.json
This commit is contained in:
HaroldZhangCode91
2026-04-01 19:28:57 +08:00
committed by GitHub
parent 80d6e2255f
commit b8b4308e1c
3 changed files with 30 additions and 29 deletions

View File

@@ -104,6 +104,8 @@ export async function javascript(): Promise<Linter.Config[]> {
'keyword-spacing': 'off', 'keyword-spacing': 'off',
'no-control-regex': 'error', 'no-control-regex': 'error',
'no-empty-function': 'off', 'no-empty-function': 'off',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-restricted-properties': [ 'no-restricted-properties': [
'error', 'error',
{ {
@@ -136,8 +138,32 @@ export async function javascript(): Promise<Linter.Config[]> {
'TSEnumDeclaration[const=true]', 'TSEnumDeclaration[const=true]',
'TSExportAssignment', 'TSExportAssignment',
], ],
'no-undef-init': 'error',
'no-undef': 'off', 'no-undef': 'off',
'no-unreachable-loop': 'error', 'no-unreachable-loop': 'error',
'object-shorthand': [
'error',
'always',
{
avoidQuotes: true,
ignoreConstructors: false,
},
],
'one-var': ['error', { initialized: 'never' }],
'prefer-arrow-callback': [
'error',
{
allowNamedFunctions: false,
allowUnboundThis: true,
},
],
'prefer-regex-literals': [
'error',
{
disallowRedundantWrapping: true,
},
],
'spaced-comment': 'error',
'space-before-function-paren': 'off', 'space-before-function-paren': 'off',
'unused-imports/no-unused-imports': 'error', 'unused-imports/no-unused-imports': 'error',

View File

@@ -46,13 +46,12 @@ const javascript: OxlintConfig = {
'no-empty': ['error', { allowEmptyCatch: true }], 'no-empty': ['error', { allowEmptyCatch: true }],
'no-fallthrough': 'error', 'no-fallthrough': 'error',
'no-new-func': 'error', 'no-new-func': 'error',
'no-new-object': 'error', 'no-object-constructor': 'error',
'no-new-symbol': 'error', 'no-new-native-nonconstructor': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }], 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error', 'no-lone-blocks': 'error',
'no-multi-str': 'error', 'no-multi-str': 'error',
'no-octal': 'error', 'no-nonoctal-decimal-escape': 'error',
'no-octal-escape': 'error',
'no-proto': 'error', 'no-proto': 'error',
'no-prototype-builtins': 'error', 'no-prototype-builtins': 'error',
'no-redeclare': ['error', { builtinGlobals: false }], 'no-redeclare': ['error', { builtinGlobals: false }],
@@ -69,7 +68,6 @@ const javascript: OxlintConfig = {
], ],
'no-template-curly-in-string': 'error', 'no-template-curly-in-string': 'error',
'no-throw-literal': 'error', 'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-unused-expressions': [ 'no-unused-expressions': [
'error', 'error',
{ {
@@ -98,15 +96,6 @@ const javascript: OxlintConfig = {
'no-useless-computed-key': 'error', 'no-useless-computed-key': 'error',
'no-useless-constructor': 'error', 'no-useless-constructor': 'error',
'no-useless-return': 'error', 'no-useless-return': 'error',
'object-shorthand': [
'error',
'always',
{
avoidQuotes: true,
ignoreConstructors: false,
},
],
'one-var': ['error', { initialized: 'never' }],
'prefer-const': [ 'prefer-const': [
'error', 'error',
{ {
@@ -114,25 +103,11 @@ const javascript: OxlintConfig = {
ignoreReadBeforeAssign: true, ignoreReadBeforeAssign: true,
}, },
], ],
'eslint/prefer-arrow-callback': [
'error',
{
allowNamedFunctions: false,
allowUnboundThis: true,
},
],
'prefer-exponentiation-operator': 'error', 'prefer-exponentiation-operator': 'error',
'prefer-promise-reject-errors': 'error', 'prefer-promise-reject-errors': 'error',
'eslint/prefer-regex-literals': [
'error',
{
disallowRedundantWrapping: true,
},
],
'prefer-rest-params': 'error', 'prefer-rest-params': 'error',
'prefer-spread': 'error', 'prefer-spread': 'error',
'prefer-template': 'error', 'prefer-template': 'error',
'spaced-comment': 'error',
'symbol-description': 'error', 'symbol-description': 'error',
'unicode-bom': ['error', 'never'], 'unicode-bom': ['error', 'never'],
'use-isnan': [ 'use-isnan': [

View File

@@ -101,7 +101,7 @@
"unplugin-vue": "catalog:", "unplugin-vue": "catalog:",
"vite": "catalog:", "vite": "catalog:",
"vitest": "catalog:", "vitest": "catalog:",
"vue": "^3.5.31", "vue": "catalog:",
"vue-tsc": "catalog:" "vue-tsc": "catalog:"
}, },
"engines": { "engines": {