chore: update oxlint config to use @eggjs/oxlint-config (#824)

Updates the oxlint configuration to use the new shared
`@eggjs/oxlint-config` package, significantly simplifying the project's
linting setup while maintaining all existing functionality.

## Changes

- **Added** `@eggjs/oxlint-config@1.0.0` as a dev dependency
- **Updated** `.oxlintrc.json` to extend from the shared configuration
- **Simplified** configuration from 156 lines to 20 lines (87%
reduction)
- **Maintained** all project-specific overrides:
  - `max-params: 6` (vs shared config's 5)
  - `no-console: "warn"` (vs shared config's "allow")
- `import/no-anonymous-default-export: "error"` (vs shared config's
"allow")
  - Added `mocha` environment for test files
  - Preserved `index.d.ts` ignore pattern

## Benefits

- **Consistency**: Now uses the same base linting rules as other EggJS
projects
- **Maintainability**: Rule updates are centralized in the shared config
- **Simplicity**: Dramatically reduced configuration complexity
- **Future-proof**: Automatic updates when the shared config is improved

The configuration now only contains project-specific overrides, making
it much easier to understand and maintain. All existing linting behavior
is preserved - the project passes all linting checks with zero warnings
and errors.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
This commit is contained in:
Copilot
2025-08-08 22:00:43 +08:00
committed by GitHub
parent c3a22fd319
commit f94531cf35
2 changed files with 6 additions and 142 deletions

View File

@@ -1,156 +1,19 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": [
"./node_modules/@eggjs/oxlint-config/.oxlintrc.json"
],
"env": {
"node": true,
"mocha": true
},
"categories": {
"correctness": "error",
"perf": "error",
"nursery": "error",
"restriction": "error",
"style": "error",
"pedantic": "error",
"suspicious": "error"
},
"plugins": [
"import",
"typescript",
"unicorn",
"jsdoc",
"node",
"promise",
"oxc"
],
"rules": {
// eslint
"constructor-super": "error",
"group-exports": "allow",
"getter-return": "error",
"no-undef": "error",
"no-unreachable": "error",
"no-var": "error",
"no-eq-null": "error",
"no-await-in-loop": "allow",
"eqeqeq": ["error", "smart"],
"init-declarations": "allow",
"curly": "allow",
"no-ternary": "allow",
// Project-specific overrides
"max-params": ["error", 6],
"no-await-expression-member": "error",
"no-continue": "allow",
"guard-for-in": "allow",
"func-style": "allow",
"sort-imports": "allow",
"yoda": "allow",
"sort-keys": "allow",
"no-magic-numbers": "allow",
"no-duplicate-imports": "error",
"no-multi-assign": "error",
"func-names": "error",
"default-param-last": "error",
"prefer-object-spread": "error",
"no-undefined": "allow",
"no-plusplus": "allow",
// maybe warn
"no-console": "warn",
"no-extraneous-class": "allow",
"no-empty-function": "error",
"max-depth": ["error", 6],
"max-lines-per-function": "allow",
"no-lonely-if": "error",
"max-lines": "allow",
"require-await": "allow",
"max-nested-callbacks": ["error", 5],
"max-classes-per-file": "allow",
"radix": "allow",
"no-negated-condition": "error",
"no-else-return": "error",
"no-throw-literal": "error",
"id-length": "allow",
"arrow-body-style": "allow",
"prefer-destructuring": "allow",
"new-cap": "allow",
// import
"import/exports-last": "allow",
"import/max-dependencies": "allow",
"import/no-cycle": "error",
"import/no-anonymous-default-export": "error",
"import/no-namespace": "error",
"import/named": "error",
"import/export": "error",
"import/no-default-export": "allow",
"import/unambiguous": "error",
"import/extensions": "allow",
"import/prefer-default-export": "allow",
// promise
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"promise/prefer-await-to-callbacks": "error",
"promise/prefer-await-to-then": "error",
"promise/prefer-catch": "error",
"promise/no-return-in-finally": "error",
"promise/avoid-new": "error",
// unicorn
"unicorn/error-message": "error",
"unicorn/no-null": "allow",
"unicorn/filename-case": "allow",
"unicorn/prefer-structured-clone": "error",
"unicorn/prefer-logical-operator-over-ternary": "error",
"unicorn/prefer-number-properties": "error",
"unicorn/prefer-array-some": "error",
"unicorn/prefer-string-slice": "error",
// "unicorn/no-null": "error",
"unicorn/throw-new-error": "error",
"unicorn/catch-error-name": "allow",
"unicorn/prefer-spread": "allow",
"unicorn/numeric-separators-style": "error",
"unicorn/prefer-string-raw": "error",
"unicorn/text-encoding-identifier-case": "error",
"unicorn/no-array-for-each": "error",
"unicorn/explicit-length-check": "error",
"unicorn/no-lonely-if": "error",
"unicorn/no-useless-undefined": "allow",
"unicorn/prefer-date-now": "error",
"unicorn/no-static-only-class": "allow",
"unicorn/no-typeof-undefined": "error",
"unicorn/prefer-negative-index": "error",
// oxc
"oxc/no-map-spread": "error",
"oxc/no-rest-spread-properties": "allow",
"oxc/no-optional-chaining": "allow",
"oxc/no-async-await": "allow",
// typescript
"typescript/explicit-function-return-type": "allow",
"typescript/consistent-type-imports": "error",
"typescript/consistent-type-definitions": "error",
"typescript/consistent-indexed-object-style": "allow",
"typescript/no-inferrable-types": "error",
"typescript/array-type": "error",
"typescript/no-non-null-assertion": "error",
"typescript/no-explicit-any": "error",
"typescript/no-import-type-side-effects": "error",
"typescript/no-dynamic-delete": "error",
"typescript/prefer-ts-expect-error": "error",
"typescript/ban-ts-comment": "error",
"typescript/prefer-enum-initializers": "error",
"typescript/explicit-module-boundary-types": "allow",
// jsdoc
"jsdoc/require-returns": "allow",
"jsdoc/require-param": "allow",
// import
"consistent-type-specifier-style": "allow",
"no-unassigned-import": "allow",
// for-loop
"no-for-loop": "allow"
"new-cap": "allow"
},
"ignorePatterns": ["index.d.ts"]
}

View File

@@ -140,6 +140,7 @@
"devDependencies": {
"@eggjs/bin": "^7.1.0",
"@eggjs/mock": "^6.0.7",
"@eggjs/oxlint-config": "^1.0.0",
"@eggjs/tsconfig": "^2.0.0",
"@elastic/elasticsearch-mock": "^2.0.0",
"@simplewebauthn/typescript-types": "^7.0.0",