-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
eslint.config.mjs
88 lines (86 loc) · 2.22 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import js from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginImportX from 'eslint-plugin-import-x'
import eslintPluginJest from 'eslint-plugin-jest'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import globals from 'globals'
import tseslint from 'typescript-eslint'
const tsFiles = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts']
const testFiles = ['test/**', 'jest.setup.js']
const forFiles = (files, confs) => confs.map((conf) => ({ ...conf, files }))
export default tseslint.config(
js.configs.recommended,
eslintPluginImportX.flatConfigs.recommended,
{
plugins: {
unicorn: eslintPluginUnicorn,
},
rules: {
'unicorn/prefer-node-protocol': 'error',
},
},
...forFiles(tsFiles, [
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
eslintPluginImportX.flatConfigs.typescript,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as' },
],
},
},
]),
...forFiles(testFiles, [
eslintPluginJest.configs['flat/recommended'],
eslintPluginJest.configs['flat/style'],
{
languageOptions: {
globals: { ...globals.jest },
},
rules: {
'jest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['itExceptWin', 'itOnlyWin'] },
],
},
},
]),
eslintConfigPrettier,
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
languageOptions: {
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
},
globals: {
...globals.node,
...globals.browser,
},
},
rules: {
'import-x/order': ['error', { alphabetize: { order: 'asc' } }],
},
settings: {
'import-x/resolver': 'typescript',
},
},
{
ignores: [
'bin/**/*',
'coverage/**/*',
'dist/**/*',
'lib/**/*',
'node_modules/**/*',
'tmp/**/*',
'types/**/*',
],
}
)