@enormora/eslint-config-base 0.0.31 → 0.0.33
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/constants.js +2 -2
- package/package.json +31 -5
- package/{base.js → presets/base/base-shared.js} +61 -56
- package/presets/base/base.js +80 -0
- package/presets/base/dprint-config.js +90 -0
- package/readme.md +79 -5
- package/rule-sets/best-practices.js +10 -9
- package/rule-sets/restricted-syntax.js +49 -0
- package/rule-sets/stylistic.js +33 -38
- package/sbom.cdx.json +271 -0
package/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const ecmaVersion = 2025;
|
|
2
2
|
export const indentSize = 4;
|
|
3
|
-
export const javascriptExtensions = ['.js', '.cjs', '.mjs'];
|
|
4
|
-
export const typescriptExtensions = ['.ts', '.cts', '.mts'];
|
|
3
|
+
export const javascriptExtensions = [ '.js', '.cjs', '.mjs' ];
|
|
4
|
+
export const typescriptExtensions = [ '.ts', '.cts', '.mts' ];
|
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"Christian Rackerseder <github@echooff.de>"
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
|
+
"@ben_12/eslint-plugin-dprint": "1.19.0",
|
|
8
|
+
"@ben_12/eslint-simple-parser": "0.1.0",
|
|
7
9
|
"@cspell/eslint-plugin": "10.0.0",
|
|
8
10
|
"@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
|
|
9
11
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
@@ -12,19 +14,43 @@
|
|
|
12
14
|
"eslint-plugin-import-x": "4.16.2",
|
|
13
15
|
"eslint-plugin-no-barrel-files": "1.3.1",
|
|
14
16
|
"eslint-plugin-no-secrets": "2.3.3",
|
|
15
|
-
"eslint-plugin-
|
|
16
|
-
"eslint-plugin-
|
|
17
|
-
"eslint-plugin-sonarjs": "4.0.2",
|
|
17
|
+
"eslint-plugin-promise": "7.3.0",
|
|
18
|
+
"eslint-plugin-sonarjs": "4.0.3",
|
|
18
19
|
"eslint-plugin-unicorn": "64.0.0"
|
|
19
20
|
},
|
|
20
21
|
"description": "Enormora’s ESLint base configuration",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./presets/base/base.js"
|
|
25
|
+
},
|
|
26
|
+
"./constants.js": {
|
|
27
|
+
"import": "./constants.js"
|
|
28
|
+
},
|
|
29
|
+
"./presets/base/base-shared.js": {
|
|
30
|
+
"import": "./presets/base/base-shared.js"
|
|
31
|
+
},
|
|
32
|
+
"./rule-sets/restricted-syntax.js": {
|
|
33
|
+
"import": "./rule-sets/restricted-syntax.js"
|
|
34
|
+
},
|
|
35
|
+
"./rule-sets/stylistic.js": {
|
|
36
|
+
"import": "./rule-sets/stylistic.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
21
39
|
"license": "MIT",
|
|
22
|
-
"main": "base.js",
|
|
23
40
|
"name": "@enormora/eslint-config-base",
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"eslint": "^10.0.0"
|
|
43
|
+
},
|
|
24
44
|
"repository": {
|
|
25
45
|
"type": "git",
|
|
26
46
|
"url": "git://github.com/enormora/eslint-config.git"
|
|
27
47
|
},
|
|
48
|
+
"sideEffects": [
|
|
49
|
+
"./presets/base/base-shared.js",
|
|
50
|
+
"./presets/base/base.js",
|
|
51
|
+
"./rule-sets/best-practices.js",
|
|
52
|
+
"./rule-sets/restricted-syntax.js"
|
|
53
|
+
],
|
|
28
54
|
"type": "module",
|
|
29
|
-
"version": "0.0.
|
|
55
|
+
"version": "0.0.33"
|
|
30
56
|
}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import codeSpellChecker from '@cspell/eslint-plugin';
|
|
2
2
|
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
|
|
3
|
+
import importPlugin, { createNodeResolver } from 'eslint-plugin-import-x';
|
|
3
4
|
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { ecmaVersion, javascriptExtensions } from '../../constants.js';
|
|
6
|
+
import { bestPracticesRuleSet } from '../../rule-sets/best-practices.js';
|
|
7
|
+
import {
|
|
8
|
+
createRestrictedSyntaxPlugin,
|
|
9
|
+
noClassDeclarationRestriction,
|
|
10
|
+
noEmptyFunctionBodyRestriction,
|
|
11
|
+
noInOperatorRestriction,
|
|
12
|
+
noSwitchStatementRestriction
|
|
13
|
+
} from '../../rule-sets/restricted-syntax.js';
|
|
14
|
+
import { stylisticRuleSet } from '../../rule-sets/stylistic.js';
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
const restrictedSyntaxPlugin = createRestrictedSyntaxPlugin([
|
|
17
|
+
'no-class-declaration',
|
|
18
|
+
'no-switch-statement',
|
|
19
|
+
'no-empty-function-body',
|
|
20
|
+
'no-in-operator'
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export const baseSharedConfig = {
|
|
10
24
|
languageOptions: {
|
|
11
25
|
ecmaVersion,
|
|
12
26
|
sourceType: 'module',
|
|
@@ -29,7 +43,8 @@ export const baseConfig = {
|
|
|
29
43
|
import: importPlugin,
|
|
30
44
|
'eslint-comments': eslintCommentsPlugin,
|
|
31
45
|
'no-secrets': noSecretsPlugin,
|
|
32
|
-
'@cspell': codeSpellChecker
|
|
46
|
+
'@cspell': codeSpellChecker,
|
|
47
|
+
'restricted-syntax': restrictedSyntaxPlugin
|
|
33
48
|
},
|
|
34
49
|
settings: {
|
|
35
50
|
...stylisticRuleSet.settings,
|
|
@@ -37,7 +52,7 @@ export const baseConfig = {
|
|
|
37
52
|
'import/parsers': {
|
|
38
53
|
espree: javascriptExtensions
|
|
39
54
|
},
|
|
40
|
-
'import-x/resolver-next': [createNodeResolver()]
|
|
55
|
+
'import-x/resolver-next': [ createNodeResolver() ]
|
|
41
56
|
},
|
|
42
57
|
rules: {
|
|
43
58
|
...stylisticRuleSet.rules,
|
|
@@ -64,10 +79,10 @@ export const baseConfig = {
|
|
|
64
79
|
'no-dupe-args': 'error',
|
|
65
80
|
'no-duplicate-case': 'error',
|
|
66
81
|
'no-duplicate-imports': 'error',
|
|
67
|
-
'no-else-return': ['error', { allowElseIf: false }],
|
|
68
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
82
|
+
'no-else-return': [ 'error', { allowElseIf: false } ],
|
|
83
|
+
'no-empty': [ 'error', { allowEmptyCatch: true } ],
|
|
69
84
|
'no-empty-character-class': 'error',
|
|
70
|
-
'no-empty-function': '
|
|
85
|
+
'no-empty-function': 'off',
|
|
71
86
|
'no-empty-pattern': 'error',
|
|
72
87
|
'no-empty-static-block': 'error',
|
|
73
88
|
'no-eq-null': 'error',
|
|
@@ -83,7 +98,7 @@ export const baseConfig = {
|
|
|
83
98
|
'no-implicit-globals': 'error',
|
|
84
99
|
'no-implied-eval': 'error',
|
|
85
100
|
'no-inline-comments': 'off',
|
|
86
|
-
'no-inner-declarations': ['error', 'functions'],
|
|
101
|
+
'no-inner-declarations': [ 'error', 'functions' ],
|
|
87
102
|
'no-invalid-regexp': 'error',
|
|
88
103
|
'no-invalid-this': 'off',
|
|
89
104
|
'no-irregular-whitespace': 'error',
|
|
@@ -105,39 +120,29 @@ export const baseConfig = {
|
|
|
105
120
|
'no-object-constructor': 'error',
|
|
106
121
|
'no-octal': 'error',
|
|
107
122
|
'no-octal-escape': 'error',
|
|
108
|
-
'no-param-reassign': ['error', { props: true }],
|
|
123
|
+
'no-param-reassign': [ 'error', { props: true } ],
|
|
109
124
|
'no-plusplus': 'error',
|
|
110
125
|
'no-proto': 'error',
|
|
111
126
|
'no-prototype-builtins': 'error',
|
|
112
|
-
'no-redeclare': ['error', { builtinGlobals: true }],
|
|
127
|
+
'no-redeclare': [ 'error', { builtinGlobals: true } ],
|
|
113
128
|
'no-regex-spaces': 'error',
|
|
114
|
-
'no-restricted-syntax':
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
selector: 'ClassDeclaration[superClass.name!=/Error$/]',
|
|
122
|
-
message: 'Class declarations are not allowed except for extending errors.'
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
selector: 'SwitchStatement',
|
|
126
|
-
message: 'Use pattern matching instead.'
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
'no-return-assign': ['error', 'always'],
|
|
130
|
-
'no-self-assign': ['error', { props: true }],
|
|
129
|
+
'no-restricted-syntax': 'off',
|
|
130
|
+
'restricted-syntax/no-class-declaration': [ 'error', noClassDeclarationRestriction ],
|
|
131
|
+
'restricted-syntax/no-switch-statement': [ 'error', noSwitchStatementRestriction ],
|
|
132
|
+
'restricted-syntax/no-empty-function-body': [ 'error', noEmptyFunctionBodyRestriction ],
|
|
133
|
+
'restricted-syntax/no-in-operator': [ 'error', noInOperatorRestriction ],
|
|
134
|
+
'no-return-assign': [ 'error', 'always' ],
|
|
135
|
+
'no-self-assign': [ 'error', { props: true } ],
|
|
131
136
|
'no-self-compare': 'error',
|
|
132
137
|
'no-sequences': 'error',
|
|
133
|
-
'no-shadow': ['error', { builtinGlobals: true }],
|
|
138
|
+
'no-shadow': [ 'error', { builtinGlobals: true } ],
|
|
134
139
|
'no-shadow-restricted-names': 'error',
|
|
135
140
|
'no-sparse-arrays': 'error',
|
|
136
141
|
'no-ternary': 'off',
|
|
137
142
|
'no-this-before-super': 'error',
|
|
138
143
|
'no-throw-literal': 'error',
|
|
139
144
|
'no-unassigned-vars': 'error',
|
|
140
|
-
'no-undef': ['error', { typeof: true }],
|
|
145
|
+
'no-undef': [ 'error', { typeof: true } ],
|
|
141
146
|
'no-undef-init': 'error',
|
|
142
147
|
'no-undefined': 'off',
|
|
143
148
|
'no-unexpected-multiline': 'error',
|
|
@@ -180,7 +185,7 @@ export const baseConfig = {
|
|
|
180
185
|
'no-warning-comments': [
|
|
181
186
|
'error',
|
|
182
187
|
{
|
|
183
|
-
terms: ['todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8'],
|
|
188
|
+
terms: [ 'todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8' ],
|
|
184
189
|
location: 'anywhere'
|
|
185
190
|
}
|
|
186
191
|
],
|
|
@@ -193,10 +198,10 @@ export const baseConfig = {
|
|
|
193
198
|
detectObjects: false,
|
|
194
199
|
enforceConst: false,
|
|
195
200
|
ignoreClassFieldInitialValues: false,
|
|
196
|
-
ignore: [-1, 0, 1]
|
|
201
|
+
ignore: [ -1, 0, 1 ]
|
|
197
202
|
}
|
|
198
203
|
],
|
|
199
|
-
'arrow-body-style': ['error', 'always'],
|
|
204
|
+
'arrow-body-style': [ 'error', 'always' ],
|
|
200
205
|
'accessor-pairs': [
|
|
201
206
|
'error',
|
|
202
207
|
{
|
|
@@ -204,24 +209,24 @@ export const baseConfig = {
|
|
|
204
209
|
}
|
|
205
210
|
],
|
|
206
211
|
'block-scoped-var': 'off',
|
|
207
|
-
complexity: ['error', { max: 6 }],
|
|
212
|
+
complexity: [ 'error', { max: 6 } ],
|
|
208
213
|
'consistent-return': 'error',
|
|
209
|
-
'consistent-this': ['error', 'self'],
|
|
214
|
+
'consistent-this': [ 'error', 'self' ],
|
|
210
215
|
'constructor-super': 'error',
|
|
211
|
-
curly: ['error', 'all'],
|
|
216
|
+
curly: [ 'error', 'all' ],
|
|
212
217
|
'default-case': 'error',
|
|
213
218
|
'dot-notation': 'error',
|
|
214
219
|
eqeqeq: 'error',
|
|
215
220
|
'func-names': 'off',
|
|
216
221
|
'func-style': 'off',
|
|
217
222
|
'guard-for-in': 'error',
|
|
218
|
-
'id-length': ['error', { min: 2, properties: 'never' }],
|
|
219
|
-
'init-declarations': ['error', 'always'],
|
|
220
|
-
'max-depth': ['error', { max: 5 }],
|
|
221
|
-
'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: true }],
|
|
222
|
-
'max-nested-callbacks': ['error', { max: 4 }],
|
|
223
|
-
'max-params': ['error', { max: 4 }],
|
|
224
|
-
'max-statements': ['error', { max: 10 }],
|
|
223
|
+
'id-length': [ 'error', { min: 2, properties: 'never' } ],
|
|
224
|
+
'init-declarations': [ 'error', 'always' ],
|
|
225
|
+
'max-depth': [ 'error', { max: 5 } ],
|
|
226
|
+
'max-lines': [ 'error', { max: 500, skipBlankLines: true, skipComments: true } ],
|
|
227
|
+
'max-nested-callbacks': [ 'error', { max: 4 } ],
|
|
228
|
+
'max-params': [ 'error', { max: 4 } ],
|
|
229
|
+
'max-statements': [ 'error', { max: 10 } ],
|
|
225
230
|
'new-cap': [
|
|
226
231
|
'error',
|
|
227
232
|
{
|
|
@@ -229,9 +234,9 @@ export const baseConfig = {
|
|
|
229
234
|
capIsNew: true
|
|
230
235
|
}
|
|
231
236
|
],
|
|
232
|
-
'object-shorthand': ['error', 'always'],
|
|
233
|
-
'one-var': ['error', 'never'],
|
|
234
|
-
'operator-assignment': ['error', 'always'],
|
|
237
|
+
'object-shorthand': [ 'error', 'always' ],
|
|
238
|
+
'one-var': [ 'error', 'never' ],
|
|
239
|
+
'operator-assignment': [ 'error', 'always' ],
|
|
235
240
|
'prefer-arrow-callback': [
|
|
236
241
|
'error',
|
|
237
242
|
{
|
|
@@ -244,12 +249,12 @@ export const baseConfig = {
|
|
|
244
249
|
'require-yield': 'error',
|
|
245
250
|
'sort-vars': 'off',
|
|
246
251
|
'sort-imports': 'off',
|
|
247
|
-
strict: ['error', 'safe'],
|
|
248
|
-
'unicode-bom': ['error', 'never'],
|
|
252
|
+
strict: [ 'error', 'safe' ],
|
|
253
|
+
'unicode-bom': [ 'error', 'never' ],
|
|
249
254
|
'use-isnan': 'error',
|
|
250
255
|
'valid-typeof': 'error',
|
|
251
256
|
'vars-on-top': 'error',
|
|
252
|
-
yoda: ['error', 'never'],
|
|
257
|
+
yoda: [ 'error', 'never' ],
|
|
253
258
|
'capitalized-comments': 'off',
|
|
254
259
|
'class-methods-use-this': 'error',
|
|
255
260
|
'func-name-matching': 'off',
|
|
@@ -329,11 +334,11 @@ export const baseConfig = {
|
|
|
329
334
|
'no-unsafe-optional-chaining': 'error',
|
|
330
335
|
'no-unused-private-class-members': 'error',
|
|
331
336
|
'no-constant-binary-expression': 'error',
|
|
332
|
-
'logical-assignment-operators': ['error', 'never'],
|
|
337
|
+
'logical-assignment-operators': [ 'error', 'never' ],
|
|
333
338
|
'prefer-object-has-own': 'error',
|
|
334
339
|
'no-useless-assignment': 'error',
|
|
335
340
|
|
|
336
|
-
'no-secrets/no-secrets': ['error', { tolerance: 5 }],
|
|
341
|
+
'no-secrets/no-secrets': [ 'error', { tolerance: 5 } ],
|
|
337
342
|
'no-secrets/no-pattern-match': 'off',
|
|
338
343
|
|
|
339
344
|
'eslint-comments/disable-enable-pair': [
|
|
@@ -360,9 +365,9 @@ export const baseConfig = {
|
|
|
360
365
|
'import/prefer-default-export': 'off',
|
|
361
366
|
'import/newline-after-import': 'error',
|
|
362
367
|
'import/no-nodejs-modules': 'off',
|
|
363
|
-
'import/max-dependencies': ['error', { max: 10 }],
|
|
368
|
+
'import/max-dependencies': [ 'error', { max: 10 } ],
|
|
364
369
|
'import/first': 'error',
|
|
365
|
-
'import/no-unused-modules': 'error',
|
|
370
|
+
'import/no-unused-modules': [ 'error', { unusedExports: true, suppressMissingFileEnumeratorAPIWarning: true } ],
|
|
366
371
|
'import/no-anonymous-default-export': 'off',
|
|
367
372
|
'import/no-named-default': 'off',
|
|
368
373
|
'import/no-cycle': 'error',
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import dprintPlugin from '@ben_12/eslint-plugin-dprint';
|
|
2
|
+
import simpleParser from '@ben_12/eslint-simple-parser';
|
|
3
|
+
import { baseSharedConfig } from './base-shared.js';
|
|
4
|
+
import {
|
|
5
|
+
jsonDprintConfig,
|
|
6
|
+
markdownDprintConfig,
|
|
7
|
+
tomlDprintConfig,
|
|
8
|
+
typescriptDprintConfig,
|
|
9
|
+
yamlDprintConfig
|
|
10
|
+
} from './dprint-config.js';
|
|
11
|
+
|
|
12
|
+
const baseJsConfig = {
|
|
13
|
+
files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
|
|
14
|
+
...baseSharedConfig,
|
|
15
|
+
plugins: {
|
|
16
|
+
...baseSharedConfig.plugins,
|
|
17
|
+
dprint: dprintPlugin
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
...baseSharedConfig.rules,
|
|
21
|
+
|
|
22
|
+
'dprint/typescript': [ 'error', { config: typescriptDprintConfig } ],
|
|
23
|
+
'dprint/json': 'off',
|
|
24
|
+
'dprint/markdown': 'off',
|
|
25
|
+
'dprint/toml': 'off',
|
|
26
|
+
'dprint/dockerfile': 'off',
|
|
27
|
+
'dprint/malva': 'off',
|
|
28
|
+
'dprint/markup': 'off',
|
|
29
|
+
'dprint/yaml': 'off',
|
|
30
|
+
'dprint/graphql': 'off',
|
|
31
|
+
|
|
32
|
+
'@stylistic/member-delimiter-style': 'off'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const dprintJsonConfig = {
|
|
37
|
+
files: [ '**/*.json' ],
|
|
38
|
+
languageOptions: { parser: simpleParser },
|
|
39
|
+
plugins: { dprint: dprintPlugin },
|
|
40
|
+
rules: { 'dprint/json': [ 'error', { config: jsonDprintConfig } ] }
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const dprintMarkdownConfig = {
|
|
44
|
+
files: [ '**/*.md' ],
|
|
45
|
+
languageOptions: { parser: simpleParser },
|
|
46
|
+
plugins: { dprint: dprintPlugin },
|
|
47
|
+
rules: { 'dprint/markdown': [ 'error', { config: markdownDprintConfig } ] }
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const dprintYamlConfig = {
|
|
51
|
+
files: [ '**/*.{yml,yaml}' ],
|
|
52
|
+
languageOptions: { parser: simpleParser },
|
|
53
|
+
plugins: { dprint: dprintPlugin },
|
|
54
|
+
rules: { 'dprint/yaml': [ 'error', { config: yamlDprintConfig } ] }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const dprintTomlConfig = {
|
|
58
|
+
files: [ '**/*.toml' ],
|
|
59
|
+
languageOptions: { parser: simpleParser },
|
|
60
|
+
plugins: { dprint: dprintPlugin },
|
|
61
|
+
rules: { 'dprint/toml': [ 'error', { config: tomlDprintConfig } ] }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const baseConfig = [
|
|
65
|
+
baseJsConfig,
|
|
66
|
+
dprintJsonConfig,
|
|
67
|
+
dprintMarkdownConfig,
|
|
68
|
+
dprintYamlConfig,
|
|
69
|
+
dprintTomlConfig
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
/* eslint-disable no-barrel-files/no-barrel-files -- expose dprint configs as public API so consumers can spread them when overriding individual options */
|
|
73
|
+
export {
|
|
74
|
+
jsonDprintConfig,
|
|
75
|
+
markdownDprintConfig,
|
|
76
|
+
tomlDprintConfig,
|
|
77
|
+
typescriptDprintConfig,
|
|
78
|
+
yamlDprintConfig
|
|
79
|
+
} from './dprint-config.js';
|
|
80
|
+
/* eslint-enable no-barrel-files/no-barrel-files -- end of public re-exports */
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const lineWidth = 120;
|
|
2
|
+
const indentWidth = 4;
|
|
3
|
+
|
|
4
|
+
export const typescriptDprintConfig = {
|
|
5
|
+
lineWidth,
|
|
6
|
+
indentWidth,
|
|
7
|
+
newLineKind: 'lf',
|
|
8
|
+
useTabs: false,
|
|
9
|
+
semiColons: 'always',
|
|
10
|
+
quoteStyle: 'preferSingle',
|
|
11
|
+
quoteProps: 'asNeeded',
|
|
12
|
+
useBraces: 'always',
|
|
13
|
+
bracePosition: 'sameLine',
|
|
14
|
+
singleBodyPosition: 'nextLine',
|
|
15
|
+
nextControlFlowPosition: 'sameLine',
|
|
16
|
+
trailingCommas: 'never',
|
|
17
|
+
operatorPosition: 'maintain',
|
|
18
|
+
preferHanging: false,
|
|
19
|
+
preferSingleLine: false,
|
|
20
|
+
'arrowFunction.useParentheses': 'force',
|
|
21
|
+
'binaryExpression.linePerExpression': false,
|
|
22
|
+
'jsx.bracketPosition': 'nextLine',
|
|
23
|
+
'jsx.forceNewLinesSurroundingContent': false,
|
|
24
|
+
'jsx.multiLineParens': 'prefer',
|
|
25
|
+
'memberExpression.linePerExpression': true,
|
|
26
|
+
'typeLiteral.separatorKind': 'semiColon',
|
|
27
|
+
'arrayExpression.spaceAround': true,
|
|
28
|
+
'arrayPattern.spaceAround': true,
|
|
29
|
+
'enumDeclaration.memberSpacing': 'newLine',
|
|
30
|
+
spaceAround: false,
|
|
31
|
+
spaceSurroundingProperties: true,
|
|
32
|
+
'binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator': true,
|
|
33
|
+
'commentLine.forceSpaceAfterSlashes': true,
|
|
34
|
+
'constructor.spaceBeforeParentheses': false,
|
|
35
|
+
'constructorType.spaceAfterNewKeyword': true,
|
|
36
|
+
'constructSignature.spaceAfterNewKeyword': true,
|
|
37
|
+
'doWhileStatement.spaceAfterWhileKeyword': true,
|
|
38
|
+
'exportDeclaration.spaceSurroundingNamedExports': true,
|
|
39
|
+
'forInStatement.spaceAfterForKeyword': true,
|
|
40
|
+
'forOfStatement.spaceAfterForKeyword': true,
|
|
41
|
+
'forStatement.spaceAfterForKeyword': true,
|
|
42
|
+
'forStatement.spaceAfterSemiColons': true,
|
|
43
|
+
'functionDeclaration.spaceBeforeParentheses': false,
|
|
44
|
+
'functionExpression.spaceBeforeParentheses': false,
|
|
45
|
+
'functionExpression.spaceAfterFunctionKeyword': true,
|
|
46
|
+
'getAccessor.spaceBeforeParentheses': false,
|
|
47
|
+
'ifStatement.spaceAfterIfKeyword': true,
|
|
48
|
+
'importDeclaration.spaceSurroundingNamedImports': true,
|
|
49
|
+
'jsxSelfClosingElement.spaceBeforeSlash': true,
|
|
50
|
+
'jsxExpressionContainer.spaceSurroundingExpression': false,
|
|
51
|
+
'method.spaceBeforeParentheses': false,
|
|
52
|
+
'setAccessor.spaceBeforeParentheses': false,
|
|
53
|
+
'taggedTemplate.spaceBeforeLiteral': false,
|
|
54
|
+
'typeAnnotation.spaceBeforeColon': false,
|
|
55
|
+
'typeAssertion.spaceBeforeExpression': false,
|
|
56
|
+
'whileStatement.spaceAfterWhileKeyword': true,
|
|
57
|
+
'module.sortImportDeclarations': 'maintain',
|
|
58
|
+
'module.sortExportDeclarations': 'maintain',
|
|
59
|
+
'exportDeclaration.sortNamedExports': 'maintain',
|
|
60
|
+
'importDeclaration.sortNamedImports': 'maintain',
|
|
61
|
+
'exportDeclaration.forceSingleLine': false,
|
|
62
|
+
'importDeclaration.forceSingleLine': false,
|
|
63
|
+
'exportDeclaration.forceMultiLine': 'never',
|
|
64
|
+
'importDeclaration.forceMultiLine': 'never'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const jsonDprintConfig = {
|
|
68
|
+
lineWidth,
|
|
69
|
+
indentWidth,
|
|
70
|
+
newLineKind: 'lf',
|
|
71
|
+
useTabs: false
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const markdownDprintConfig = {
|
|
75
|
+
lineWidth,
|
|
76
|
+
newLineKind: 'lf'
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const yamlDprintConfig = {
|
|
80
|
+
printWidth: lineWidth,
|
|
81
|
+
indentWidth,
|
|
82
|
+
lineBreak: 'lf'
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const tomlDprintConfig = {
|
|
86
|
+
lineWidth,
|
|
87
|
+
indentWidth,
|
|
88
|
+
newLineKind: 'lf',
|
|
89
|
+
useTabs: false
|
|
90
|
+
};
|
package/readme.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
# `@enormora/eslint-config-base`
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@enormora/eslint-config-base)
|
|
4
|
+
|
|
3
5
|
Base ESLint config preset, agnostic to any environment, framework, or library. Targets ESM-only projects.
|
|
4
6
|
|
|
7
|
+
Code formatting is handled by [dprint](https://dprint.dev/), wired into ESLint via the
|
|
8
|
+
[`@ben_12/eslint-plugin-dprint`](https://www.npmjs.com/package/@ben_12/eslint-plugin-dprint) plugin. TypeScript/JavaScript
|
|
9
|
+
files are formatted via the `dprint/typescript` rule, and JSON, Markdown, YAML, and TOML files are formatted via
|
|
10
|
+
their respective `dprint/*` rules — so a single `eslint --fix` covers everything and there is no need for a separate
|
|
11
|
+
formatter step. The dprint configuration ships inline with this preset, so no `dprint.json` is required at the consumer
|
|
12
|
+
project root. If you'd rather use prettier, use [`@enormora/eslint-config-base-with-prettier`](../base-with-prettier/base-with-prettier.md)
|
|
13
|
+
instead — it is an alternative base preset and is not meant to be combined with this one.
|
|
14
|
+
|
|
5
15
|
## Install & Setup
|
|
6
16
|
|
|
7
17
|
Install the `@enormora/eslint-config-base` package via npm:
|
|
@@ -10,15 +20,79 @@ Install the `@enormora/eslint-config-base` package via npm:
|
|
|
10
20
|
npm install --save-dev @enormora/eslint-config-base
|
|
11
21
|
```
|
|
12
22
|
|
|
13
|
-
Create an ESLint configuration file (e.g., `eslint.config.js`) in your project and
|
|
23
|
+
Create an ESLint configuration file (e.g., `eslint.config.js`) in your project and spread the base config into the
|
|
24
|
+
configuration array:
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import { baseConfig } from "@enormora/eslint-config-base";
|
|
28
|
+
|
|
29
|
+
export default [
|
|
30
|
+
{
|
|
31
|
+
ignores: ["dist/**/*"],
|
|
32
|
+
},
|
|
33
|
+
...baseConfig,
|
|
34
|
+
];
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`baseConfig` is an array of flat config blocks. The first block targets `**/*.{js,mjs,cjs}` and carries the lint rules.
|
|
38
|
+
The remaining blocks each enable one dprint formatter scoped to a default file glob:
|
|
39
|
+
|
|
40
|
+
| Block | Files | Rule |
|
|
41
|
+
| :------------ | :----------------------------------------- | :------------------ |
|
|
42
|
+
| JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | `dprint/typescript` |
|
|
43
|
+
| JSON | `**/*.json` | `dprint/json` |
|
|
44
|
+
| Markdown | `**/*.md` | `dprint/markdown` |
|
|
45
|
+
| YAML | `**/*.{yml,yaml}` | `dprint/yaml` |
|
|
46
|
+
| TOML | `**/*.toml` | `dprint/toml` |
|
|
47
|
+
|
|
48
|
+
### Customizing or disabling a formatter
|
|
49
|
+
|
|
50
|
+
Because the formatter blocks are plain flat config, you override them the same way as any other ESLint config — by
|
|
51
|
+
adding a later block whose `files` glob overlaps the one you want to change. Later blocks win.
|
|
52
|
+
|
|
53
|
+
Disable a formatter entirely:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
export default [
|
|
57
|
+
...baseConfig,
|
|
58
|
+
{ files: ["**/*.json"], rules: { "dprint/json": "off" } },
|
|
59
|
+
];
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Scope a formatter to a different path (turn the default off, then re-enable on your paths):
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
export default [
|
|
66
|
+
...baseConfig,
|
|
67
|
+
{ files: ["**/*.json"], rules: { "dprint/json": "off" } },
|
|
68
|
+
{ files: ["src/**/*.json"], rules: { "dprint/json": "error" } },
|
|
69
|
+
];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Ignore specific paths from formatting:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
export default [
|
|
76
|
+
...baseConfig,
|
|
77
|
+
{ ignores: ["vendor/**/*.json", "fixtures/**/*.md"] },
|
|
78
|
+
];
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Tweaking dprint options
|
|
82
|
+
|
|
83
|
+
To override an individual dprint option (e.g. line width, quote style), add a later block that re-configures the rule
|
|
84
|
+
with your own `config`:
|
|
14
85
|
|
|
15
86
|
```javascript
|
|
16
|
-
import { baseConfig } from
|
|
87
|
+
import { baseConfig, typescriptDprintConfig } from "@enormora/eslint-config-base";
|
|
17
88
|
|
|
18
89
|
export default [
|
|
19
|
-
|
|
20
|
-
|
|
90
|
+
...baseConfig,
|
|
91
|
+
{
|
|
92
|
+
files: ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}"],
|
|
93
|
+
rules: {
|
|
94
|
+
"dprint/typescript": ["error", { config: { ...typescriptDprintConfig, lineWidth: 100 } }],
|
|
21
95
|
},
|
|
22
|
-
|
|
96
|
+
},
|
|
23
97
|
];
|
|
24
98
|
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
2
|
-
import promisePlugin from 'eslint-plugin-promise';
|
|
3
1
|
import arrayFunctionPlugin from 'eslint-plugin-array-func';
|
|
4
|
-
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
5
2
|
import noBarrelFiles from 'eslint-plugin-no-barrel-files';
|
|
3
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
4
|
+
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
5
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
6
6
|
|
|
7
7
|
const maxSwitchCases = 6;
|
|
8
8
|
|
|
@@ -11,17 +11,18 @@ function isSonarjsRuleDeprecated(sonarjsRule) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const nonDeprecatedSonarjsRuleNames = new Set(
|
|
14
|
-
Object
|
|
15
|
-
.
|
|
14
|
+
Object
|
|
15
|
+
.entries(sonarjsPlugin.rules)
|
|
16
|
+
.filter(([ , sonarjsRule ]) => {
|
|
16
17
|
return !isSonarjsRuleDeprecated(sonarjsRule);
|
|
17
18
|
})
|
|
18
|
-
.map(([sonarjsRuleName]) => {
|
|
19
|
+
.map(([ sonarjsRuleName ]) => {
|
|
19
20
|
return `sonarjs/${sonarjsRuleName}`;
|
|
20
21
|
})
|
|
21
22
|
);
|
|
22
23
|
|
|
23
24
|
const nonDeprecatedSonarjsRecommendedRules = Object.fromEntries(
|
|
24
|
-
Object.entries(sonarjsPlugin.configs.recommended.rules).filter(([sonarjsRuleName]) => {
|
|
25
|
+
Object.entries(sonarjsPlugin.configs.recommended.rules).filter(([ sonarjsRuleName ]) => {
|
|
25
26
|
return nonDeprecatedSonarjsRuleNames.has(sonarjsRuleName);
|
|
26
27
|
})
|
|
27
28
|
);
|
|
@@ -194,7 +195,7 @@ export const bestPracticesRuleSet = {
|
|
|
194
195
|
|
|
195
196
|
'sonarjs/cognitive-complexity': 'off',
|
|
196
197
|
'sonarjs/elseif-without-else': 'off',
|
|
197
|
-
'sonarjs/max-switch-cases': ['error', maxSwitchCases],
|
|
198
|
+
'sonarjs/max-switch-cases': [ 'error', maxSwitchCases ],
|
|
198
199
|
'sonarjs/no-all-duplicated-branches': 'error',
|
|
199
200
|
'sonarjs/no-collapsible-if': 'error',
|
|
200
201
|
'sonarjs/no-collection-size-mischeck': 'error',
|
|
@@ -244,7 +245,7 @@ export const bestPracticesRuleSet = {
|
|
|
244
245
|
'promise/no-new-statics': 'error',
|
|
245
246
|
'promise/no-return-in-finally': 'error',
|
|
246
247
|
'promise/valid-params': 'error',
|
|
247
|
-
'promise/prefer-await-to-then': 'error',
|
|
248
|
+
'promise/prefer-await-to-then': [ 'error', { strict: true } ],
|
|
248
249
|
'promise/no-multiple-resolved': 'error',
|
|
249
250
|
'promise/spec-only': 'error',
|
|
250
251
|
'promise/prefer-catch': 'error',
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { builtinRules } from 'eslint/use-at-your-own-risk';
|
|
2
|
+
|
|
3
|
+
const noRestrictedSyntaxRule = builtinRules.get('no-restricted-syntax');
|
|
4
|
+
|
|
5
|
+
export function createRestrictedSyntaxPlugin(ruleNames) {
|
|
6
|
+
return {
|
|
7
|
+
rules: Object.fromEntries(
|
|
8
|
+
ruleNames.map((ruleName) => {
|
|
9
|
+
return [ ruleName, noRestrictedSyntaxRule ];
|
|
10
|
+
})
|
|
11
|
+
)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const defaultAllowedSuperClassNamePattern = '/Error$/';
|
|
16
|
+
const defaultClassDeclarationMessage = 'Class declarations are not allowed except for extending errors.';
|
|
17
|
+
|
|
18
|
+
export function createNoClassDeclarationRestriction({
|
|
19
|
+
allowedSuperClassNamePattern = defaultAllowedSuperClassNamePattern,
|
|
20
|
+
message = defaultClassDeclarationMessage
|
|
21
|
+
} = {}) {
|
|
22
|
+
return {
|
|
23
|
+
selector: `ClassDeclaration[superClass.name!=${allowedSuperClassNamePattern}]`,
|
|
24
|
+
message
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const noClassDeclarationRestriction = createNoClassDeclarationRestriction();
|
|
29
|
+
|
|
30
|
+
export const noSwitchStatementRestriction = {
|
|
31
|
+
selector: 'SwitchStatement',
|
|
32
|
+
message: 'Use pattern matching instead.'
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const emptyFunctionBodySelector = [ 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression' ]
|
|
36
|
+
.map((kind) => {
|
|
37
|
+
return `${kind} > BlockStatement[body.length=0]`;
|
|
38
|
+
})
|
|
39
|
+
.join(', ');
|
|
40
|
+
|
|
41
|
+
export const noEmptyFunctionBodyRestriction = {
|
|
42
|
+
selector: emptyFunctionBodySelector,
|
|
43
|
+
message: 'Empty function bodies are not allowed, even with a comment.'
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const noInOperatorRestriction = {
|
|
47
|
+
selector: 'BinaryExpression[operator="in"]',
|
|
48
|
+
message: 'The `in` operator is not allowed. Use `Object.hasOwn` instead.'
|
|
49
|
+
};
|
package/rule-sets/stylistic.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
2
|
-
import destructuringPlugin from 'eslint-plugin-destructuring';
|
|
3
1
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
2
|
+
import destructuringPlugin from 'eslint-plugin-destructuring';
|
|
4
3
|
import { indentSize } from '../constants.js';
|
|
5
4
|
|
|
6
5
|
export const stylisticRuleSet = {
|
|
7
6
|
plugins: {
|
|
8
|
-
prettier: prettierPlugin,
|
|
9
7
|
destructuring: destructuringPlugin,
|
|
10
8
|
'@stylistic': stylisticPlugin
|
|
11
9
|
},
|
|
@@ -13,16 +11,14 @@ export const stylisticRuleSet = {
|
|
|
13
11
|
settings: {},
|
|
14
12
|
|
|
15
13
|
rules: {
|
|
16
|
-
'prettier/prettier': 'error',
|
|
17
|
-
|
|
18
14
|
'destructuring/in-methods-params': 'error',
|
|
19
|
-
'destructuring/in-params': ['error', { 'max-params': 0 }],
|
|
15
|
+
'destructuring/in-params': [ 'error', { 'max-params': 0 } ],
|
|
20
16
|
'destructuring/no-rename': 'off',
|
|
21
17
|
|
|
22
18
|
'@stylistic/array-bracket-newline': 'off',
|
|
23
|
-
'@stylistic/array-bracket-spacing': ['error', '
|
|
24
|
-
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
25
|
-
'@stylistic/arrow-parens': ['error', 'always'],
|
|
19
|
+
'@stylistic/array-bracket-spacing': [ 'error', 'always' ],
|
|
20
|
+
'@stylistic/array-element-newline': [ 'error', 'consistent' ],
|
|
21
|
+
'@stylistic/arrow-parens': [ 'error', 'always' ],
|
|
26
22
|
'@stylistic/arrow-spacing': [
|
|
27
23
|
'error',
|
|
28
24
|
{
|
|
@@ -31,8 +27,8 @@ export const stylisticRuleSet = {
|
|
|
31
27
|
}
|
|
32
28
|
],
|
|
33
29
|
'@stylistic/block-spacing': 'off',
|
|
34
|
-
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: false }],
|
|
35
|
-
'@stylistic/comma-dangle': ['error', 'never'],
|
|
30
|
+
'@stylistic/brace-style': [ 'error', '1tbs', { allowSingleLine: false } ],
|
|
31
|
+
'@stylistic/comma-dangle': [ 'error', 'never' ],
|
|
36
32
|
'@stylistic/comma-spacing': [
|
|
37
33
|
'error',
|
|
38
34
|
{
|
|
@@ -40,7 +36,7 @@ export const stylisticRuleSet = {
|
|
|
40
36
|
after: true
|
|
41
37
|
}
|
|
42
38
|
],
|
|
43
|
-
'@stylistic/comma-style': ['error', 'last'],
|
|
39
|
+
'@stylistic/comma-style': [ 'error', 'last' ],
|
|
44
40
|
'@stylistic/computed-property-spacing': [
|
|
45
41
|
'error',
|
|
46
42
|
'never',
|
|
@@ -48,15 +44,15 @@ export const stylisticRuleSet = {
|
|
|
48
44
|
enforceForClassMembers: true
|
|
49
45
|
}
|
|
50
46
|
],
|
|
51
|
-
'@stylistic/dot-location': ['error', 'property'],
|
|
47
|
+
'@stylistic/dot-location': [ 'error', 'property' ],
|
|
52
48
|
'@stylistic/eol-last': 'error',
|
|
53
49
|
'@stylistic/exp-list-style': 'off',
|
|
54
50
|
'@stylistic/exp-jsx-props-style': 'off',
|
|
55
|
-
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
56
|
-
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
51
|
+
'@stylistic/function-call-spacing': [ 'error', 'never' ],
|
|
52
|
+
'@stylistic/function-call-argument-newline': [ 'error', 'consistent' ],
|
|
57
53
|
'@stylistic/function-paren-newline': 'off',
|
|
58
|
-
'@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
|
|
59
|
-
'@stylistic/indent-binary-ops': ['error', indentSize],
|
|
54
|
+
'@stylistic/generator-star-spacing': [ 'error', { before: false, after: true } ],
|
|
55
|
+
'@stylistic/indent-binary-ops': [ 'error', indentSize ],
|
|
60
56
|
'@stylistic/implicit-arrow-linebreak': 'off',
|
|
61
57
|
'@stylistic/indent': [
|
|
62
58
|
'error',
|
|
@@ -98,7 +94,7 @@ export const stylisticRuleSet = {
|
|
|
98
94
|
after: true
|
|
99
95
|
}
|
|
100
96
|
],
|
|
101
|
-
'@stylistic/linebreak-style': ['error', 'unix'],
|
|
97
|
+
'@stylistic/linebreak-style': [ 'error', 'unix' ],
|
|
102
98
|
'@stylistic/lines-between-class-members': [
|
|
103
99
|
'error',
|
|
104
100
|
'always',
|
|
@@ -120,7 +116,7 @@ export const stylisticRuleSet = {
|
|
|
120
116
|
ignoreRegExpLiterals: true
|
|
121
117
|
}
|
|
122
118
|
],
|
|
123
|
-
'@stylistic/max-statements-per-line': ['error', { max: 1 }],
|
|
119
|
+
'@stylistic/max-statements-per-line': [ 'error', { max: 1 } ],
|
|
124
120
|
'@stylistic/member-delimiter-style': [
|
|
125
121
|
'error',
|
|
126
122
|
{
|
|
@@ -138,23 +134,22 @@ export const stylisticRuleSet = {
|
|
|
138
134
|
'@stylistic/new-parens': 'error',
|
|
139
135
|
'@stylistic/newline-per-chained-call': 'off',
|
|
140
136
|
'@stylistic/no-confusing-arrow': 'error',
|
|
141
|
-
|
|
142
|
-
'@stylistic/no-extra-parens': 'off',
|
|
137
|
+
'@stylistic/no-extra-parens': 'error',
|
|
143
138
|
'@stylistic/no-extra-semi': 'error',
|
|
144
139
|
'@stylistic/no-floating-decimal': 'error',
|
|
145
140
|
'@stylistic/no-mixed-operators': 'off',
|
|
146
141
|
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
147
142
|
'@stylistic/no-multi-spaces': 'error',
|
|
148
|
-
'@stylistic/no-multiple-empty-lines': ['error', { max: 1 }],
|
|
143
|
+
'@stylistic/no-multiple-empty-lines': [ 'error', { max: 1 } ],
|
|
149
144
|
'@stylistic/no-tabs': 'error',
|
|
150
145
|
'@stylistic/no-trailing-spaces': 'error',
|
|
151
146
|
'@stylistic/no-whitespace-before-property': 'error',
|
|
152
147
|
'@stylistic/nonblock-statement-body-position': 'off',
|
|
153
148
|
'@stylistic/object-curly-newline': 'off',
|
|
154
|
-
'@stylistic/object-curly-spacing': ['error', 'always'],
|
|
149
|
+
'@stylistic/object-curly-spacing': [ 'error', 'always' ],
|
|
155
150
|
'@stylistic/object-property-newline': 'off',
|
|
156
151
|
'@stylistic/one-var-declaration-per-line': 'error',
|
|
157
|
-
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
152
|
+
'@stylistic/operator-linebreak': [ 'error', 'after', { overrides: { '?': 'before', ':': 'before' } } ],
|
|
158
153
|
'@stylistic/padded-blocks': [
|
|
159
154
|
'error',
|
|
160
155
|
'never',
|
|
@@ -175,10 +170,10 @@ export const stylisticRuleSet = {
|
|
|
175
170
|
next: 'directive'
|
|
176
171
|
}
|
|
177
172
|
],
|
|
178
|
-
'@stylistic/quote-props': ['error', 'as-needed'],
|
|
179
|
-
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
180
|
-
'@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
181
|
-
'@stylistic/semi': ['error', 'always'],
|
|
173
|
+
'@stylistic/quote-props': [ 'error', 'as-needed' ],
|
|
174
|
+
'@stylistic/quotes': [ 'error', 'single', { avoidEscape: true } ],
|
|
175
|
+
'@stylistic/rest-spread-spacing': [ 'error', 'never' ],
|
|
176
|
+
'@stylistic/semi': [ 'error', 'always' ],
|
|
182
177
|
'@stylistic/semi-spacing': [
|
|
183
178
|
'error',
|
|
184
179
|
{
|
|
@@ -186,8 +181,8 @@ export const stylisticRuleSet = {
|
|
|
186
181
|
after: true
|
|
187
182
|
}
|
|
188
183
|
],
|
|
189
|
-
'@stylistic/semi-style': ['error', 'last'],
|
|
190
|
-
'@stylistic/space-before-blocks': ['error', 'always'],
|
|
184
|
+
'@stylistic/semi-style': [ 'error', 'last' ],
|
|
185
|
+
'@stylistic/space-before-blocks': [ 'error', 'always' ],
|
|
191
186
|
'@stylistic/space-before-function-paren': [
|
|
192
187
|
'error',
|
|
193
188
|
{
|
|
@@ -196,7 +191,7 @@ export const stylisticRuleSet = {
|
|
|
196
191
|
asyncArrow: 'always'
|
|
197
192
|
}
|
|
198
193
|
],
|
|
199
|
-
'@stylistic/space-in-parens': ['error', 'never'],
|
|
194
|
+
'@stylistic/space-in-parens': [ 'error', 'never' ],
|
|
200
195
|
'@stylistic/space-infix-ops': 'error',
|
|
201
196
|
'@stylistic/space-unary-ops': 'error',
|
|
202
197
|
'@stylistic/spaced-comment': [
|
|
@@ -204,12 +199,12 @@ export const stylisticRuleSet = {
|
|
|
204
199
|
'always',
|
|
205
200
|
{
|
|
206
201
|
line: {
|
|
207
|
-
exceptions: ['-', '+', '*'],
|
|
208
|
-
markers: ['!', '/', '=>']
|
|
202
|
+
exceptions: [ '-', '+', '*' ],
|
|
203
|
+
markers: [ '!', '/', '=>' ]
|
|
209
204
|
},
|
|
210
205
|
block: {
|
|
211
|
-
exceptions: ['-', '+', '*'],
|
|
212
|
-
markers: ['!', '*'],
|
|
206
|
+
exceptions: [ '-', '+', '*' ],
|
|
207
|
+
markers: [ '!', '*' ],
|
|
213
208
|
balanced: true
|
|
214
209
|
}
|
|
215
210
|
}
|
|
@@ -223,13 +218,13 @@ export const stylisticRuleSet = {
|
|
|
223
218
|
],
|
|
224
219
|
'@stylistic/curly-newline': 'off',
|
|
225
220
|
'@stylistic/template-curly-spacing': 'error',
|
|
226
|
-
'@stylistic/template-tag-spacing': ['error', 'never'],
|
|
221
|
+
'@stylistic/template-tag-spacing': [ 'error', 'never' ],
|
|
227
222
|
'@stylistic/type-annotation-spacing': 'error',
|
|
228
223
|
'@stylistic/type-generic-spacing': 'error',
|
|
229
224
|
'@stylistic/type-named-tuple-spacing': 'error',
|
|
230
|
-
'@stylistic/wrap-iife': ['error', 'inside'],
|
|
225
|
+
'@stylistic/wrap-iife': [ 'error', 'inside' ],
|
|
231
226
|
'@stylistic/wrap-regex': 'off',
|
|
232
|
-
'@stylistic/yield-star-spacing': ['error', { before: false, after: true }],
|
|
227
|
+
'@stylistic/yield-star-spacing': [ 'error', { before: false, after: true } ],
|
|
233
228
|
'@stylistic/jsx-pascal-case': 'off',
|
|
234
229
|
'@stylistic/line-comment-position': 'off',
|
|
235
230
|
'@stylistic/multiline-comment-style': 'off'
|
package/sbom.cdx.json
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
|
|
3
|
+
"bomFormat": "CycloneDX",
|
|
4
|
+
"specVersion": "1.6",
|
|
5
|
+
"version": 1,
|
|
6
|
+
"metadata": {
|
|
7
|
+
"tools": {
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"type": "application",
|
|
11
|
+
"name": "packtory",
|
|
12
|
+
"version": "0.0.15"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"component": {
|
|
17
|
+
"type": "library",
|
|
18
|
+
"name": "@enormora/eslint-config-base",
|
|
19
|
+
"version": "0.0.33",
|
|
20
|
+
"bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.33",
|
|
21
|
+
"purl": "pkg:npm/@enormora/eslint-config-base@0.0.33"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"components": [
|
|
25
|
+
{
|
|
26
|
+
"type": "library",
|
|
27
|
+
"name": "@ben_12/eslint-plugin-dprint",
|
|
28
|
+
"version": "1.19.0",
|
|
29
|
+
"bom-ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0",
|
|
30
|
+
"scope": "required",
|
|
31
|
+
"licenses": [
|
|
32
|
+
{
|
|
33
|
+
"expression": "MIT"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"purl": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "library",
|
|
40
|
+
"name": "@ben_12/eslint-simple-parser",
|
|
41
|
+
"version": "0.1.0",
|
|
42
|
+
"bom-ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
|
|
43
|
+
"scope": "required",
|
|
44
|
+
"licenses": [
|
|
45
|
+
{
|
|
46
|
+
"expression": "MIT"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"purl": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "library",
|
|
53
|
+
"name": "@cspell/eslint-plugin",
|
|
54
|
+
"version": "10.0.0",
|
|
55
|
+
"bom-ref": "pkg:npm/@cspell/eslint-plugin@10.0.0",
|
|
56
|
+
"scope": "required",
|
|
57
|
+
"licenses": [
|
|
58
|
+
{
|
|
59
|
+
"expression": "MIT"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"purl": "pkg:npm/@cspell/eslint-plugin@10.0.0"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "library",
|
|
66
|
+
"name": "@eslint-community/eslint-plugin-eslint-comments",
|
|
67
|
+
"version": "4.7.1",
|
|
68
|
+
"bom-ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1",
|
|
69
|
+
"scope": "required",
|
|
70
|
+
"licenses": [
|
|
71
|
+
{
|
|
72
|
+
"expression": "MIT"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"purl": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "library",
|
|
79
|
+
"name": "@stylistic/eslint-plugin",
|
|
80
|
+
"version": "5.10.0",
|
|
81
|
+
"bom-ref": "pkg:npm/@stylistic/eslint-plugin@5.10.0",
|
|
82
|
+
"scope": "required",
|
|
83
|
+
"licenses": [
|
|
84
|
+
{
|
|
85
|
+
"expression": "MIT"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"purl": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "library",
|
|
92
|
+
"name": "eslint-plugin-array-func",
|
|
93
|
+
"version": "5.1.1",
|
|
94
|
+
"bom-ref": "pkg:npm/eslint-plugin-array-func@5.1.1",
|
|
95
|
+
"scope": "required",
|
|
96
|
+
"licenses": [
|
|
97
|
+
{
|
|
98
|
+
"expression": "MIT"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"purl": "pkg:npm/eslint-plugin-array-func@5.1.1"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "library",
|
|
105
|
+
"name": "eslint-plugin-destructuring",
|
|
106
|
+
"version": "2.2.1",
|
|
107
|
+
"bom-ref": "pkg:npm/eslint-plugin-destructuring@2.2.1",
|
|
108
|
+
"scope": "required",
|
|
109
|
+
"licenses": [
|
|
110
|
+
{
|
|
111
|
+
"expression": "MIT"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"purl": "pkg:npm/eslint-plugin-destructuring@2.2.1"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "library",
|
|
118
|
+
"name": "eslint-plugin-import-x",
|
|
119
|
+
"version": "4.16.2",
|
|
120
|
+
"bom-ref": "pkg:npm/eslint-plugin-import-x@4.16.2",
|
|
121
|
+
"scope": "required",
|
|
122
|
+
"licenses": [
|
|
123
|
+
{
|
|
124
|
+
"expression": "MIT"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "library",
|
|
131
|
+
"name": "eslint-plugin-no-barrel-files",
|
|
132
|
+
"version": "1.3.1",
|
|
133
|
+
"bom-ref": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
|
|
134
|
+
"scope": "required",
|
|
135
|
+
"licenses": [
|
|
136
|
+
{
|
|
137
|
+
"expression": "ISC"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"purl": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "library",
|
|
144
|
+
"name": "eslint-plugin-no-secrets",
|
|
145
|
+
"version": "2.3.3",
|
|
146
|
+
"bom-ref": "pkg:npm/eslint-plugin-no-secrets@2.3.3",
|
|
147
|
+
"scope": "required",
|
|
148
|
+
"licenses": [
|
|
149
|
+
{
|
|
150
|
+
"expression": "MIT"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"purl": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"type": "library",
|
|
157
|
+
"name": "eslint-plugin-promise",
|
|
158
|
+
"version": "7.3.0",
|
|
159
|
+
"bom-ref": "pkg:npm/eslint-plugin-promise@7.3.0",
|
|
160
|
+
"scope": "required",
|
|
161
|
+
"licenses": [
|
|
162
|
+
{
|
|
163
|
+
"expression": "ISC"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"purl": "pkg:npm/eslint-plugin-promise@7.3.0"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"type": "library",
|
|
170
|
+
"name": "eslint-plugin-sonarjs",
|
|
171
|
+
"version": "4.0.3",
|
|
172
|
+
"bom-ref": "pkg:npm/eslint-plugin-sonarjs@4.0.3",
|
|
173
|
+
"scope": "required",
|
|
174
|
+
"licenses": [
|
|
175
|
+
{
|
|
176
|
+
"expression": "LGPL-3.0-only"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"purl": "pkg:npm/eslint-plugin-sonarjs@4.0.3"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "library",
|
|
183
|
+
"name": "eslint-plugin-unicorn",
|
|
184
|
+
"version": "64.0.0",
|
|
185
|
+
"bom-ref": "pkg:npm/eslint-plugin-unicorn@64.0.0",
|
|
186
|
+
"scope": "required",
|
|
187
|
+
"licenses": [
|
|
188
|
+
{
|
|
189
|
+
"expression": "MIT"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"purl": "pkg:npm/eslint-plugin-unicorn@64.0.0"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"type": "library",
|
|
196
|
+
"name": "eslint",
|
|
197
|
+
"version": "^10.0.0",
|
|
198
|
+
"bom-ref": "pkg:npm/eslint@%5E10.0.0",
|
|
199
|
+
"scope": "optional",
|
|
200
|
+
"licenses": [
|
|
201
|
+
{
|
|
202
|
+
"expression": "MIT"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"purl": "pkg:npm/eslint@%5E10.0.0"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"dependencies": [
|
|
209
|
+
{
|
|
210
|
+
"ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"ref": "pkg:npm/@cspell/eslint-plugin@10.0.0"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"ref": "pkg:npm/@enormora/eslint-config-base@0.0.33",
|
|
220
|
+
"dependsOn": [
|
|
221
|
+
"pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0",
|
|
222
|
+
"pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
|
|
223
|
+
"pkg:npm/@cspell/eslint-plugin@10.0.0",
|
|
224
|
+
"pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1",
|
|
225
|
+
"pkg:npm/@stylistic/eslint-plugin@5.10.0",
|
|
226
|
+
"pkg:npm/eslint-plugin-array-func@5.1.1",
|
|
227
|
+
"pkg:npm/eslint-plugin-destructuring@2.2.1",
|
|
228
|
+
"pkg:npm/eslint-plugin-import-x@4.16.2",
|
|
229
|
+
"pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
|
|
230
|
+
"pkg:npm/eslint-plugin-no-secrets@2.3.3",
|
|
231
|
+
"pkg:npm/eslint-plugin-promise@7.3.0",
|
|
232
|
+
"pkg:npm/eslint-plugin-sonarjs@4.0.3",
|
|
233
|
+
"pkg:npm/eslint-plugin-unicorn@64.0.0",
|
|
234
|
+
"pkg:npm/eslint@%5E10.0.0"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"ref": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"ref": "pkg:npm/eslint-plugin-array-func@5.1.1"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"ref": "pkg:npm/eslint-plugin-destructuring@2.2.1"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"ref": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"ref": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"ref": "pkg:npm/eslint-plugin-promise@7.3.0"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"ref": "pkg:npm/eslint-plugin-sonarjs@4.0.3"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"ref": "pkg:npm/eslint-plugin-unicorn@64.0.0"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"ref": "pkg:npm/eslint@%5E10.0.0"
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
}
|