Skip to content

Commit 2d2f6c5

Browse files
committed
chore: migrate .eslintrc.json to eslint.config.mjs
1 parent 6143ba8 commit 2d2f6c5

File tree

2 files changed

+70
-48
lines changed

2 files changed

+70
-48
lines changed

.eslintrc.json

Lines changed: 0 additions & 48 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
2+
import tsParser from '@typescript-eslint/parser'
3+
import globals from 'globals'
4+
import path from 'node:path'
5+
import { fileURLToPath } from 'node:url'
6+
import js from '@eslint/js'
7+
import { FlatCompat } from '@eslint/eslintrc'
8+
9+
const __filename = fileURLToPath(import.meta.url)
10+
const __dirname = path.dirname(__filename)
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
})
16+
17+
export default defineConfig([
18+
globalIgnores([
19+
'**/rs',
20+
'**/out',
21+
'**/pkg',
22+
'**/dist',
23+
'**/*.d.ts',
24+
'src/test/**/*',
25+
'src/wasm/**/*',
26+
'src/assets/**/*',
27+
'__mocks__/vscode.ts',
28+
]),
29+
{
30+
extends: compat.extends('@cnblogs/typescript'),
31+
32+
languageOptions: {
33+
parser: tsParser,
34+
ecmaVersion: 6,
35+
sourceType: 'module',
36+
37+
parserOptions: {
38+
project: ['./tsconfig.json', './ui/tsconfig.json', './test/tsconfig.json'],
39+
},
40+
},
41+
42+
rules: {
43+
'prettier/prettier': [
44+
'error',
45+
{
46+
endOfLine: 'auto',
47+
},
48+
],
49+
50+
'@typescript-eslint/strict-boolean-expressions': [
51+
'warn',
52+
{
53+
allowString: false,
54+
allowNumber: false,
55+
allowNullableObject: false,
56+
allowNullableBoolean: false,
57+
},
58+
],
59+
},
60+
},
61+
{
62+
files: ['**/*.config.js'],
63+
64+
languageOptions: {
65+
globals: {
66+
...globals.node,
67+
},
68+
},
69+
},
70+
])

0 commit comments

Comments
 (0)