From 54073cbfcfe4679a41f821a5522a9179a19ab136 Mon Sep 17 00:00:00 2001 From: Sysix Date: Fri, 11 Oct 2024 15:12:57 +0200 Subject: [PATCH] chore(ci): use eslint with unstable_ts_config flag --- .github/workflows/lint.yml | 2 +- eslint.config.js => eslint.config.ts | 2 +- package.json | 5 ++- pnpm-lock.yaml | 3 -- src/__snapshots__/rules-by-scope.spec.ts.snap | 32 ++++++++----------- test/helpers.ts | 1 + 6 files changed, 18 insertions(+), 27 deletions(-) rename eslint.config.js => eslint.config.ts (91%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a57d9ba..eef20ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: run: npx oxlint - name: Run eslint - run: npx eslint + run: npx eslint --flag unstable_ts_config diff --git a/eslint.config.js b/eslint.config.ts similarity index 91% rename from eslint.config.js rename to eslint.config.ts index 627cdcb..160d406 100644 --- a/eslint.config.js +++ b/eslint.config.ts @@ -1,4 +1,4 @@ -import oxlint from './lib/index.cjs'; +import oxlint from './src/index.js'; import unicorn from 'eslint-plugin-unicorn'; import eslint from '@eslint/js'; import eslintConfigPrettier from 'eslint-config-prettier'; diff --git a/package.json b/package.json index 4a81c3b..1f935bd 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "generate": "node --import @oxc-node/core/register ./scripts/generate.ts && pnpm format", "clone": "node --import @oxc-node/core/register ./scripts/sparse-clone.ts", "build": "vite build", - "lint": "npx oxlint && npx eslint", + "lint": "npx oxlint && npx eslint --flag unstable_ts_config", "format": "npx prettier --write .", "release": "bumpp package.json", "prepare": "husky", @@ -52,7 +52,6 @@ "rules" ], "devDependencies": { - "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.12.0", "@oxc-node/core": "^0.0.15", "@types/node": "^22.0.0", @@ -76,7 +75,7 @@ "vitest": "^2.0.0" }, "lint-staged": { - "*.{js,cjs,ts}": "eslint", + "*.{js,cjs,ts}": "eslint --flag unstable_ts_config", "*": "prettier --ignore-unknown --write" }, "dependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af96e06..b87cb95 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,9 +12,6 @@ importers: specifier: ^1.3.0 version: 1.3.0 devDependencies: - '@eslint/eslintrc': - specifier: ^3.1.0 - version: 3.1.0 '@eslint/js': specifier: ^9.12.0 version: 9.12.0 diff --git a/src/__snapshots__/rules-by-scope.spec.ts.snap b/src/__snapshots__/rules-by-scope.spec.ts.snap index 60645f5..3b25e64 100644 --- a/src/__snapshots__/rules-by-scope.spec.ts.snap +++ b/src/__snapshots__/rules-by-scope.spec.ts.snap @@ -72,7 +72,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "@typescript-eslint/no-array-constructor": [ - 2, + 0, ], "@typescript-eslint/no-confusing-non-null-assertion": [ 0, @@ -156,7 +156,7 @@ exports[`contains all the oxlint rules 1`] = ` 2, ], "@typescript-eslint/no-unused-vars": [ - 2, + 0, ], "@typescript-eslint/no-useless-constructor": [ 0, @@ -168,7 +168,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "@typescript-eslint/no-wrapper-object-types": [ - 2, + 0, ], "@typescript-eslint/object-curly-spacing": [ 0, @@ -189,7 +189,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "@typescript-eslint/prefer-namespace-keyword": [ - 2, + 0, ], "@typescript-eslint/prefer-ts-expect-error": [ 0, @@ -918,7 +918,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "no-invalid-regexp": [ - 2, + 0, ], "no-irregular-whitespace": [ 0, @@ -966,9 +966,6 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "no-new-native-nonconstructor": [ - 2, - ], - "no-new-symbol": [ 0, ], "no-new-wrappers": [ @@ -1007,9 +1004,6 @@ exports[`contains all the oxlint rules 1`] = ` "no-return-assign": [ 0, ], - "no-return-await": [ - 0, - ], "no-script-url": [ 0, ], @@ -1059,7 +1053,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "no-unreachable": [ - 2, + 0, ], "no-unsafe-finally": [ 0, @@ -1434,7 +1428,7 @@ exports[`contains all the oxlint rules 1`] = ` 2, ], "unicorn/consistent-function-scoping": [ - 2, + 0, ], "unicorn/custom-error-definition": [ 0, @@ -1467,7 +1461,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "unicorn/no-anonymous-default-export": [ - 2, + 0, ], "unicorn/no-array-callback-reference": [ 2, @@ -1518,19 +1512,19 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "unicorn/no-length-as-slice-end": [ - 2, + 0, ], "unicorn/no-lonely-if": [ 0, ], "unicorn/no-magic-array-flat-depth": [ - 2, + 0, ], "unicorn/no-negated-condition": [ 0, ], "unicorn/no-negation-in-equality-check": [ - 2, + 0, ], "unicorn/no-nested-ternary": [ 0, @@ -1596,7 +1590,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "unicorn/no-useless-undefined": [ - 2, + 0, ], "unicorn/no-zero-fractions": [ 0, @@ -1743,7 +1737,7 @@ exports[`contains all the oxlint rules 1`] = ` 0, ], "unicorn/prefer-structured-clone": [ - 2, + 0, ], "unicorn/prefer-switch": [ 2, diff --git a/test/helpers.ts b/test/helpers.ts index b8d488b..c954797 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -3,4 +3,5 @@ import oxlint from '../src/index.js'; export const ESLintTestConfig: ESLint.Options = { baseConfig: oxlint.configs['flat/all'], + flags: ['unstable_ts_config'], };