diff --git a/eslint.config.mjs b/eslint.config.mjs index de25b0cc..cb48ee93 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,19 +1,28 @@ // @ts-check +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + import js from '@eslint/js'; import { defineConfig, globalIgnores } from 'eslint/config'; import prettierConfig from 'eslint-config-prettier/flat'; +import eslintPluginPlugin from 'eslint-plugin-eslint-plugin'; import { importX } from 'eslint-plugin-import-x'; import jest from 'eslint-plugin-jest'; import * as jestFormatting from 'eslint-plugin-jest-formatting'; +import nodePlugin from 'eslint-plugin-n'; import globals from 'globals'; import tseslint from 'typescript-eslint'; +const __dirname = dirname(fileURLToPath(import.meta.url)); + const config = defineConfig( js.configs.recommended, tseslint.configs.recommendedTypeChecked, importX.flatConfigs.recommended, importX.flatConfigs.typescript, + nodePlugin.configs['flat/recommended-module'], + eslintPluginPlugin.configs.recommended, { name: 'Language options', files: ['**/*.{js,mjs,cjs,ts,mts}'], @@ -26,12 +35,12 @@ const config = defineConfig( parser: tseslint.parser, parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, + tsconfigRootDir: __dirname, }, }, }, { - name: 'Rules overrides for all files', + name: 'Overrides for all files', rules: { // Base 'max-lines-per-function': 'off', @@ -74,6 +83,10 @@ const config = defineConfig( 'import-x/no-mutable-exports': 'error', 'import-x/no-named-default': 'error', 'import-x/no-relative-packages': 'warn', + + // Node + 'n/no-missing-import': 'off', // handled by import-x and TS + 'n/no-missing-require': 'off', // handled by import-x and TS }, }, { diff --git a/package.json b/package.json index 9b4332e3..b5a38820 100644 --- a/package.json +++ b/package.json @@ -72,9 +72,11 @@ "eslint-config-prettier": "^10.1.8", "eslint-doc-generator": "^2.2.2", "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-eslint-plugin": "^7.0.0", "eslint-plugin-import-x": "^4.16.1", "eslint-plugin-jest": "^29.0.1", "eslint-plugin-jest-formatting": "^3.1.0", + "eslint-plugin-n": "^17.23.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^7.1.0", "eslint-remote-tester": "^3.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15a272d1..b2e25db0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,6 +60,9 @@ importers: eslint-import-resolver-typescript: specifier: ^4.4.4 version: 4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1)))(eslint-plugin-import@2.32.0)(eslint@9.35.0(jiti@2.5.1)) + eslint-plugin-eslint-plugin: + specifier: ^7.0.0 + version: 7.0.0(eslint@9.35.0(jiti@2.5.1)) eslint-plugin-import-x: specifier: ^4.16.1 version: 4.16.1(@typescript-eslint/utils@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1)) @@ -69,6 +72,9 @@ importers: eslint-plugin-jest-formatting: specifier: ^3.1.0 version: 3.1.0(eslint@9.35.0(jiti@2.5.1)) + eslint-plugin-n: + specifier: ^17.23.1 + version: 17.23.1(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2) eslint-plugin-node: specifier: ^11.1.0 version: 11.1.0(eslint@9.35.0(jiti@2.5.1)) @@ -1563,6 +1569,10 @@ packages: emojilib@2.4.0: resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} + enhanced-resolve@5.18.3: + resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} + engines: {node: '>=10.13.0'} + env-ci@11.1.1: resolution: {integrity: sha512-mT3ks8F0kwpo7SYNds6nWj0PaRh+qJxIeBVBXAKTN9hphAzZv7s0QAZQbqnB1fAv/r4pJUGE15BV9UrS31FP2w==} engines: {node: ^18.17 || >=20.6.1} @@ -1626,6 +1636,12 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} + eslint-compat-utils@0.5.1: + resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} + engines: {node: '>=12'} + peerDependencies: + eslint: '>=6.0.0' + eslint-config-prettier@10.1.8: resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} hasBin: true @@ -1685,12 +1701,24 @@ packages: eslint-import-resolver-webpack: optional: true + eslint-plugin-es-x@7.8.0: + resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '>=8' + eslint-plugin-es@3.0.1: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' + eslint-plugin-eslint-plugin@7.0.0: + resolution: {integrity: sha512-EgiW9zf4PbqA+yN9T6Z8bHx46+fWtAIXFrYkL4nSTnI84LnTKmzjh+cIJaVAyFVZveKUSG8LcVe1suGG78qZPw==} + engines: {node: ^20.19.0 || ^22.13.1 || >=24.0.0} + peerDependencies: + eslint: '>=9.0.0' + eslint-plugin-import-x@4.16.1: resolution: {integrity: sha512-vPZZsiOKaBAIATpFE2uMI4w5IRwdv/FpQ+qZZMR4E+PeOcM4OeoEbqxRMnywdxP19TyB/3h6QBB0EWon7letSQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1733,6 +1761,12 @@ packages: jest: optional: true + eslint-plugin-n@17.23.1: + resolution: {integrity: sha512-68PealUpYoHOBh332JLLD9Sj7OQUDkFpmcfqt8R9sySfFSeuGJjMTJQvCRRB96zO3A/PELRLkPrzsHmzEFQQ5A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.23.0' + eslint-plugin-node@11.1.0: resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} @@ -2038,6 +2072,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + globals@16.3.0: resolution: {integrity: sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==} engines: {node: '>=18'} @@ -2054,6 +2092,9 @@ packages: resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==} engines: {node: '>=18'} + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -3560,6 +3601,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + tapable@2.2.3: + resolution: {integrity: sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg==} + engines: {node: '>=6'} + temp-dir@3.0.0: resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} engines: {node: '>=14.16'} @@ -3617,6 +3662,11 @@ packages: peerDependencies: typescript: '>=4.8.4' + ts-declaration-location@1.0.7: + resolution: {integrity: sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==} + peerDependencies: + typescript: '>=4.0.0' + ts-node@10.9.2: resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true @@ -5577,6 +5627,11 @@ snapshots: emojilib@2.4.0: {} + enhanced-resolve@5.18.3: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.2.3 + env-ci@11.1.1: dependencies: execa: 8.0.1 @@ -5689,6 +5744,11 @@ snapshots: escape-string-regexp@5.0.0: {} + eslint-compat-utils@0.5.1(eslint@9.35.0(jiti@2.5.1)): + dependencies: + eslint: 9.35.0(jiti@2.5.1) + semver: 7.7.2 + eslint-config-prettier@10.1.8(eslint@9.35.0(jiti@2.5.1)): dependencies: eslint: 9.35.0(jiti@2.5.1) @@ -5757,12 +5817,25 @@ snapshots: - supports-color optional: true + eslint-plugin-es-x@7.8.0(eslint@9.35.0(jiti@2.5.1)): + dependencies: + '@eslint-community/eslint-utils': 4.9.0(eslint@9.35.0(jiti@2.5.1)) + '@eslint-community/regexpp': 4.12.1 + eslint: 9.35.0(jiti@2.5.1) + eslint-compat-utils: 0.5.1(eslint@9.35.0(jiti@2.5.1)) + eslint-plugin-es@3.0.1(eslint@9.35.0(jiti@2.5.1)): dependencies: eslint: 9.35.0(jiti@2.5.1) eslint-utils: 2.1.0 regexpp: 3.2.0 + eslint-plugin-eslint-plugin@7.0.0(eslint@9.35.0(jiti@2.5.1)): + dependencies: + '@eslint-community/eslint-utils': 4.9.0(eslint@9.35.0(jiti@2.5.1)) + eslint: 9.35.0(jiti@2.5.1) + estraverse: 5.3.0 + eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1)): dependencies: '@typescript-eslint/types': 8.43.0 @@ -5826,6 +5899,21 @@ snapshots: - supports-color - typescript + eslint-plugin-n@17.23.1(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2): + dependencies: + '@eslint-community/eslint-utils': 4.9.0(eslint@9.35.0(jiti@2.5.1)) + enhanced-resolve: 5.18.3 + eslint: 9.35.0(jiti@2.5.1) + eslint-plugin-es-x: 7.8.0(eslint@9.35.0(jiti@2.5.1)) + get-tsconfig: 4.10.1 + globals: 15.15.0 + globrex: 0.1.2 + ignore: 5.3.2 + semver: 7.7.2 + ts-declaration-location: 1.0.7(typescript@5.7.2) + transitivePeerDependencies: + - typescript + eslint-plugin-node@11.1.0(eslint@9.35.0(jiti@2.5.1)): dependencies: eslint: 9.35.0(jiti@2.5.1) @@ -6207,6 +6295,8 @@ snapshots: globals@14.0.0: {} + globals@15.15.0: {} + globals@16.3.0: {} globalthis@1.0.4: @@ -6233,6 +6323,8 @@ snapshots: slash: 5.1.0 unicorn-magic: 0.3.0 + globrex@0.1.2: {} + gopd@1.2.0: optional: true @@ -7906,6 +7998,8 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + tapable@2.2.3: {} + temp-dir@3.0.0: {} tempy@3.1.0: @@ -7961,6 +8055,11 @@ snapshots: dependencies: typescript: 5.7.2 + ts-declaration-location@1.0.7(typescript@5.7.2): + dependencies: + picomatch: 4.0.3 + typescript: 5.7.2 + ts-node@10.9.2(@swc/core@1.13.5)(@types/node@22.15.29)(typescript@5.7.2): dependencies: '@cspotcode/source-map-support': 0.8.1