Skip to content

Commit bf20695

Browse files
Copilotfengmk2
andcommitted
Migrate from ESLint to oxlint and @eggjs/oxlint-config
Co-authored-by: fengmk2 <[email protected]>
1 parent 1c80110 commit bf20695

6 files changed

Lines changed: 28 additions & 14 deletions

File tree

.eslintrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

.oxlintrc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"env": {
4+
"node": true
5+
},
6+
"categories": {
7+
"correctness": "error",
8+
"suspicious": "allow",
9+
"pedantic": "allow",
10+
"style": "allow",
11+
"nursery": "allow",
12+
"restriction": "allow"
13+
},
14+
"plugins": [
15+
"oxc"
16+
],
17+
"rules": {
18+
"no-extend-native": "warn",
19+
"no-control-regex": "allow",
20+
"no-unused-private-class-members": "allow"
21+
}
22+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"url": "git://github.com/node-modules/urllib.git"
2424
},
2525
"scripts": {
26-
"lint": "eslint src test --ext .ts --cache",
26+
"lint": "oxlint src test",
2727
"prebuild": "npm run clean",
2828
"build": "tsc --version && tshy && tshy-after && npm run build:version",
2929
"postbuild": "rm -rf *.tsbuildinfo",
@@ -55,6 +55,7 @@
5555
},
5656
"devDependencies": {
5757
"@arethetypeswrong/cli": "^0.18.0",
58+
"@eggjs/oxlint-config": "^1.0.0",
5859
"@eggjs/tsconfig": "^2.0.0",
5960
"@tsconfig/node18": "^18.2.1",
6061
"@tsconfig/strictest": "^2.0.2",
@@ -69,9 +70,8 @@
6970
"@vitest/coverage-v8": "^3.0.2",
7071
"busboy": "^1.6.0",
7172
"cross-env": "^10.0.0",
72-
"eslint": "8",
73-
"eslint-config-egg": "14",
7473
"iconv-lite": "^0.6.3",
74+
"oxlint": "^1.11.0",
7575
"proxy": "^1.0.2",
7676
"selfsigned": "^3.0.0",
7777
"string.prototype.towellformed": "^1.0.2",

test/options.dataType.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('options.dataType.test.ts', () => {
141141
}, (err: any) => {
142142
// console.error(err);
143143
assert.equal(err.name, 'JSONResponseFormatError');
144-
assert.match(err.message, /\" \.\.\.skip\.\.\. \"/);
144+
assert.match(err.message, /" \.\.\.skip\.\.\. "/);
145145
assert.equal(err.res.status, 200);
146146
assert.equal(err.res.headers['content-type'], 'application/json');
147147
return true;

test/options.fixJSONCtlChars.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('options.fixJSONCtlChars.test.ts', () => {
2424
assert.equal(response.status, 200);
2525
// console.log(response.data);
2626
assert.deepEqual(response.data, {
27-
foo: '\b\f\n\r\tbar\u000e!1!\u0086!2\!\u0000\!3\!\u001f\!4\!\\\!5\!end\\\\',
27+
foo: '\b\f\n\r\tbar\u000e!1!\u0086!2!\u0000!3!\u001f!4!\\\!5!end\\\\',
2828
});
2929
});
3030

test/user-agent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('keep-alive-header.test.ts', () => {
2222
});
2323
assert.equal(response.status, 200);
2424
// console.log(response.data.headers);
25-
assert.match(response.data.headers['user-agent'], /^node\-urllib\/VERSION Node\.js\/\d+\.\d+\.\d+ \(/);
25+
assert.match(response.data.headers['user-agent'], /^node-urllib\/VERSION Node\.js\/\d+\.\d+\.\d+ \(/);
2626
});
2727

2828
it('should return no user agent if user-agent header is set to empty string', async () => {

0 commit comments

Comments
 (0)