Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

129 changes: 129 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"node": true
},
"extends": [
"./node_modules/@eggjs/oxlint-config/.oxlintrc.json"
],
"categories": {
"correctness": "allow",
"suspicious": "allow",
"pedantic": "allow",
"style": "allow",
"nursery": "allow",
"restriction": "allow",
"perf": "allow"
},
"rules": {
"no-extend-native": "warn",
// Disable TypeScript rules
"typescript/explicit-function-return-type": "allow",
"typescript/consistent-type-imports": "allow",
"typescript/consistent-type-definitions": "allow",
"typescript/consistent-indexed-object-style": "allow",
"typescript/no-inferrable-types": "allow",
"typescript/array-type": "allow",
"typescript/no-non-null-assertion": "allow",
"typescript/no-explicit-any": "allow",
"typescript/no-import-type-side-effects": "allow",
"typescript/no-dynamic-delete": "allow",
"typescript/prefer-ts-expect-error": "allow",
"typescript/ban-ts-comment": "allow",
"typescript/prefer-enum-initializers": "allow",
"typescript/explicit-module-boundary-types": "allow",
// Disable import rules
"import/exports-last": "allow",
"import/max-dependencies": "allow",
"import/no-cycle": "allow",
"import/no-anonymous-default-export": "allow",
"import/no-namespace": "allow",
"import/named": "allow",
"import/export": "allow",
"import/no-default-export": "allow",
"import/unambiguous": "allow",
"import/group-exports": "allow",
"import/extensions": "allow",
"import/consistent-type-specifier-style": "allow",
"import/prefer-default-export": "allow",
"import/no-named-as-default-member": "allow",
// Disable unicorn rules
"unicorn/error-message": "allow",
"unicorn/no-null": "allow",
"unicorn/filename-case": "allow",
"unicorn/prefer-structured-clone": "allow",
"unicorn/prefer-logical-operator-over-ternary": "allow",
"unicorn/prefer-number-properties": "allow",
"unicorn/prefer-array-some": "allow",
"unicorn/prefer-string-slice": "allow",
"unicorn/throw-new-error": "allow",
"unicorn/catch-error-name": "allow",
"unicorn/prefer-spread": "allow",
"unicorn/numeric-separators-style": "allow",
"unicorn/prefer-string-raw": "allow",
"unicorn/text-encoding-identifier-case": "allow",
"unicorn/no-array-for-each": "allow",
"unicorn/explicit-length-check": "allow",
"unicorn/no-lonely-if": "allow",
"unicorn/no-useless-undefined": "allow",
"unicorn/prefer-date-now": "allow",
"unicorn/no-static-only-class": "allow",
"unicorn/no-typeof-undefined": "allow",
"unicorn/prefer-negative-index": "allow",
"unicorn/no-anonymous-default-export": "allow",
"unicorn/consistent-assert": "allow",
// Disable promise rules
"promise/no-return-wrap": "allow",
"promise/param-names": "allow",
"promise/prefer-await-to-callbacks": "allow",
"promise/prefer-await-to-then": "allow",
"promise/prefer-catch": "allow",
"promise/no-return-in-finally": "allow",
"promise/avoid-new": "allow",
// Disable other ESLint rules
"constructor-super": "allow",
"getter-return": "allow",
"no-undef": "allow",
"no-unreachable": "allow",
"no-var": "allow",
"no-eq-null": "allow",
"no-await-in-loop": "allow",
"eqeqeq": "allow",
"init-declarations": "allow",
"curly": "allow",
"no-ternary": "allow",
"max-params": "allow",
"no-await-expression-member": "allow",
"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": "allow",
"no-multi-assign": "allow",
"func-names": "allow",
"default-param-last": "allow",
"prefer-object-spread": "allow",
"no-undefined": "allow",
"no-plusplus": "allow",
"no-console": "allow",
"no-extraneous-class": "allow",
"no-empty-function": "allow",
"max-depth": "allow",
"max-lines-per-function": "allow",
"no-lonely-if": "allow",
"max-lines": "allow",
"require-await": "allow",
"max-nested-callbacks": "allow",
"max-classes-per-file": "allow",
"radix": "allow",
"no-negated-condition": "allow",
"no-else-return": "allow",
"no-throw-literal": "allow",
"id-length": "allow",
"arrow-body-style": "allow",
"prefer-destructuring": "allow"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "git://github.com/node-modules/urllib.git"
},
"scripts": {
"lint": "eslint src test --ext .ts --cache",
"lint": "oxlint src test",
"prebuild": "npm run clean",
"build": "tsc --version && tshy && tshy-after && npm run build:version",
"postbuild": "rm -rf *.tsbuildinfo",
Expand Down Expand Up @@ -55,6 +55,7 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.0",
"@eggjs/oxlint-config": "^1.0.0",
"@eggjs/tsconfig": "^2.0.0",
"@tsconfig/node18": "^18.2.1",
"@tsconfig/strictest": "^2.0.2",
Expand All @@ -69,9 +70,8 @@
"@vitest/coverage-v8": "^3.0.2",
"busboy": "^1.6.0",
"cross-env": "^10.0.0",
"eslint": "8",
"eslint-config-egg": "14",
"iconv-lite": "^0.6.3",
"oxlint": "^1.11.0",
"proxy": "^1.0.2",
"selfsigned": "^3.0.0",
"string.prototype.towellformed": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion test/options.dataType.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('options.dataType.test.ts', () => {
}, (err: any) => {
// console.error(err);
assert.equal(err.name, 'JSONResponseFormatError');
assert.match(err.message, /\" \.\.\.skip\.\.\. \"/);
assert.match(err.message, /" \.\.\.skip\.\.\. "/);
assert.equal(err.res.status, 200);
assert.equal(err.res.headers['content-type'], 'application/json');
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/options.fixJSONCtlChars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('options.fixJSONCtlChars.test.ts', () => {
assert.equal(response.status, 200);
// console.log(response.data);
assert.deepEqual(response.data, {
foo: '\b\f\n\r\tbar\u000e!1!\u0086!2\!\u0000\!3\!\u001f\!4\!\\\!5\!end\\\\',
foo: '\b\f\n\r\tbar\u000e!1!\u0086!2!\u0000!3!\u001f!4!\\\!5!end\\\\',
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/user-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('keep-alive-header.test.ts', () => {
});
assert.equal(response.status, 200);
// console.log(response.data.headers);
assert.match(response.data.headers['user-agent'], /^node\-urllib\/VERSION Node\.js\/\d+\.\d+\.\d+ \(/);
assert.match(response.data.headers['user-agent'], /^node-urllib\/VERSION Node\.js\/\d+\.\d+\.\d+ \(/);
});

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