From aedd06733da11ed398097f2d9da3463c750ccadf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 9 Aug 2025 12:11:59 +0000 Subject: [PATCH 1/2] Initial plan From 73931a9ca6c0c99acd6cd20ae18fc88a7143871d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 9 Aug 2025 12:21:43 +0000 Subject: [PATCH 2/2] Migrate from eslint to oxlint with @eggjs/oxlint-config Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com> --- .eslintignore | 4 ---- .eslintrc | 6 ------ .oxlintrc.json | 36 ++++++++++++++++++++++++++++++++++++ package.json | 6 +++--- src/detect-port.ts | 2 +- test/detect-port.test.ts | 3 +-- test/wait-port.test.ts | 2 +- 7 files changed, 42 insertions(+), 17 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc create mode 100644 .oxlintrc.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 59d90e7..0000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -test/fixtures -logs -run -coverage diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 9bcdb46..0000000 --- a/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": [ - "eslint-config-egg/typescript", - "eslint-config-egg/lib/rules/enforce-node-prefix" - ] -} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..fdce4dd --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,36 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "node": true, + "mocha": true + }, + "extends": [ + "./node_modules/@eggjs/oxlint-config/.oxlintrc.json" + ], + "rules": { + "promise/prefer-await-to-callbacks": "allow", + "promise/prefer-await-to-then": "allow", + "promise/avoid-new": "allow", + "promise/no-callback-in-promise": "allow", + "unicorn/numeric-separators-style": "allow", + "unicorn/escape-case": "allow", + "unicorn/consistent-assert": "allow", + "unicorn/no-array-for-each": "allow", + "unicorn/prefer-number-properties": "allow", + "unicorn/text-encoding-identifier-case": "allow", + "unicorn/prefer-optional-catch-binding": "allow", + "no-lonely-if": "allow", + "no-unused-vars": "allow", + "no-void": "allow", + "import/no-named-as-default": "allow", + "typescript/no-explicit-any": "allow" + }, + "ignorePatterns": [ + "test/fixtures", + "test/demo", + "logs", + "run", + "coverage", + "dist" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index ac30382..cc2aec9 100644 --- a/package.json +++ b/package.json @@ -23,14 +23,14 @@ "address": "^2.0.1" }, "devDependencies": { + "@eggjs/oxlint-config": "^1.0.0", "@eggjs/tsconfig": "^1.3.3", "@types/mocha": "^10.0.6", "@types/node": "^22.10.1", "egg-bin": "^6.9.0", - "eslint": "^8.52.0", - "eslint-config-egg": "^13.0.0", "execa": "^8.0.1", "mm": "^3.4.0", + "oxlint": "^1.11.1", "strip-ansi": "^7.1.0", "tshy": "^3.0.2", "tshy-after": "^1.0.0", @@ -39,7 +39,7 @@ "scripts": { "pretest": "npm run lint -- --fix && npm run prepublishOnly", "test": "egg-bin test", - "lint": "eslint src test --ext ts", + "lint": "oxlint", "ci": "npm run lint && npm run cov && npm run prepublishOnly", "prepublishOnly": "tshy && tshy-after", "precov": "npm run prepublishOnly", diff --git a/src/detect-port.ts b/src/detect-port.ts index 77e2f13..dd6743a 100644 --- a/src/detect-port.ts +++ b/src/detect-port.ts @@ -1,4 +1,4 @@ -import { createServer, AddressInfo } from 'node:net'; +import { createServer, type AddressInfo } from 'node:net'; import { debuglog } from 'node:util'; import { ip } from 'address'; diff --git a/test/detect-port.test.ts b/test/detect-port.test.ts index a454a44..47158c4 100644 --- a/test/detect-port.test.ts +++ b/test/detect-port.test.ts @@ -3,8 +3,7 @@ import net from 'node:net'; import { strict as assert } from 'node:assert'; import { ip } from 'address'; import mm from 'mm'; -import detect from '../src/index.js'; -import { detect as detect2, detectPort } from '../src/index.js'; +import detect, { detect as detect2, detectPort } from '../src/index.js'; describe('test/detect-port.test.ts', () => { afterEach(mm.restore); diff --git a/test/wait-port.test.ts b/test/wait-port.test.ts index e5d6218..6e94918 100644 --- a/test/wait-port.test.ts +++ b/test/wait-port.test.ts @@ -1,5 +1,5 @@ import { once } from 'node:events'; -import { createServer, Server } from 'node:net'; +import { createServer, type Server } from 'node:net'; import { strict as assert } from 'node:assert'; import { waitPort, detectPort, WaitPortRetryError } from '../src/index.js';