@jeroenpol/eslint-config 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/index.js +244 -10
- package/package.json +7 -14
- package/configuration/best-practices.js +0 -117
- package/configuration/code-style.js +0 -162
- package/configuration/imports.js +0 -32
package/README.md
CHANGED
|
@@ -6,12 +6,33 @@ Use this esLint config as a basis for you Angular projects.
|
|
|
6
6
|
|
|
7
7
|
### Installation
|
|
8
8
|
|
|
9
|
+
1. Install the npm package
|
|
10
|
+
|
|
9
11
|
```sh
|
|
10
12
|
npm i --save-dev @jeroenpol/eslint-config
|
|
11
|
-
```
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
2. Install peer dependencies using NPM 5+ and this command:
|
|
14
16
|
|
|
15
17
|
```sh
|
|
16
18
|
npx install-peerdeps --dev @jeroenpol/eslint-config
|
|
17
19
|
```
|
|
20
|
+
|
|
21
|
+
3. Update your `.eslintrc` file to:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"root": true,
|
|
26
|
+
"parser": "@typescript-eslint/parser",
|
|
27
|
+
"parserOptions": {
|
|
28
|
+
"ecmaVersion": 2020,
|
|
29
|
+
"sourceType": "module"
|
|
30
|
+
},
|
|
31
|
+
"overrides": [
|
|
32
|
+
{
|
|
33
|
+
"files": ["*.ts", "*.tsx"],
|
|
34
|
+
"extends": ["@jeroenpol/eslint-config"]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
```
|
package/index.js
CHANGED
|
@@ -1,13 +1,247 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'
|
|
5
|
-
'./configuration/imports.js',
|
|
6
|
-
].map(require.resolve),
|
|
7
|
-
parser: "@typescript-eslint/parser",
|
|
8
|
-
parserOptions: {
|
|
9
|
-
ecmaVersion: 2020,
|
|
10
|
-
sourceType: 'module',
|
|
2
|
+
plugins: ['@typescript-eslint'],
|
|
3
|
+
rules: {
|
|
4
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
11
5
|
},
|
|
12
|
-
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['*.ts', '*.tsx'],
|
|
9
|
+
parser: '@typescript-eslint/parser',
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 2020,
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
// tsconfigRootDir: __dirname,
|
|
14
|
+
project: ['tsconfig.json'],
|
|
15
|
+
},
|
|
16
|
+
plugins: [
|
|
17
|
+
'@stylistic',
|
|
18
|
+
'rxjs-angular',
|
|
19
|
+
'sonarjs',
|
|
20
|
+
'simple-import-sort',
|
|
21
|
+
'unused-imports',
|
|
22
|
+
],
|
|
23
|
+
rules: {
|
|
24
|
+
// GENERAL
|
|
25
|
+
'no-unreachable': 'error',
|
|
26
|
+
'no-debugger': 'error',
|
|
27
|
+
'no-console': 'error',
|
|
28
|
+
'no-empty': 'error', // explain
|
|
29
|
+
'unicode-bom': 'warn',
|
|
30
|
+
|
|
31
|
+
// NAMING CONVENTIONS
|
|
32
|
+
'@typescript-eslint/naming-convention': [
|
|
33
|
+
'warn',
|
|
34
|
+
{
|
|
35
|
+
selector: 'enum',
|
|
36
|
+
format: ['PascalCase', 'UPPER_CASE'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
selector: 'interface',
|
|
40
|
+
format: ['PascalCase'],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
// STYLISTIC
|
|
45
|
+
'@stylistic/quote-props': ['warn', 'as-needed'],
|
|
46
|
+
'@stylistic/array-bracket-newline': ['warn', 'consistent'],
|
|
47
|
+
'@stylistic/array-bracket-spacing': ['warn', 'never'],
|
|
48
|
+
'@stylistic/array-element-newline': ['warn', 'consistent'],
|
|
49
|
+
'@stylistic/arrow-parens': 'warn',
|
|
50
|
+
'@stylistic/arrow-spacing': 'warn',
|
|
51
|
+
'@stylistic/block-spacing': 'warn',
|
|
52
|
+
'@stylistic/brace-style': 'warn',
|
|
53
|
+
'@stylistic/comma-dangle': [
|
|
54
|
+
'warn',
|
|
55
|
+
{
|
|
56
|
+
arrays: 'always-multiline',
|
|
57
|
+
objects: 'always-multiline',
|
|
58
|
+
imports: 'always-multiline',
|
|
59
|
+
exports: 'never',
|
|
60
|
+
functions: 'never',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
'@stylistic/comma-spacing': 'warn',
|
|
64
|
+
'@stylistic/computed-property-spacing': 'warn',
|
|
65
|
+
'@stylistic/dot-location': ['warn', 'object'],
|
|
66
|
+
'@stylistic/eol-last': 'warn',
|
|
67
|
+
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
68
|
+
'@stylistic/function-call-argument-newline': ['warn', 'consistent'],
|
|
69
|
+
'@stylistic/function-paren-newline': ['warn', 'multiline-arguments'],
|
|
70
|
+
'@stylistic/generator-star-spacing': ['error', 'after'],
|
|
71
|
+
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
|
|
72
|
+
'@stylistic/indent': [
|
|
73
|
+
'warn',
|
|
74
|
+
2,
|
|
75
|
+
{
|
|
76
|
+
SwitchCase: 1,
|
|
77
|
+
ObjectExpression: 1,
|
|
78
|
+
offsetTernaryExpressions: true,
|
|
79
|
+
ImportDeclaration: 'first',
|
|
80
|
+
FunctionDeclaration: { parameters: 'first', body: 1 },
|
|
81
|
+
CallExpression: { arguments: 'first' },
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
'@stylistic/key-spacing': ['warn'],
|
|
85
|
+
'@stylistic/keyword-spacing': ['warn', { after: true, before: true }],
|
|
86
|
+
'@stylistic/max-len': [
|
|
87
|
+
'error',
|
|
88
|
+
{
|
|
89
|
+
code: 120, // TO DISCUSS
|
|
90
|
+
ignoreRegExpLiterals: true,
|
|
91
|
+
ignoreStrings: true,
|
|
92
|
+
ignoreTemplateLiterals: true,
|
|
93
|
+
ignoreUrls: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
'@stylistic/member-delimiter-style': ['warn'],
|
|
97
|
+
'@stylistic/multiline-ternary': ['warn', 'always'], // TO DISCUSS
|
|
98
|
+
'@stylistic/new-parens': 'warn',
|
|
99
|
+
'@stylistic/no-confusing-arrow': 'warn',
|
|
100
|
+
'@stylistic/no-extra-semi': 'warn',
|
|
101
|
+
'@stylistic/no-mixed-operators': 'error',
|
|
102
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'warn',
|
|
103
|
+
'@stylistic/no-multi-spaces': 'warn',
|
|
104
|
+
'@stylistic/no-multiple-empty-lines': ['warn', { max: 1 }],
|
|
105
|
+
'@stylistic/no-tabs': 'error',
|
|
106
|
+
'@stylistic/no-trailing-spaces': 'warn',
|
|
107
|
+
'@stylistic/no-whitespace-before-property': 'warn',
|
|
108
|
+
'@stylistic/nonblock-statement-body-position': 'warn',
|
|
109
|
+
'@stylistic/object-curly-newline': ['error', { 'consistent': true }],
|
|
110
|
+
'@stylistic/object-curly-spacing': ['warn', 'always'],
|
|
111
|
+
'@stylistic/object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
|
|
112
|
+
'@stylistic/one-var-declaration-per-line': 'warn',
|
|
113
|
+
'@stylistic/operator-linebreak': ['warn', 'after', { overrides: { '?': 'before', ':': 'before' } }], // TO DISCUSS
|
|
114
|
+
'@stylistic/padded-blocks': ['warn', { blocks: 'never', switches: 'never' }],
|
|
115
|
+
'@stylistic/quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
|
116
|
+
'@stylistic/rest-spread-spacing': ['warn', 'never'],
|
|
117
|
+
'@stylistic/semi': ['warn', 'always'],
|
|
118
|
+
'@stylistic/semi-spacing': 'warn',
|
|
119
|
+
'@stylistic/semi-style': 'warn',
|
|
120
|
+
'@stylistic/wrap-iife': 'warn',
|
|
121
|
+
'@stylistic/space-before-blocks': 'warn',
|
|
122
|
+
'@stylistic/space-before-function-paren': ['warn', { anonymous: 'always', named: 'never', asyncArrow: 'always' }],
|
|
123
|
+
'@stylistic/space-in-parens': ['warn', 'never'],
|
|
124
|
+
'@stylistic/space-infix-ops': 'warn',
|
|
125
|
+
'@stylistic/space-unary-ops': 'warn',
|
|
126
|
+
'@stylistic/switch-colon-spacing': 'warn',
|
|
127
|
+
'@stylistic/template-curly-spacing': ['warn', 'never'],
|
|
128
|
+
'curly': ['error', 'all'],
|
|
129
|
+
'no-unexpected-multiline': 'error',
|
|
130
|
+
|
|
131
|
+
// CODE COMPLEXITY
|
|
132
|
+
'max-depth': ['error', 8],
|
|
133
|
+
'max-nested-callbacks': ['error', 8],
|
|
134
|
+
'max-statements-per-line': ['error', { 'max': 1 }],
|
|
135
|
+
'complexity': ['error', { max: 15 }],
|
|
136
|
+
'sonarjs/cognitive-complexity': ['error', 15],
|
|
137
|
+
|
|
138
|
+
// CLASSES
|
|
139
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
140
|
+
'simple-import-sort/imports': 'error',
|
|
141
|
+
'simple-import-sort/exports': 'error',
|
|
142
|
+
'unused-imports/no-unused-imports': 'error',
|
|
143
|
+
'no-duplicate-imports': 'error',
|
|
144
|
+
'no-useless-constructor': 'off', // duplicate of @typescript-eslint/no-useless-constructor
|
|
145
|
+
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
146
|
+
'@typescript-eslint/member-ordering': 'warn',
|
|
147
|
+
'@typescript-eslint/explicit-member-accessibility': [
|
|
148
|
+
'error',
|
|
149
|
+
{
|
|
150
|
+
accessibility: 'off',
|
|
151
|
+
overrides: {
|
|
152
|
+
accessors: 'explicit',
|
|
153
|
+
constructors: 'no-public',
|
|
154
|
+
methods: 'explicit',
|
|
155
|
+
properties: 'explicit',
|
|
156
|
+
parameterProperties: 'explicit',
|
|
157
|
+
},
|
|
158
|
+
ignoredMethodNames: [
|
|
159
|
+
'ngOnChanges',
|
|
160
|
+
'ngOnInit',
|
|
161
|
+
'ngDoCheck',
|
|
162
|
+
'ngAfterContentInit',
|
|
163
|
+
'ngAfterContentChecked',
|
|
164
|
+
'ngAfterViewInit',
|
|
165
|
+
'ngAfterViewChecked',
|
|
166
|
+
'ngOnDestroy',
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
|
|
171
|
+
// FUNCTIONS
|
|
172
|
+
'@typescript-eslint/explicit-function-return-type': ['error', { allowHigherOrderFunctions: true }],
|
|
173
|
+
'max-lines-per-function': ['error', { 'max': 60, 'skipBlankLines': true, 'skipComments': true }],
|
|
174
|
+
'max-statements': ['error', 20], // can be lowered
|
|
175
|
+
'no-param-reassign': 'error',
|
|
176
|
+
'sonarjs/no-extra-arguments': 'error',
|
|
177
|
+
'prefer-arrow-callback': 'warn',
|
|
178
|
+
|
|
179
|
+
// VARIABLES
|
|
180
|
+
"unused-imports/no-unused-vars": [
|
|
181
|
+
"error",
|
|
182
|
+
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
|
|
183
|
+
],
|
|
184
|
+
'no-shadow': 'error', // explain
|
|
185
|
+
'no-multi-assign': 'error',
|
|
186
|
+
'prefer-const': 'error',
|
|
187
|
+
'no-unused-expressions': 'error',
|
|
188
|
+
'sonarjs/non-existent-operator': 'error',
|
|
189
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
190
|
+
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
191
|
+
'@typescript-eslint/no-inferrable-types': 'error', // explain
|
|
192
|
+
'@typescript-eslint/ban-types': [
|
|
193
|
+
'error',
|
|
194
|
+
{
|
|
195
|
+
extendDefaults: false,
|
|
196
|
+
types: {
|
|
197
|
+
Boolean: {
|
|
198
|
+
message: 'Use boolean instead',
|
|
199
|
+
fixWith: 'boolean',
|
|
200
|
+
},
|
|
201
|
+
Number: {
|
|
202
|
+
message: 'Use number instead',
|
|
203
|
+
fixWith: 'number',
|
|
204
|
+
},
|
|
205
|
+
String: {
|
|
206
|
+
message: 'Use string instead',
|
|
207
|
+
fixWith: 'string',
|
|
208
|
+
},
|
|
209
|
+
Symbol: {
|
|
210
|
+
message: 'Use symbol instead',
|
|
211
|
+
fixWith: 'symbol',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
'@typescript-eslint/prefer-optional-chain': 'warn', // explain
|
|
217
|
+
|
|
218
|
+
// ARRAYS
|
|
219
|
+
'array-callback-return': 'error', // explain
|
|
220
|
+
'@typescript-eslint/array-type': 'error',
|
|
221
|
+
'no-array-constructor': 'error',
|
|
222
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
223
|
+
|
|
224
|
+
// SWITCH STATEMENTS
|
|
225
|
+
'sonarjs/max-switch-cases': ['error', 10],
|
|
226
|
+
'sonarjs/no-nested-switch': 'error',
|
|
227
|
+
'default-case': 'error',
|
|
228
|
+
'no-fallthrough': 'error',
|
|
229
|
+
|
|
230
|
+
// COMPARISON
|
|
231
|
+
'sonarjs/no-inverted-boolean-check': 'error',
|
|
232
|
+
'eqeqeq': 'error',
|
|
233
|
+
|
|
234
|
+
// RxJS
|
|
235
|
+
'rxjs-angular/prefer-takeuntil': [
|
|
236
|
+
'error',
|
|
237
|
+
{
|
|
238
|
+
'alias': ['untilDestroyed'],
|
|
239
|
+
'checkComplete': true,
|
|
240
|
+
'checkDecorators': ['Component'],
|
|
241
|
+
'checkDestroy': true
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
],
|
|
13
247
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeroenpol/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "ES Lint config made for Angular, configured by Polware",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.js",
|
|
8
|
-
"./configuration/best-practices": "./configuration/best-practices.js",
|
|
9
|
-
"./configuration/code-style": "./configuration/code-style.js",
|
|
10
|
-
"./configuration/imports": "./configuration/imports.js",
|
|
11
8
|
"./package.json": "./package.json"
|
|
12
9
|
},
|
|
13
10
|
"scripts": {},
|
|
@@ -38,30 +35,26 @@
|
|
|
38
35
|
},
|
|
39
36
|
"homepage": "https://github.com/jeroenpol/eslint-config",
|
|
40
37
|
"devDependencies": {
|
|
38
|
+
"@stylistic/eslint-plugin": "^2.8.0",
|
|
39
|
+
"@stylistic/eslint-plugin-ts": "^2.8.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "6.19.0",
|
|
41
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
41
42
|
"eslint": "8.57.0",
|
|
42
|
-
"eslint-config-prettier": "9.1.0",
|
|
43
|
-
"eslint-plugin-functional": "6.5.1",
|
|
44
|
-
"eslint-plugin-redundant-undefined": "^1.0.0",
|
|
45
43
|
"eslint-plugin-rxjs-angular": "2.0.1",
|
|
46
44
|
"eslint-plugin-simple-import-sort": "10.0.0",
|
|
47
45
|
"eslint-plugin-sonarjs": "1.0.3",
|
|
48
46
|
"eslint-plugin-unused-imports": "3.2.0",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "6.19.0",
|
|
50
|
-
"@typescript-eslint/parser": "^6.19.0",
|
|
51
47
|
"typescript": "~5.4.5",
|
|
52
48
|
"typescript-eslint": "^7.16.1"
|
|
53
49
|
},
|
|
54
50
|
"peerDependencies": {
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "6.19.0",
|
|
52
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
55
53
|
"eslint": "8.57.0",
|
|
56
|
-
"eslint-config-prettier": "9.1.0",
|
|
57
|
-
"eslint-plugin-functional": "6.5.1",
|
|
58
|
-
"eslint-plugin-redundant-undefined": "^1.0.0",
|
|
59
54
|
"eslint-plugin-rxjs-angular": "2.0.1",
|
|
60
55
|
"eslint-plugin-simple-import-sort": "10.0.0",
|
|
61
56
|
"eslint-plugin-sonarjs": "1.0.3",
|
|
62
57
|
"eslint-plugin-unused-imports": "3.2.0",
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "6.19.0",
|
|
64
|
-
"@typescript-eslint/parser": "^6.19.0",
|
|
65
58
|
"typescript": "^5.0.0",
|
|
66
59
|
"typescript-eslint": "^7.16.1"
|
|
67
60
|
},
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
overrides: [
|
|
3
|
-
{
|
|
4
|
-
files: ['*.ts', '*.tsx'],
|
|
5
|
-
parser: '@typescript-eslint/parser',
|
|
6
|
-
parserOptions: {
|
|
7
|
-
ecmaVersion: 2020,
|
|
8
|
-
sourceType: 'module',
|
|
9
|
-
},
|
|
10
|
-
plugins: ['@typescript-eslint', 'rxjs-angular', 'sonarjs'],
|
|
11
|
-
rules: {
|
|
12
|
-
// Code complexity rules
|
|
13
|
-
'max-depth': ['error', 8], // Goal value: 2
|
|
14
|
-
'max-nested-callbacks': ['error', 8], // Goal value: 2-3
|
|
15
|
-
"max-statements-per-line": ['error', { "max": 1 }],
|
|
16
|
-
'complexity': ['error', { max: 15 }], // GOAL VALUE: 7
|
|
17
|
-
'sonarjs/cognitive-complexity': ['error', 15], // GOAL VALUE: 6
|
|
18
|
-
|
|
19
|
-
// Prevent code smells
|
|
20
|
-
'max-lines-per-function': ['error', { 'max': 60, 'skipBlankLines': true, 'skipComments': true }], // Goal value: 40
|
|
21
|
-
'max-statements': ['error', 20], // Goal value: 16-18?
|
|
22
|
-
'sonarjs/max-switch-cases': ['error', 10],
|
|
23
|
-
'sonarjs/no-nested-switch': 'error',
|
|
24
|
-
|
|
25
|
-
// Prevent accidental bugs
|
|
26
|
-
'no-param-reassign': 'error',
|
|
27
|
-
'no-unreachable': 'error',
|
|
28
|
-
'no-multi-assign': 'error',
|
|
29
|
-
'array-callback-return': 'error',
|
|
30
|
-
'sonarjs/no-extra-arguments': 'error',
|
|
31
|
-
'sonarjs/non-existent-operator': 'error',
|
|
32
|
-
'sonarjs/no-inverted-boolean-check': 'error',
|
|
33
|
-
'eqeqeq': 'error',
|
|
34
|
-
'default-case': 'error',
|
|
35
|
-
'no-fallthrough': 'error',
|
|
36
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
37
|
-
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
38
|
-
|
|
39
|
-
// Type safety
|
|
40
|
-
'@typescript-eslint/no-explicit-any': 'warn', // TODO: set to error
|
|
41
|
-
'@typescript-eslint/explicit-function-return-type': ['error', { allowHigherOrderFunctions: true }],
|
|
42
|
-
|
|
43
|
-
// Disable JS features
|
|
44
|
-
'no-debugger': 'error',
|
|
45
|
-
'no-console': 'error',
|
|
46
|
-
|
|
47
|
-
// Disabled ESLint rules
|
|
48
|
-
'@typescript-eslint/array-type': 'off',
|
|
49
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
50
|
-
'max-classes-per-file': 'off',
|
|
51
|
-
'@typescript-eslint/no-inferrable-types': 'off',
|
|
52
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
53
|
-
'sort-keys': 'off',
|
|
54
|
-
'no-empty': 'off',
|
|
55
|
-
'no-shadow': 'off',
|
|
56
|
-
|
|
57
|
-
// Conventions
|
|
58
|
-
'no-array-constructor': 'error',
|
|
59
|
-
'quote-props': ['warn', 'as-needed'],
|
|
60
|
-
'@typescript-eslint/ban-types': [
|
|
61
|
-
'error',
|
|
62
|
-
{
|
|
63
|
-
extendDefaults: false,
|
|
64
|
-
types: {
|
|
65
|
-
Boolean: {
|
|
66
|
-
message: 'Use boolean instead',
|
|
67
|
-
fixWith: 'boolean',
|
|
68
|
-
},
|
|
69
|
-
Number: {
|
|
70
|
-
message: 'Use number instead',
|
|
71
|
-
fixWith: 'number',
|
|
72
|
-
},
|
|
73
|
-
String: {
|
|
74
|
-
message: 'Use string instead',
|
|
75
|
-
fixWith: 'string',
|
|
76
|
-
},
|
|
77
|
-
Symbol: {
|
|
78
|
-
message: 'Use symbol instead',
|
|
79
|
-
fixWith: 'symbol',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/naming-convention': [
|
|
85
|
-
'warn',
|
|
86
|
-
{
|
|
87
|
-
selector: 'enum',
|
|
88
|
-
format: ['PascalCase', 'UPPER_CASE'],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
selector: 'interface',
|
|
92
|
-
format: ['PascalCase'],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
'no-restricted-syntax': [
|
|
96
|
-
'error',
|
|
97
|
-
{
|
|
98
|
-
selector:
|
|
99
|
-
"CallExpression[callee.object.name='console'][callee.property.name=/^(debug|info|time|timeEnd|trace)$/]",
|
|
100
|
-
message: 'Unexpected property on console object was called',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
// Performance improvements + preventing memory leaks
|
|
105
|
-
"rxjs-angular/prefer-takeuntil": [
|
|
106
|
-
"error",
|
|
107
|
-
{
|
|
108
|
-
"alias": ["untilDestroyed"],
|
|
109
|
-
"checkComplete": true,
|
|
110
|
-
"checkDecorators": ["Component"],
|
|
111
|
-
"checkDestroy": true
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
4
|
-
},
|
|
5
|
-
overrides: [
|
|
6
|
-
{
|
|
7
|
-
files: ['*.ts', '*.tsx'],
|
|
8
|
-
parser: '@typescript-eslint/parser',
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2020,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
project: './tsconfig.json',
|
|
13
|
-
},
|
|
14
|
-
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports'],
|
|
15
|
-
rules: {
|
|
16
|
-
'array-bracket-newline': ['warn', 'consistent'],
|
|
17
|
-
'array-bracket-spacing': ['warn', 'never'],
|
|
18
|
-
'array-element-newline': ['warn', 'consistent'],
|
|
19
|
-
'arrow-parens': 'warn', // overwritten NG default
|
|
20
|
-
'arrow-spacing': 'warn',
|
|
21
|
-
'block-spacing': 'warn',
|
|
22
|
-
'brace-style': 'warn',
|
|
23
|
-
'comma-dangle': [
|
|
24
|
-
'warn',
|
|
25
|
-
{
|
|
26
|
-
arrays: 'always-multiline',
|
|
27
|
-
objects: 'always-multiline',
|
|
28
|
-
imports: 'always-multiline',
|
|
29
|
-
exports: 'never',
|
|
30
|
-
functions: 'never',
|
|
31
|
-
},
|
|
32
|
-
], // overwritten NG default
|
|
33
|
-
'comma-spacing': 'warn',
|
|
34
|
-
'computed-property-spacing': 'warn',
|
|
35
|
-
curly: ['warn', 'all'],
|
|
36
|
-
'dot-location': ['warn', 'property'],
|
|
37
|
-
'eol-last': 'warn',
|
|
38
|
-
'func-call-spacing': 'warn',
|
|
39
|
-
'function-call-argument-newline': ['warn', 'consistent'],
|
|
40
|
-
'function-paren-newline': ['warn', 'multiline-arguments'],
|
|
41
|
-
'generator-star-spacing': 'off',
|
|
42
|
-
'implicit-arrow-linebreak': 'off',
|
|
43
|
-
indent: 'off',
|
|
44
|
-
'@typescript-eslint/indent': [
|
|
45
|
-
'warn',
|
|
46
|
-
2,
|
|
47
|
-
{
|
|
48
|
-
SwitchCase: 1,
|
|
49
|
-
ObjectExpression: 1,
|
|
50
|
-
offsetTernaryExpressions: true,
|
|
51
|
-
ImportDeclaration: 'first',
|
|
52
|
-
FunctionDeclaration: { parameters: 'first', body: 1 },
|
|
53
|
-
CallExpression: { arguments: 'first' },
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
'key-spacing': ['warn'],
|
|
57
|
-
|
|
58
|
-
'keyword-spacing': 'off', // overridden by @typescript-eslint
|
|
59
|
-
'@typescript-eslint/keyword-spacing': ['warn', { after: true, before: true }],
|
|
60
|
-
|
|
61
|
-
'linebreak-style': 'off',
|
|
62
|
-
'max-len': [
|
|
63
|
-
'error',
|
|
64
|
-
{
|
|
65
|
-
code: 160,
|
|
66
|
-
ignoreRegExpLiterals: true,
|
|
67
|
-
ignoreStrings: true,
|
|
68
|
-
ignoreTemplateLiterals: true,
|
|
69
|
-
ignoreUrls: true,
|
|
70
|
-
},
|
|
71
|
-
], // overwritten NG default
|
|
72
|
-
'@typescript-eslint/member-delimiter-style': ['warn'],
|
|
73
|
-
'multiline-ternary': ['warn', 'always'],
|
|
74
|
-
'new-parens': 'warn',
|
|
75
|
-
'newline-per-chained-call': 'off',
|
|
76
|
-
'no-confusing-arrow': ['error'],
|
|
77
|
-
'no-constant-condition': 'off',
|
|
78
|
-
'no-extra-parens': 'off', // prettier is actually very liberate with parens, so disabled the rule
|
|
79
|
-
'no-extra-semi': 'warn',
|
|
80
|
-
'no-floating-decimal': 'off',
|
|
81
|
-
'no-mixed-operators': ['error'],
|
|
82
|
-
'no-mixed-spaces-and-tabs': 'error',
|
|
83
|
-
'no-multi-spaces': 'error',
|
|
84
|
-
'no-multiple-empty-lines': ['warn', { max: 1 }], // overwritten NG default
|
|
85
|
-
'no-tabs': 'error',
|
|
86
|
-
'no-trailing-spaces': 'warn',
|
|
87
|
-
'no-unexpected-multiline': 'error',
|
|
88
|
-
|
|
89
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
90
|
-
"unused-imports/no-unused-imports": "error",
|
|
91
|
-
"unused-imports/no-unused-vars": [
|
|
92
|
-
"warn",
|
|
93
|
-
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
|
|
94
|
-
],
|
|
95
|
-
'no-duplicate-imports': 'warn',
|
|
96
|
-
|
|
97
|
-
'no-useless-constructor': 'off', // overridden by @typescript-eslint
|
|
98
|
-
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
99
|
-
|
|
100
|
-
'no-whitespace-before-property': 'warn',
|
|
101
|
-
'nonblock-statement-body-position': 'warn',
|
|
102
|
-
'object-curly-newline': ['error', { consistent: true }],
|
|
103
|
-
'object-curly-spacing': ['warn', 'always'],
|
|
104
|
-
'object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
|
|
105
|
-
'one-var-declaration-per-line': 'warn',
|
|
106
|
-
'operator-linebreak': ['warn', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
107
|
-
'padded-blocks': ['warn', { blocks: 'never', switches: 'never' }],
|
|
108
|
-
'prefer-arrow-callback': 'warn',
|
|
109
|
-
|
|
110
|
-
'prefer-includes': 'off', // overruled by @typescript-eslint
|
|
111
|
-
'@typescript-eslint/prefer-includes': 'warn',
|
|
112
|
-
|
|
113
|
-
'prefer-optional-chain': 'off', // overruled by @typescript-eslint
|
|
114
|
-
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
115
|
-
|
|
116
|
-
quotes: ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }], // overwritten NG default
|
|
117
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
118
|
-
semi: ['warn', 'always'],
|
|
119
|
-
'semi-spacing': 'error',
|
|
120
|
-
'semi-style': 'warn',
|
|
121
|
-
'space-before-blocks': 'warn',
|
|
122
|
-
'space-before-function-paren': ['warn', { anonymous: 'always', named: 'never', asyncArrow: 'always' }],
|
|
123
|
-
'space-in-parens': 'warn',
|
|
124
|
-
'space-infix-ops': 'warn',
|
|
125
|
-
'space-unary-ops': 'warn',
|
|
126
|
-
'switch-colon-spacing': 'warn',
|
|
127
|
-
'template-curly-spacing': 'warn',
|
|
128
|
-
'unicode-bom': 'warn',
|
|
129
|
-
'wrap-iife': 'warn',
|
|
130
|
-
'wrap-regex': 'off',
|
|
131
|
-
'yield-star-spacing': 'error',
|
|
132
|
-
'no-unused-expressions': 'error',
|
|
133
|
-
'prefer-const': 'error',
|
|
134
|
-
'@typescript-eslint/no-parameter-properties': 'off',
|
|
135
|
-
'@typescript-eslint/member-ordering': ['warn'],
|
|
136
|
-
'@typescript-eslint/explicit-member-accessibility': [
|
|
137
|
-
'error',
|
|
138
|
-
{
|
|
139
|
-
accessibility: 'off',
|
|
140
|
-
overrides: {
|
|
141
|
-
accessors: 'explicit',
|
|
142
|
-
constructors: 'no-public',
|
|
143
|
-
methods: 'explicit',
|
|
144
|
-
properties: 'explicit',
|
|
145
|
-
parameterProperties: 'explicit',
|
|
146
|
-
},
|
|
147
|
-
ignoredMethodNames: [
|
|
148
|
-
'ngOnChanges',
|
|
149
|
-
'ngOnInit',
|
|
150
|
-
'ngDoCheck',
|
|
151
|
-
'ngAfterContentInit',
|
|
152
|
-
'ngAfterContentChecked',
|
|
153
|
-
'ngAfterViewInit',
|
|
154
|
-
'ngAfterViewChecked',
|
|
155
|
-
'ngOnDestroy',
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
};
|
package/configuration/imports.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
overrides: [
|
|
3
|
-
{
|
|
4
|
-
files: ['*.ts'],
|
|
5
|
-
parser: '@typescript-eslint/parser',
|
|
6
|
-
parserOptions: {
|
|
7
|
-
ecmaVersion: 2020,
|
|
8
|
-
sourceType: 'module',
|
|
9
|
-
project: './tsconfig.json',
|
|
10
|
-
},
|
|
11
|
-
plugins: ['@typescript-eslint', 'simple-import-sort'],
|
|
12
|
-
rules: {
|
|
13
|
-
/* https://github.com/lydell/eslint-plugin-simple-import-sort#usage */
|
|
14
|
-
'simple-import-sort/imports': 'error',
|
|
15
|
-
'simple-import-sort/exports': 'error',
|
|
16
|
-
'sort-imports': 'off',
|
|
17
|
-
'import/order': 'off',
|
|
18
|
-
'no-restricted-imports': [
|
|
19
|
-
'error',
|
|
20
|
-
{
|
|
21
|
-
paths: [
|
|
22
|
-
{
|
|
23
|
-
name: 'rxjs/Rx',
|
|
24
|
-
message: "Please import directly from 'rxjs' instead",
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|