-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
89 lines (82 loc) · 2.07 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
89
import javascriptEslint from '@eslint/js'
import pluginJest from 'eslint-plugin-jest'
import pluginNode from 'eslint-plugin-n'
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort'
import typescriptEslint from 'typescript-eslint'
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
javascriptEslint.configs.recommended,
...typescriptEslint.configs.recommended,
{
settings: {
jest: {
version: 29,
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
ignores: ['**/node_modules', '**/dist', '**/coverage'],
},
/* Import sorting */
{
plugins: {
'simple-import-sort': pluginSimpleImportSort,
},
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
/* Source files */
{
files: ['src/**/*.ts', 'examples/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
caughtErrors: 'none',
args: 'none',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-explicit-any': ['warn'],
},
},
/* Mock files */
{
files: ['src/**/__mocks__/**', 'src/**/__mocks__/**'],
rules: {
'@typescript-eslint/no-explicit-any': ['off'],
},
},
/* Test files */
{
files: ['test/**/*.ts', 'src/**/__tests__/**', 'src/**/*.spec.ts'],
...pluginJest.configs['flat/recommended'],
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
caughtErrors: 'none',
args: 'none',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-explicit-any': ['warn'],
},
},
/* Node files */
{
files: ['**/*.mjs'],
...pluginNode.configs['flat/recommended-script'],
},
]