Skip to content

Commit 798a8d1

Browse files
Copilotfengmk2
andauthored
chore: update oxlint config to use @eggjs/oxlint-config (#30)
This PR updates the project's oxlint configuration to use the shared `@eggjs/oxlint-config` package instead of maintaining a large inline configuration. ## Changes Made - **Added dependency**: Installed `@eggjs/oxlint-config@^1.0.0` as a dev dependency - **Simplified configuration**: Replaced the 143-line `.oxlintrc.json` with a minimal 15-line extends-based configuration - **Preserved project-specific settings**: - Kept `mocha` environment (in addition to `node` from base config) - Maintained project-specific `ignorePatterns` for `index.d.ts`, `test/fixtures/**`, and `__snapshots__` - Override `no-console` rule to "warn" and `no-empty-function` to "allow" to match original project behavior ## Benefits - **Reduced maintenance burden**: 132 fewer lines of configuration to maintain - **Automatic updates**: Linting rules will be updated automatically when upgrading the shared config - **Consistency**: Uses the same linting rules as other EggJS ecosystem projects - **Fixed linting issues**: Resolves previous errors related to `import/consistent-type-specifier-style` ## Verification - ✅ All linting passes with 0 warnings and 0 errors - ✅ Build process works correctly with `npm run prepublishOnly` - ✅ Lint-staged and husky hooks continue to work properly - ✅ `oxlint --fix` functionality works as expected The configuration now leverages the shared, community-maintained rules while preserving the project's specific requirements. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/node-modules/oss-client/issues/new?title=✨Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
1 parent 46b4acf commit 798a8d1

File tree

2 files changed

+3
-132
lines changed

2 files changed

+3
-132
lines changed

.oxlintrc.json

Lines changed: 2 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,13 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"extends": ["./node_modules/@eggjs/oxlint-config/.oxlintrc.json"],
34
"env": {
45
"node": true,
56
"mocha": true
67
},
7-
"categories": {
8-
"correctness": "error",
9-
"perf": "error",
10-
"nursery": "error",
11-
"restriction": "error",
12-
"style": "error",
13-
"pedantic": "error",
14-
"suspicious": "error"
15-
},
16-
"plugins": [
17-
"import",
18-
"typescript",
19-
"unicorn",
20-
"jsdoc",
21-
"node",
22-
"promise",
23-
"oxc"
24-
],
258
"rules": {
26-
// eslint
27-
"constructor-super": "error",
28-
"getter-return": "error",
29-
"no-undef": "error",
30-
"no-unreachable": "error",
31-
"no-var": "error",
32-
"no-eq-null": "error",
33-
"no-await-in-loop": "allow",
34-
"eqeqeq": ["error", "smart"],
35-
"init-declarations": "allow",
36-
"curly": "allow",
37-
"no-ternary": "allow",
38-
"max-params": ["error", 5],
39-
"no-await-expression-member": "error",
40-
"no-continue": "allow",
41-
"guard-for-in": "allow",
42-
"func-style": "allow",
43-
"sort-imports": "allow",
44-
"yoda": "allow",
45-
"sort-keys": "allow",
46-
"no-magic-numbers": "allow",
47-
"no-duplicate-imports": "error",
48-
"no-multi-assign": "error",
49-
"func-names": "error",
50-
"default-param-last": "error",
51-
"prefer-object-spread": "error",
52-
"no-undefined": "allow",
53-
"no-plusplus": "allow",
54-
// maybe warn
559
"no-console": "warn",
56-
"no-extraneous-class": "allow",
57-
"no-empty-function": "allow",
58-
"max-depth": ["error", 6],
59-
"max-lines-per-function": "allow",
60-
"no-lonely-if": "error",
61-
"max-lines": "allow",
62-
"require-await": "allow",
63-
"max-nested-callbacks": ["error", 5],
64-
"max-classes-per-file": "allow",
65-
"radix": "allow",
66-
"no-negated-condition": "error",
67-
"no-else-return": "error",
68-
"no-throw-literal": "error",
69-
70-
// import
71-
"import/exports-last": "allow",
72-
"import/max-dependencies": "allow",
73-
"import/no-cycle": "error",
74-
"import/no-anonymous-default-export": "allow",
75-
"import/no-namespace": "error",
76-
"import/named": "error",
77-
"import/export": "error",
78-
"import/no-default-export": "allow",
79-
"import/unambiguous": "error",
80-
"import/group-exports": "allow",
81-
82-
// promise
83-
"promise/no-return-wrap": "error",
84-
"promise/param-names": "error",
85-
"promise/prefer-await-to-callbacks": "error",
86-
"promise/prefer-await-to-then": "error",
87-
"promise/prefer-catch": "error",
88-
"promise/no-return-in-finally": "error",
89-
"promise/avoid-new": "error",
90-
91-
// unicorn
92-
"unicorn/error-message": "error",
93-
"unicorn/no-null": "allow",
94-
"unicorn/filename-case": "allow",
95-
"unicorn/prefer-structured-clone": "error",
96-
"unicorn/prefer-logical-operator-over-ternary": "error",
97-
"unicorn/prefer-number-properties": "error",
98-
"unicorn/prefer-array-some": "error",
99-
"unicorn/prefer-string-slice": "error",
100-
// "unicorn/no-null": "error",
101-
"unicorn/throw-new-error": "error",
102-
"unicorn/catch-error-name": "allow",
103-
"unicorn/prefer-spread": "allow",
104-
"unicorn/numeric-separators-style": "error",
105-
"unicorn/prefer-string-raw": "error",
106-
"unicorn/text-encoding-identifier-case": "error",
107-
"unicorn/no-array-for-each": "error",
108-
"unicorn/explicit-length-check": "error",
109-
"unicorn/no-lonely-if": "error",
110-
"unicorn/no-useless-undefined": "allow",
111-
"unicorn/prefer-date-now": "error",
112-
"unicorn/no-static-only-class": "allow",
113-
"unicorn/no-typeof-undefined": "error",
114-
"unicorn/prefer-negative-index": "error",
115-
"unicorn/no-anonymous-default-export": "allow",
116-
117-
// oxc
118-
"oxc/no-map-spread": "error",
119-
"oxc/no-rest-spread-properties": "allow",
120-
"oxc/no-optional-chaining": "allow",
121-
"oxc/no-async-await": "allow",
122-
123-
// typescript
124-
"typescript/explicit-function-return-type": "allow",
125-
"typescript/consistent-type-imports": "error",
126-
"typescript/consistent-type-definitions": "error",
127-
"typescript/consistent-indexed-object-style": "allow",
128-
"typescript/no-inferrable-types": "error",
129-
"typescript/array-type": "error",
130-
"typescript/no-non-null-assertion": "error",
131-
"typescript/no-explicit-any": "error",
132-
"typescript/no-import-type-side-effects": "error",
133-
"typescript/no-dynamic-delete": "error",
134-
"typescript/prefer-ts-expect-error": "error",
135-
"typescript/ban-ts-comment": "error",
136-
"typescript/prefer-enum-initializers": "error",
137-
138-
// jsdoc
139-
"jsdoc/require-returns": "allow",
140-
"jsdoc/require-param": "allow"
10+
"no-empty-function": "allow"
14111
},
14212
"ignorePatterns": ["index.d.ts", "test/fixtures/**", "__snapshots__"]
14313
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
},
5050
"devDependencies": {
5151
"@arethetypeswrong/cli": "^0.15.3",
52+
"@eggjs/oxlint-config": "^1.0.0",
5253
"@eggjs/tsconfig": "^1.1.0",
5354
"@types/mime": "^3.0.1",
5455
"@types/ms": "^0.7.31",

0 commit comments

Comments
 (0)