Skip to content

Commit a235a28

Browse files
committed
build: migrate to ESlint v8+
1 parent dbc8177 commit a235a28

File tree

7 files changed

+89
-29
lines changed

7 files changed

+89
-29
lines changed

.eslintignore

-2
This file was deleted.

.eslintrc.js

-24
This file was deleted.

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"script": "lint",
4848
"problemMatcher": "$eslint-stylish",
4949
"label": "npm: lint",
50-
"detail": "eslint . --ext .ts,.tsx"
50+
"detail": "eslint ."
5151
}
5252
]
5353
}

.vscodeignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ src/**
99
**/*.ts
1010
.gitignore
1111
**/tsconfig*.json
12-
**/.eslintrc.json
12+
**/eslint.config.mjs.mjs
1313
.husky/
1414
.github/
1515
.editorconfig

eslint.config.mjs

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { fixupPluginRules, includeIgnoreFile } from '@eslint/compat';
5+
import { FlatCompat } from '@eslint/eslintrc';
6+
import js from '@eslint/js';
7+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
8+
import tsParser from '@typescript-eslint/parser';
9+
import _import from 'eslint-plugin-import';
10+
import jsdoc from 'eslint-plugin-jsdoc';
11+
import prettier from 'eslint-plugin-prettier';
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const compat = new FlatCompat({
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
19+
});
20+
const gitignorePath = path.resolve(__dirname, '.gitignore');
21+
22+
export default [
23+
{
24+
ignores: ['**/*.js', '**/test-resources'],
25+
},
26+
includeIgnoreFile(gitignorePath),
27+
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'),
28+
{
29+
files: ['**/*.ts', '**/*.tsx'],
30+
31+
plugins: {
32+
'@typescript-eslint': typescriptEslint,
33+
jsdoc,
34+
'import': fixupPluginRules(_import),
35+
prettier,
36+
},
37+
38+
languageOptions: {
39+
parser: tsParser,
40+
},
41+
42+
rules: {
43+
'semi': [2, 'always'],
44+
'@typescript-eslint/no-unused-vars': 0,
45+
'@typescript-eslint/no-explicit-any': 0,
46+
'@typescript-eslint/explicit-module-boundary-types': 0,
47+
'@typescript-eslint/no-non-null-assertion': 0,
48+
49+
'import/order': [
50+
'error',
51+
{
52+
'alphabetize': {
53+
order: 'asc',
54+
},
55+
56+
'newlines-between': 'always',
57+
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
58+
},
59+
],
60+
},
61+
},
62+
];

package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,17 @@
740740
"test:grammar": "npm run test:grammar-free && npm run test:grammar-fixed",
741741
"test:grammar-update": "npm run test:grammar-free -- -u && npm run test:grammar-fixed -- -u",
742742
"posttest": "npm run format",
743-
"lint": "eslint . --ext .ts,.tsx",
743+
"lint": "eslint .",
744744
"lint-fix": "npm run lint -- --fix",
745745
"format": "prettier --write \"src/**/*.{ts,json}\" \"test/**/*.ts\" \"syntaxes/**/*.json\" \"snippets/**/*.json\" \"./**/*.{md,json,yaml,yml}\"",
746746
"prepare": "husky install",
747747
"pre-commit": "lint-staged",
748748
"coverage": "c8 --clean npm run test"
749749
},
750750
"devDependencies": {
751+
"@eslint/compat": "^1.2.6",
752+
"@eslint/eslintrc": "^3.2.0",
753+
"@eslint/js": "^9.20.0",
751754
"@types/glob": "^8.0.1",
752755
"@types/mocha": "^10.0.6",
753756
"@types/node": "^22.13.0",

0 commit comments

Comments
 (0)