Skip to content

Commit f8775e4

Browse files
authored
build: migrate eslint.config.js to typescript (#531)
1 parent b2994c7 commit f8775e4

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

eslint.config.js renamed to eslint.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import path from 'node:path';
22
import { fileURLToPath } from 'node:url';
33
import js from '@eslint/js';
44
import { FlatCompat } from '@eslint/eslintrc';
5+
import { defineConfig } from 'eslint/config';
56
import markdown from 'eslint-plugin-markdown';
67
import pluginN from 'eslint-plugin-n';
8+
// @ts-expect-error - eslint-plugin is not typed yet
79
import eslintPlugin from './lib/index.js';
810

911
const dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -12,7 +14,7 @@ const compat = new FlatCompat({
1214
recommendedConfig: js.configs.recommended,
1315
});
1416

15-
export default [
17+
export default defineConfig([
1618
// Global ignores
1719
{
1820
ignores: ['node_modules', 'coverage'],
@@ -39,7 +41,6 @@ export default [
3941
'unicorn/no-array-reduce': 'off',
4042
'unicorn/no-null': 'off',
4143
'unicorn/prefer-module': 'off',
42-
'unicorn/prefer-node-protocol': 'off', // TODO: enable once we drop support for Node 14.17.
4344
'unicorn/prevent-abbreviations': 'off',
4445
},
4546
},
@@ -82,4 +83,4 @@ export default [
8283
'unicorn/filename-case': 'off',
8384
},
8485
},
85-
];
86+
]);

lib/rules/require-meta-docs-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Requirements
77
// -----------------------------------------------------------------------------
88

9-
import path from 'path';
9+
import path from 'node:path';
1010
import * as utils from '../utils.js';
1111
import { getStaticValue } from '@eslint-community/eslint-utils';
1212

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,27 @@
4848
"@commitlint/config-conventional": "^19.6.0",
4949
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
5050
"@eslint/eslintrc": "^3.0.2",
51-
"@eslint/js": "^9.16.0",
51+
"@eslint/js": "^9.31.0",
5252
"@release-it/conventional-changelog": "^9.0.3",
53-
"@types/eslint": "^9.6.1",
53+
"@types/eslint-plugin-markdown": "^2.0.2",
5454
"@types/estree": "^1.0.8",
55+
"@types/node": "^20.19.0",
5556
"@typescript-eslint/parser": "^8.34.1",
5657
"@typescript-eslint/utils": "^8.34.1",
5758
"@vitest/coverage-istanbul": "^3.2.4",
58-
"eslint": "^9.16.0",
59+
"eslint": "^9.31.0",
5960
"eslint-config-not-an-aardvark": "^2.1.0",
60-
"eslint-config-prettier": "^9.1.0",
61-
"eslint-doc-generator": "^2.0.0",
62-
"eslint-plugin-eslint-plugin": "file:./",
63-
"eslint-plugin-markdown": "^5.0.0",
64-
"eslint-plugin-n": "^17.14.0",
65-
"eslint-plugin-prettier": "^5.1.3",
61+
"eslint-config-prettier": "^10.1.8",
62+
"eslint-doc-generator": "^2.2.2",
63+
"eslint-plugin-markdown": "^5.1.0",
64+
"eslint-plugin-n": "^17.21.0",
65+
"eslint-plugin-prettier": "^5.5.3",
6666
"eslint-plugin-unicorn": "^56.0.1",
67-
"eslint-remote-tester": "^4.0.1",
67+
"eslint-remote-tester": "^4.0.2",
6868
"eslint-scope": "^8.0.1",
6969
"espree": "^10.0.1",
7070
"husky": "^9.1.7",
71+
"jiti": "^2.4.2",
7172
"lodash": "^4.17.21",
7273
"markdownlint-cli": "^0.43.0",
7374
"npm-package-json-lint": "^8.0.0",

tests/lib/rules/no-property-in-node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RuleTester } from 'eslint';
2-
import path from 'path';
3-
import { fileURLToPath } from 'url';
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
44
import rule from '../../../lib/rules/no-property-in-node.js';
55
import parser from '@typescript-eslint/parser';
66

tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"rootDir": ".",
4+
"declaration": true,
5+
"esModuleInterop": true,
6+
"module": "nodenext",
7+
"moduleResolution": "nodenext",
8+
"noEmit": true,
9+
"resolveJsonModule": true,
10+
"skipLibCheck": true,
11+
"strict": true,
12+
"target": "ES2024",
13+
"verbatimModuleSyntax": true,
14+
"erasableSyntaxOnly": true,
15+
"forceConsistentCasingInFileNames": true
16+
}
17+
}

0 commit comments

Comments
 (0)