-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
73 lines (66 loc) · 1.74 KB
/
eslint.config.js
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
import common from 'eslint-config-neon/flat/common.js';
import node from 'eslint-config-neon/flat/node.js';
import prettier from 'eslint-config-neon/flat/prettier.js';
import typescript from 'eslint-config-neon/flat/typescript.js';
import merge from 'lodash.merge';
import tseslint from 'typescript-eslint';
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
const project = ['tsconfig.eslint.json', 'services/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'];
const commonRuleset = merge(...common, {
files: [`**/*${commonFiles}`],
rules: {
'no-eq-null': ['off'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'jsdoc/no-undefined-types': ['off'],
'import/no-duplicates': ['off'],
},
});
const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true,
project,
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': [2, 'interface'],
'@typescript-eslint/naming-convention': [
2,
{
selector: 'typeParameter',
format: ['PascalCase'],
custom: {
regex: '^\\w{3,}',
match: true,
},
},
],
},
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
});
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
export default tseslint.config(
{
ignores: ['**/node_modules/', '.git/', '**/dist/', '**/coverage/'],
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
{
rules: {
'no-restricted-globals': ['off'],
'n/prefer-global/url': ['off'],
'n/prefer-global/url-search-params': ['off'],
},
},
prettierRuleset,
);