-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
128 lines (125 loc) · 3.76 KB
/
.eslintrc.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const jsonRules = {
indent: [
'error',
4,
{
SwitchCase: 1,
ignoredNodes: ['VariableDeclaration[declarations.length=0]']
}
]
};
const javascriptRules = {
...jsonRules,
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*']
}
]
}
],
'react/style-prop-object': 'off',
'quotes': ['error', 'single'],
'quote-props': ['error', 'consistent-as-needed'],
'comma-dangle': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-extra-semi': 'error',
'no-unused-vars': ['error', {
args: 'after-used',
argsIgnorePattern: '^__unused',
caughtErrorsIgnorePattern: '^__unused',
destructuredArrayIgnorePattern: '^__unused',
varsIgnorePattern: '^__unused',
ignoreRestSiblings: true
}],
'semi': ['error', 'always']
};
const typescriptRules = {
...javascriptRules,
'no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'after-used',
argsIgnorePattern: '^__unused',
caughtErrorsIgnorePattern: '^__unused',
destructuredArrayIgnorePattern: '^__unused',
varsIgnorePattern: '^__unused',
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/no-misused-promises': 'error'
};
module.exports = {
root: true,
env: { es6: true },
parserOptions: {
ecmaVersion: 2022,
tsconfigRootDir: __dirname,
projectService: true,
allowDefaultProject: true,
warnOnUnsupportedTypeScriptVersion: false,
project: [
'./tsconfig.eslint.json',
'./packages/*-e2e/tsconfig.json',
'./packages/*/tsconfig.lib.json',
'./packages/*/tsconfig.app.json',
'./packages/*/tsconfig.spec.json'
]
},
ignorePatterns: ['**/*', '!**/*.json', '!**/*.js', '!**/*.ts', '!scripts', '!tools', '!.vscode'],
plugins: ['@nx'],
overrides: [
{
files: ['*.ts', '*.tsx', '*.mts'],
extends: ['plugin:@nx/typescript'],
rules: typescriptRules,
parserOptions: {
project: [
'./tsconfig.eslint.json'
]
}
},
{
files: ['*.test.ts', '*.test.tsx', '*.spec.ts', '*.spec.tsx'],
extends: ['plugin:@nx/typescript'],
rules: {
...typescriptRules,
'@typescript-eslint/no-explicit-any': 'warn'
},
parserOptions: {
project: [
'./tsconfig.eslint.json'
]
}
},
{
files: ['*.js', '*.jsx'],
extends: ['plugin:@nx/javascript'],
rules: javascriptRules
},
{
files: ['*.mjs'],
extends: ['plugin:@nx/javascript'],
rules: javascriptRules,
parserOptions: {
sourceType: 'module'
}
},
{
files: ['*.json'],
parser: 'jsonc-eslint-parser',
extends: ['plugin:jsonc/recommended-with-json'],
rules: jsonRules
}
]
};