-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
101 lines (100 loc) · 2.17 KB
/
eslint.config.mjs
File metadata and controls
101 lines (100 loc) · 2.17 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import nodePlugin from 'eslint-plugin-n';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
name: 'ignore files',
ignores: ['dist/', 'reports/', 'data/']
},
{
name: 'include files',
files: ['**/*.{js,mjs,cjs,ts}']
},
{
name: 'globals for node',
files: ['**/*.{mjs,cjs,ts}'],
languageOptions: { globals: globals.node }
},
{
...pluginJs.configs.recommended,
name: 'plugin-js recommended'
},
{
...nodePlugin.configs['flat/recommended-module'],
name: 'custom eslint-plugin-n plugin config',
files: ['**/*.ts'],
rules: {
'n/no-process-env': 'error',
'n/no-missing-import': [
'off', // eslint-plugin-n fails to resolve index.ts files
{
tryExtensions: ['.ts', '.d.ts']
}
]
},
languageOptions: {
globals: {
...globals.node,
NodeJS: true
}
}
},
{
...nodePlugin.configs['flat/recommended-module'],
name: 'custom eslint-plugin-n plugin config for tests',
files: ['tests*/**/*.ts'],
// eslint-plugin-n rules
rules: {
'n/no-process-env': 'off'
},
languageOptions: {
globals: {
...globals.jest
}
}
},
...tseslint.configs.recommended.map(config => ({
...config,
files: ['**/*.ts'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
]
}
})),
{
// eslint core rules
rules: {
// complexity: ['error', 10],
'no-console': 'error',
eqeqeq: ['error', 'smart']
}
},
{
name: 'scripts that run in the browser',
files: ['public/**/*.js'],
languageOptions: {
sourceType: 'script',
globals: {
...globals.browser
}
},
rules: {
'no-unused-vars': [
'error',
{
vars: 'local'
}
]
}
},
pluginPrettierRecommended
];