@jeroenpol/eslint-config 2.0.2 → 2.1.2
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/CHANGELOG.md +10 -0
- package/README.md +57 -6
- package/configurations/best-practices-html.mjs +19 -0
- package/configurations/best-practices-ts.mjs +237 -0
- package/configurations/{stylistic.mjs → code-style.mjs} +5 -4
- package/eslint.config.mjs +1 -1
- package/index.mjs +23 -7
- package/package.json +16 -21
- package/tsconfig.json +4 -1
- package/configurations/best-practices.mjs +0 -150
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2.1.1 / 2026-02-23
|
|
2
|
+
==================
|
|
3
|
+
- [minor] Add local smoke test (`npm run lint:smoke`) for package-consumer verification
|
|
4
|
+
|
|
5
|
+
2.1.0 / 2026-02-23
|
|
6
|
+
==================
|
|
7
|
+
- [minor] Make config easier to consume as a shareable flat config package
|
|
8
|
+
- [minor] Export `best-practices` and `stylistic` subpath entrypoints
|
|
9
|
+
- [minor] Improve README with current ESLint flat-config usage examples
|
|
10
|
+
|
|
1
11
|
2.0.1 / 2025-03-03
|
|
2
12
|
==================
|
|
3
13
|
- [minor] Only lint files in /src
|
package/README.md
CHANGED
|
@@ -1,11 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @jeroenpol/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shareable ESLint flat config for TypeScript/JavaScript projects.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ESLint standard this package follows
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Uses the ESLint flat config format (`eslint.config.*`).
|
|
8
|
+
- Designed as a shareable config package imported into your project config.
|
|
9
|
+
- Keeps `eslint` as `peerDependencies`.
|
|
10
|
+
- Ships required plugins as package `dependencies` for easier consumer setup.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Install
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
```bash
|
|
15
|
+
npm i -D eslint typescript @jeroenpol/eslint-config
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Use in another project
|
|
19
|
+
|
|
20
|
+
Create `eslint.config.mjs` in your project root:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import config from '@jeroenpol/eslint-config';
|
|
24
|
+
|
|
25
|
+
export default config;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Override rules in your project
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import config from '@jeroenpol/eslint-config';
|
|
32
|
+
|
|
33
|
+
export default [
|
|
34
|
+
...config,
|
|
35
|
+
{
|
|
36
|
+
files: ['**/*.ts'],
|
|
37
|
+
rules: {
|
|
38
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Use only part of the config
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import bestPractices from '@jeroenpol/eslint-config/best-practices';
|
|
48
|
+
import stylistic from '@jeroenpol/eslint-config/stylistic';
|
|
49
|
+
|
|
50
|
+
export default [
|
|
51
|
+
...bestPractices,
|
|
52
|
+
...stylistic,
|
|
53
|
+
];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Validate locally (smoke test)
|
|
57
|
+
|
|
58
|
+
Run this in this repository to verify the config can be consumed through its package export:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm run lint:smoke
|
|
62
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import nx from '@nx/eslint-plugin';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...nx.configs['flat/angular'],
|
|
5
|
+
...nx.configs['flat/angular-template'],
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.html'],
|
|
8
|
+
rules: {
|
|
9
|
+
'@angular-eslint/template/button-has-type': 'error',
|
|
10
|
+
'@angular-eslint/template/no-duplicate-attributes': ['error', { allowStylePrecedenceDuplicates: true }],
|
|
11
|
+
'@angular-eslint/template/no-empty-control-flow': 'error',
|
|
12
|
+
'@angular-eslint/template/no-interpolation-in-attributes': 'error',
|
|
13
|
+
'@angular-eslint/template/prefer-self-closing-tags': 'error',
|
|
14
|
+
'@angular-eslint/template/prefer-template-literal': 'error',
|
|
15
|
+
'@angular-eslint/template/prefer-static-string-properties': ['error'],
|
|
16
|
+
'@angular-eslint/template/label-has-associated-control': 'off',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import importPlugin from 'eslint-plugin-import';
|
|
2
|
+
import eslintPluginJasmine from 'eslint-plugin-jasmine';
|
|
3
|
+
import eslintPluginNoOnlyTests from 'eslint-plugin-no-only-tests';
|
|
4
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
5
|
+
import sonarjs from 'eslint-plugin-sonarjs';
|
|
6
|
+
import unusedImports from 'eslint-plugin-unused-imports';
|
|
7
|
+
import tseslint from 'typescript-eslint';
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
{
|
|
11
|
+
plugins: {
|
|
12
|
+
'import': importPlugin,
|
|
13
|
+
'jasmine': eslintPluginJasmine,
|
|
14
|
+
'no-only-tests': eslintPluginNoOnlyTests,
|
|
15
|
+
'simple-import-sort': simpleImportSort,
|
|
16
|
+
'sonarjs': sonarjs,
|
|
17
|
+
'@typescript-eslint': tseslint.plugin,
|
|
18
|
+
'unused-imports': unusedImports,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.ts'],
|
|
23
|
+
rules: {
|
|
24
|
+
// GENERAL
|
|
25
|
+
'no-unreachable': 'error',
|
|
26
|
+
'no-debugger': 'error',
|
|
27
|
+
'no-console': 'error',
|
|
28
|
+
'no-empty': 'error',
|
|
29
|
+
'unicode-bom': 'warn',
|
|
30
|
+
'object-shorthand': ['warn', 'consistent-as-needed'],
|
|
31
|
+
|
|
32
|
+
// NAMING CONVENTIONS
|
|
33
|
+
'@typescript-eslint/naming-convention': [
|
|
34
|
+
'warn',
|
|
35
|
+
{
|
|
36
|
+
selector: 'enum',
|
|
37
|
+
format: ['PascalCase'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
selector: 'enumMember',
|
|
41
|
+
format: ['UPPER_CASE'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
selector: 'interface',
|
|
45
|
+
format: ['PascalCase'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
// ORDERING
|
|
50
|
+
'@typescript-eslint/member-ordering': [
|
|
51
|
+
'error',
|
|
52
|
+
{
|
|
53
|
+
default: {
|
|
54
|
+
memberTypes: [
|
|
55
|
+
'signature',
|
|
56
|
+
|
|
57
|
+
'private-instance-readonly-field',
|
|
58
|
+
'public-instance-readonly-field',
|
|
59
|
+
'protected-instance-readonly-field',
|
|
60
|
+
'readonly-field',
|
|
61
|
+
|
|
62
|
+
'public-static-field',
|
|
63
|
+
'protected-static-field',
|
|
64
|
+
'private-static-field',
|
|
65
|
+
|
|
66
|
+
'public-decorated-field',
|
|
67
|
+
'protected-decorated-field',
|
|
68
|
+
'private-decorated-field',
|
|
69
|
+
|
|
70
|
+
'public-instance-field',
|
|
71
|
+
'protected-instance-field',
|
|
72
|
+
'private-instance-field',
|
|
73
|
+
|
|
74
|
+
'constructor',
|
|
75
|
+
|
|
76
|
+
'public-static-method',
|
|
77
|
+
'protected-static-method',
|
|
78
|
+
'private-static-method',
|
|
79
|
+
|
|
80
|
+
'public-instance-method',
|
|
81
|
+
'protected-instance-method',
|
|
82
|
+
'private-instance-method',
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// CODE COMPLEXITY
|
|
89
|
+
'max-depth': ['error', 8],
|
|
90
|
+
'max-nested-callbacks': ['error', 8],
|
|
91
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
92
|
+
'sonarjs/cognitive-complexity': ['error', 15],
|
|
93
|
+
|
|
94
|
+
// CLASSES
|
|
95
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
96
|
+
'simple-import-sort/imports': 'error',
|
|
97
|
+
'simple-import-sort/exports': 'error',
|
|
98
|
+
'unused-imports/no-unused-imports': 'error',
|
|
99
|
+
'no-duplicate-imports': 'off', // handled by plugin-import
|
|
100
|
+
'import/no-duplicates': 'error',
|
|
101
|
+
'no-useless-constructor': 'off', // duplicate of @typescript-eslint/no-useless-constructor
|
|
102
|
+
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
103
|
+
'@typescript-eslint/explicit-member-accessibility': [
|
|
104
|
+
'error',
|
|
105
|
+
{
|
|
106
|
+
accessibility: 'off',
|
|
107
|
+
overrides: {
|
|
108
|
+
accessors: 'explicit',
|
|
109
|
+
constructors: 'no-public',
|
|
110
|
+
methods: 'explicit',
|
|
111
|
+
properties: 'explicit',
|
|
112
|
+
parameterProperties: 'explicit',
|
|
113
|
+
},
|
|
114
|
+
ignoredMethodNames: [
|
|
115
|
+
'forRoot',
|
|
116
|
+
'ngxsAfterBootstrap',
|
|
117
|
+
'canActivate',
|
|
118
|
+
'canDeactivate',
|
|
119
|
+
'ngOnInit',
|
|
120
|
+
'ngOnDestroy',
|
|
121
|
+
'ngOnChanges',
|
|
122
|
+
'ngAfterViewChecked',
|
|
123
|
+
'ngAfterViewInit',
|
|
124
|
+
'ngAfterContentChecked',
|
|
125
|
+
'ngAfterContentInit',
|
|
126
|
+
'ngDoCheck',
|
|
127
|
+
'ngrxOnStoreInit',
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
|
|
132
|
+
// FUNCTIONS
|
|
133
|
+
'curly': ['error', 'all'],
|
|
134
|
+
'max-lines-per-function': ['error', { max: 60, skipBlankLines: true, skipComments: true }],
|
|
135
|
+
'max-statements': ['error', 20],
|
|
136
|
+
'no-empty-function': 'off',
|
|
137
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
138
|
+
'no-param-reassign': 'error',
|
|
139
|
+
'no-unexpected-multiline': 'error',
|
|
140
|
+
'prefer-arrow-callback': 'warn',
|
|
141
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
142
|
+
'error',
|
|
143
|
+
{
|
|
144
|
+
allowExpressions: true,
|
|
145
|
+
allowTypedFunctionExpressions: true,
|
|
146
|
+
allowHigherOrderFunctions: true,
|
|
147
|
+
allowDirectConstAssertionInArrowFunctions: true,
|
|
148
|
+
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
'sonarjs/no-extra-arguments': 'error',
|
|
152
|
+
|
|
153
|
+
// VARIABLES
|
|
154
|
+
'unused-imports/no-unused-vars': 'off',
|
|
155
|
+
'@typescript-eslint/no-unused-vars': [
|
|
156
|
+
'error',
|
|
157
|
+
{
|
|
158
|
+
args: 'all',
|
|
159
|
+
argsIgnorePattern: '^_',
|
|
160
|
+
caughtErrors: 'all',
|
|
161
|
+
caughtErrorsIgnorePattern: '^_',
|
|
162
|
+
destructuredArrayIgnorePattern: '^_',
|
|
163
|
+
varsIgnorePattern: '^_',
|
|
164
|
+
ignoreRestSiblings: true,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
'no-shadow': 'error',
|
|
168
|
+
'no-multi-assign': 'error',
|
|
169
|
+
'prefer-const': 'error',
|
|
170
|
+
'no-unused-expressions': 'off', // handled by @typescript-eslint/no-unused-expressions
|
|
171
|
+
'sonarjs/non-existent-operator': 'error',
|
|
172
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
173
|
+
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
174
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
175
|
+
'@typescript-eslint/no-restricted-types': [
|
|
176
|
+
'error',
|
|
177
|
+
{
|
|
178
|
+
types: {
|
|
179
|
+
Boolean: {
|
|
180
|
+
message: 'Use boolean instead',
|
|
181
|
+
fixWith: 'boolean',
|
|
182
|
+
},
|
|
183
|
+
Number: {
|
|
184
|
+
message: 'Use number instead',
|
|
185
|
+
fixWith: 'number',
|
|
186
|
+
},
|
|
187
|
+
String: {
|
|
188
|
+
message: 'Use string instead',
|
|
189
|
+
fixWith: 'string',
|
|
190
|
+
},
|
|
191
|
+
Symbol: {
|
|
192
|
+
message: 'Use symbol instead',
|
|
193
|
+
fixWith: 'symbol',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
199
|
+
|
|
200
|
+
// ARRAYS
|
|
201
|
+
'array-callback-return': 'error',
|
|
202
|
+
'@typescript-eslint/array-type': 'error',
|
|
203
|
+
'no-array-constructor': 'error',
|
|
204
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
205
|
+
|
|
206
|
+
// SWITCH STATEMENTS
|
|
207
|
+
'sonarjs/max-switch-cases': ['error', 10],
|
|
208
|
+
'sonarjs/no-nested-switch': 'error',
|
|
209
|
+
'default-case': 'error',
|
|
210
|
+
'no-fallthrough': 'error',
|
|
211
|
+
|
|
212
|
+
// COMPARISON
|
|
213
|
+
'sonarjs/no-inverted-boolean-check': 'error',
|
|
214
|
+
'eqeqeq': 'error',
|
|
215
|
+
|
|
216
|
+
// ASYNCHRONOUS
|
|
217
|
+
'@typescript-eslint/no-misused-promises': 'error',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
files: ['**/*.spec.ts', '**/*.store.ts'],
|
|
222
|
+
rules: {
|
|
223
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
224
|
+
'max-lines-per-function': 'off',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
files: ['**/*.spec.ts', '**/*.e2e-spec.ts'],
|
|
229
|
+
rules: {
|
|
230
|
+
'max-statements': 'off',
|
|
231
|
+
'max-lines-per-function': 'off',
|
|
232
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
233
|
+
'jasmine/no-focused-tests': 'error',
|
|
234
|
+
'no-only-tests/no-only-tests': 'error',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
];
|
|
@@ -7,7 +7,7 @@ const customized = stylistic.configs.customize({
|
|
|
7
7
|
|
|
8
8
|
export default [
|
|
9
9
|
{
|
|
10
|
-
files: ['
|
|
10
|
+
files: ['**/*.ts', '**/*.js', '**/*.mjs'],
|
|
11
11
|
plugins: {
|
|
12
12
|
'@stylistic': stylistic,
|
|
13
13
|
},
|
|
@@ -21,10 +21,11 @@ export default [
|
|
|
21
21
|
'error',
|
|
22
22
|
{
|
|
23
23
|
arrays: 'always-multiline',
|
|
24
|
+
enums: 'always-multiline',
|
|
24
25
|
objects: 'always-multiline',
|
|
25
26
|
imports: 'always-multiline',
|
|
26
|
-
exports: '
|
|
27
|
-
functions: '
|
|
27
|
+
exports: 'always-multiline',
|
|
28
|
+
functions: 'always-multiline',
|
|
28
29
|
},
|
|
29
30
|
],
|
|
30
31
|
'@stylistic/dot-location': ['error', 'property'],
|
|
@@ -35,7 +36,7 @@ export default [
|
|
|
35
36
|
'@stylistic/max-len': [
|
|
36
37
|
'error',
|
|
37
38
|
{
|
|
38
|
-
code:
|
|
39
|
+
code: 140,
|
|
39
40
|
ignoreRegExpLiterals: true,
|
|
40
41
|
ignoreStrings: true,
|
|
41
42
|
ignoreTemplateLiterals: true,
|
package/eslint.config.mjs
CHANGED
package/index.mjs
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import tseslint from 'typescript-eslint';
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
|
|
3
|
+
import bestPracticesTS from './configurations/best-practices-ts.mjs';
|
|
4
|
+
import bestPracticesHTML from './configurations/best-practices-html.mjs';
|
|
5
|
+
import codeStyle from './configurations/code-style.mjs';
|
|
6
|
+
|
|
7
|
+
export { default as bestPracticesTS } from './configurations/best-practices-ts.mjs';
|
|
8
|
+
export { default as bestPracticesHTML } from './configurations/best-practices-html.mjs';
|
|
9
|
+
export { default as codeStyle } from './configurations/code-style.mjs';
|
|
4
10
|
|
|
5
11
|
export default [
|
|
6
12
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
files: ['**/*.mjs'],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: tseslint.parser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
projectService: {
|
|
18
|
+
allowDefaultProject: ['*.mjs'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
10
25
|
},
|
|
11
|
-
...
|
|
12
|
-
...
|
|
26
|
+
...bestPracticesTS,
|
|
27
|
+
...bestPracticesHTML,
|
|
28
|
+
...codeStyle,
|
|
13
29
|
{
|
|
14
30
|
files: ['*.spec.ts'],
|
|
15
31
|
plugins: { '@typescript-eslint': tseslint.plugin },
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeroenpol/eslint-config",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "ESLint config made for Angular, configured by Polware",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.mjs",
|
|
8
|
+
"./best-practices": "./configurations/best-practices.mjs",
|
|
9
|
+
"./stylistic": "./configurations/stylistic.mjs",
|
|
8
10
|
"./package.json": "./package.json"
|
|
9
11
|
},
|
|
10
|
-
"scripts": {
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint:smoke": "eslint --config test/smoke/eslint.config.mjs test/smoke/sample.ts"
|
|
14
|
+
},
|
|
11
15
|
"repository": {
|
|
12
16
|
"type": "git",
|
|
13
17
|
"url": "https://github.com/jeroenpol/eslint-config"
|
|
@@ -34,33 +38,24 @@
|
|
|
34
38
|
"url": "https://github.com/jeroenpol/eslint-config"
|
|
35
39
|
},
|
|
36
40
|
"homepage": "https://github.com/jeroenpol/eslint-config",
|
|
37
|
-
"
|
|
38
|
-
"@eslint/eslintrc": "^3.3.0",
|
|
39
|
-
"@eslint/js": "^9.21.0",
|
|
41
|
+
"dependencies": {
|
|
40
42
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
41
|
-
"@stylistic/eslint-plugin-ts": "^4.2.0",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "8.8.1",
|
|
43
|
-
"@typescript-eslint/parser": "^8.8.1",
|
|
44
|
-
"eslint": "^9.8.0",
|
|
45
43
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
46
44
|
"eslint-plugin-sonarjs": "3.0.2",
|
|
47
45
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
48
|
-
"typescript": "^5.5.4",
|
|
49
46
|
"typescript-eslint": "^8.8.1"
|
|
50
47
|
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
50
|
+
"@eslint/js": "^9.21.0",
|
|
51
|
+
"eslint": "^9.8.0",
|
|
52
|
+
"typescript": "^5.5.4"
|
|
53
|
+
},
|
|
51
54
|
"peerDependencies": {
|
|
52
|
-
"@stylistic/eslint-plugin": ">=4",
|
|
53
|
-
"@stylistic/eslint-plugin-ts": ">=4",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": ">=8",
|
|
55
|
-
"@typescript-eslint/parser": ">=8",
|
|
56
55
|
"eslint": ">=9",
|
|
57
|
-
"
|
|
58
|
-
"eslint-plugin-sonarjs": ">=3",
|
|
59
|
-
"eslint-plugin-unused-imports": ">=4",
|
|
60
|
-
"typescript": ">=5",
|
|
61
|
-
"typescript-eslint": ">=8"
|
|
56
|
+
"typescript": ">=5"
|
|
62
57
|
},
|
|
63
58
|
"engines": {
|
|
64
59
|
"node": "20"
|
|
65
60
|
}
|
|
66
|
-
}
|
|
61
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"compileOnSave": false,
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"baseUrl": ".",
|
|
5
|
+
"allowJs": true,
|
|
5
6
|
"outDir": "./dist/out-tsc",
|
|
6
7
|
"sourceMap": true,
|
|
7
8
|
"declaration": false,
|
|
@@ -15,5 +16,7 @@
|
|
|
15
16
|
"lib": ["es2018", "dom"],
|
|
16
17
|
"useDefineForClassFields": false,
|
|
17
18
|
"strictNullChecks": true
|
|
18
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"include": ["**/*.ts", "**/*.mts", "**/*.cts", "**/*.mjs", "**/*.js"],
|
|
21
|
+
"exclude": ["node_modules", "dist"]
|
|
19
22
|
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import sonarjs from 'eslint-plugin-sonarjs';
|
|
2
|
-
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
3
|
-
import unusedImports from 'eslint-plugin-unused-imports';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(tseslint.configs.recommendedTypeChecked,
|
|
7
|
-
{
|
|
8
|
-
files: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.js'],
|
|
9
|
-
plugins: { 'sonarjs': sonarjs, 'simple-import-sort': simpleImportSort, 'unused-imports': unusedImports, '@typescript-eslint': tseslint.plugin },
|
|
10
|
-
languageOptions: {
|
|
11
|
-
parserOptions: {
|
|
12
|
-
projectService: true,
|
|
13
|
-
tsconfigRootDir: import.meta.dirname,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
rules: {
|
|
17
|
-
// GENERAL
|
|
18
|
-
'no-unreachable': 'error',
|
|
19
|
-
'no-debugger': 'error',
|
|
20
|
-
'no-console': 'error',
|
|
21
|
-
'no-empty': 'error',
|
|
22
|
-
'unicode-bom': 'warn',
|
|
23
|
-
|
|
24
|
-
// NAMING CONVENTIONS
|
|
25
|
-
'@typescript-eslint/naming-convention': [
|
|
26
|
-
'warn',
|
|
27
|
-
{
|
|
28
|
-
selector: 'enum',
|
|
29
|
-
format: ['PascalCase'],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
selector: 'enumMember',
|
|
33
|
-
format: ['UPPER_CASE'],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
selector: 'interface',
|
|
37
|
-
format: ['PascalCase'],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
// CODE COMPLEXITY
|
|
42
|
-
'max-depth': ['error', 8],
|
|
43
|
-
'max-nested-callbacks': ['error', 8],
|
|
44
|
-
'max-statements-per-line': ['error', { max: 1 }],
|
|
45
|
-
'sonarjs/cognitive-complexity': ['error', 15],
|
|
46
|
-
|
|
47
|
-
// CLASSES
|
|
48
|
-
'@typescript-eslint/no-require-imports': 'error',
|
|
49
|
-
'simple-import-sort/imports': 'error',
|
|
50
|
-
'simple-import-sort/exports': 'error',
|
|
51
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
52
|
-
'unused-imports/no-unused-imports': 'error',
|
|
53
|
-
'no-duplicate-imports': 'error',
|
|
54
|
-
'no-useless-constructor': 'off', // duplicate of @typescript-eslint/no-useless-constructor
|
|
55
|
-
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
56
|
-
'@typescript-eslint/member-ordering': 'warn',
|
|
57
|
-
'@typescript-eslint/explicit-member-accessibility': [
|
|
58
|
-
'error',
|
|
59
|
-
{
|
|
60
|
-
accessibility: 'off',
|
|
61
|
-
overrides: {
|
|
62
|
-
accessors: 'explicit',
|
|
63
|
-
constructors: 'no-public',
|
|
64
|
-
methods: 'explicit',
|
|
65
|
-
properties: 'explicit',
|
|
66
|
-
parameterProperties: 'explicit',
|
|
67
|
-
},
|
|
68
|
-
ignoredMethodNames: [
|
|
69
|
-
'ngOnChanges',
|
|
70
|
-
'ngOnInit',
|
|
71
|
-
'ngDoCheck',
|
|
72
|
-
'ngAfterContentInit',
|
|
73
|
-
'ngAfterContentChecked',
|
|
74
|
-
'ngAfterViewInit',
|
|
75
|
-
'ngAfterViewChecked',
|
|
76
|
-
'ngOnDestroy',
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
// FUNCTIONS
|
|
82
|
-
'curly': ['error', 'all'],
|
|
83
|
-
'max-lines-per-function': ['error', { max: 60, skipBlankLines: true, skipComments: true }],
|
|
84
|
-
'max-statements': ['error', 20],
|
|
85
|
-
'no-empty-function': ['error', { allow: ['constructors'] }],
|
|
86
|
-
'no-param-reassign': 'error',
|
|
87
|
-
'no-unexpected-multiline': 'error',
|
|
88
|
-
'prefer-arrow-callback': 'warn',
|
|
89
|
-
'@typescript-eslint/explicit-function-return-type': ['error', { allowHigherOrderFunctions: true, allowExpressions: true }],
|
|
90
|
-
'sonarjs/no-extra-arguments': 'error',
|
|
91
|
-
|
|
92
|
-
// VARIABLES
|
|
93
|
-
'unused-imports/no-unused-vars': [
|
|
94
|
-
'error',
|
|
95
|
-
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
|
|
96
|
-
],
|
|
97
|
-
'no-shadow': 'error',
|
|
98
|
-
'no-multi-assign': 'error',
|
|
99
|
-
'prefer-const': 'error',
|
|
100
|
-
'no-unused-expressions': 'error',
|
|
101
|
-
'sonarjs/non-existent-operator': 'error',
|
|
102
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
103
|
-
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
104
|
-
'@typescript-eslint/no-inferrable-types': 'error',
|
|
105
|
-
'@typescript-eslint/no-restricted-types': [
|
|
106
|
-
'error',
|
|
107
|
-
{
|
|
108
|
-
types: {
|
|
109
|
-
Boolean: {
|
|
110
|
-
message: 'Use boolean instead',
|
|
111
|
-
fixWith: 'boolean',
|
|
112
|
-
},
|
|
113
|
-
Number: {
|
|
114
|
-
message: 'Use number instead',
|
|
115
|
-
fixWith: 'number',
|
|
116
|
-
},
|
|
117
|
-
String: {
|
|
118
|
-
message: 'Use string instead',
|
|
119
|
-
fixWith: 'string',
|
|
120
|
-
},
|
|
121
|
-
Symbol: {
|
|
122
|
-
message: 'Use symbol instead',
|
|
123
|
-
fixWith: 'symbol',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
129
|
-
|
|
130
|
-
// ARRAYS
|
|
131
|
-
'array-callback-return': 'error',
|
|
132
|
-
'@typescript-eslint/array-type': 'error',
|
|
133
|
-
'no-array-constructor': 'error',
|
|
134
|
-
'@typescript-eslint/prefer-includes': 'warn',
|
|
135
|
-
|
|
136
|
-
// SWITCH STATEMENTS
|
|
137
|
-
'sonarjs/max-switch-cases': ['error', 10],
|
|
138
|
-
'sonarjs/no-nested-switch': 'error',
|
|
139
|
-
'default-case': 'error',
|
|
140
|
-
'no-fallthrough': 'error',
|
|
141
|
-
|
|
142
|
-
// COMPARISON
|
|
143
|
-
'sonarjs/no-inverted-boolean-check': 'error',
|
|
144
|
-
'eqeqeq': 'error',
|
|
145
|
-
|
|
146
|
-
// ASYNCHRONOUS
|
|
147
|
-
'@typescript-eslint/no-misused-promises': 'error',
|
|
148
|
-
'@typescript-eslint/no-floating-promises': 'error',
|
|
149
|
-
},
|
|
150
|
-
});
|