@enormora/eslint-config-base-with-prettier 0.0.1
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/LICENSE +21 -0
- package/constants.js +3 -0
- package/package.json +43 -0
- package/presets/base/base-shared.js +453 -0
- package/presets/base-with-prettier/base-with-prettier.js +15 -0
- package/readme.md +42 -0
- package/rule-sets/best-practices.js +255 -0
- package/rule-sets/restricted-syntax.js +44 -0
- package/rule-sets/stylistic.js +232 -0
- package/sbom.cdx.json +254 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2023]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/constants.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Mathias Schreck <schreck.mathias@gmail.com>",
|
|
3
|
+
"contributors": [
|
|
4
|
+
"Christian Rackerseder <github@echooff.de>"
|
|
5
|
+
],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@cspell/eslint-plugin": "10.0.0",
|
|
8
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
|
|
9
|
+
"@stylistic/eslint-plugin": "5.10.0",
|
|
10
|
+
"eslint-plugin-array-func": "5.1.1",
|
|
11
|
+
"eslint-plugin-destructuring": "2.2.1",
|
|
12
|
+
"eslint-plugin-import-x": "4.16.2",
|
|
13
|
+
"eslint-plugin-no-barrel-files": "1.3.1",
|
|
14
|
+
"eslint-plugin-no-secrets": "2.3.3",
|
|
15
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
16
|
+
"eslint-plugin-promise": "7.3.0",
|
|
17
|
+
"eslint-plugin-sonarjs": "4.0.3",
|
|
18
|
+
"eslint-plugin-unicorn": "64.0.0"
|
|
19
|
+
},
|
|
20
|
+
"description": "Enormora’s ESLint base configuration formatted with prettier",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./presets/base-with-prettier/base-with-prettier.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"name": "@enormora/eslint-config-base-with-prettier",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"eslint": "^10.0.0"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git://github.com/enormora/eslint-config.git"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"./presets/base-with-prettier/base-with-prettier.js",
|
|
37
|
+
"./presets/base/base-shared.js",
|
|
38
|
+
"./rule-sets/best-practices.js",
|
|
39
|
+
"./rule-sets/restricted-syntax.js"
|
|
40
|
+
],
|
|
41
|
+
"type": "module",
|
|
42
|
+
"version": "0.0.1"
|
|
43
|
+
}
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import codeSpellChecker from '@cspell/eslint-plugin';
|
|
2
|
+
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
|
|
3
|
+
import importPlugin, { createNodeResolver } from 'eslint-plugin-import-x';
|
|
4
|
+
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
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
|
+
noSwitchStatementRestriction
|
|
12
|
+
} from '../../rule-sets/restricted-syntax.js';
|
|
13
|
+
import { stylisticRuleSet } from '../../rule-sets/stylistic.js';
|
|
14
|
+
|
|
15
|
+
const restrictedSyntaxPlugin = createRestrictedSyntaxPlugin([
|
|
16
|
+
'no-class-declaration',
|
|
17
|
+
'no-switch-statement',
|
|
18
|
+
'no-empty-function-body'
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export const baseSharedConfig = {
|
|
22
|
+
languageOptions: {
|
|
23
|
+
ecmaVersion,
|
|
24
|
+
sourceType: 'module',
|
|
25
|
+
parserOptions: {
|
|
26
|
+
ecmaVersion,
|
|
27
|
+
ecmaFeatures: {
|
|
28
|
+
jsx: false,
|
|
29
|
+
globalReturn: false,
|
|
30
|
+
impliedStrict: false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
linterOptions: {
|
|
35
|
+
noInlineConfig: false,
|
|
36
|
+
reportUnusedDisableDirectives: true
|
|
37
|
+
},
|
|
38
|
+
plugins: {
|
|
39
|
+
...stylisticRuleSet.plugins,
|
|
40
|
+
...bestPracticesRuleSet.plugins,
|
|
41
|
+
import: importPlugin,
|
|
42
|
+
'eslint-comments': eslintCommentsPlugin,
|
|
43
|
+
'no-secrets': noSecretsPlugin,
|
|
44
|
+
'@cspell': codeSpellChecker,
|
|
45
|
+
'restricted-syntax': restrictedSyntaxPlugin
|
|
46
|
+
},
|
|
47
|
+
settings: {
|
|
48
|
+
...stylisticRuleSet.settings,
|
|
49
|
+
...bestPracticesRuleSet.settings,
|
|
50
|
+
'import/parsers': {
|
|
51
|
+
espree: javascriptExtensions
|
|
52
|
+
},
|
|
53
|
+
'import-x/resolver-next': [ createNodeResolver() ]
|
|
54
|
+
},
|
|
55
|
+
rules: {
|
|
56
|
+
...stylisticRuleSet.rules,
|
|
57
|
+
...bestPracticesRuleSet.rules,
|
|
58
|
+
|
|
59
|
+
'array-callback-return': 'error',
|
|
60
|
+
camelcase: 'off',
|
|
61
|
+
'no-array-constructor': 'error',
|
|
62
|
+
'no-bitwise': 'error',
|
|
63
|
+
'no-caller': 'error',
|
|
64
|
+
'no-case-declarations': 'error',
|
|
65
|
+
'no-class-assign': 'error',
|
|
66
|
+
'no-cond-assign': 'error',
|
|
67
|
+
'no-console': 'error',
|
|
68
|
+
'no-const-assign': 'error',
|
|
69
|
+
'no-constant-condition': 'error',
|
|
70
|
+
'no-continue': 'error',
|
|
71
|
+
'no-control-regex': 'error',
|
|
72
|
+
'no-debugger': 'error',
|
|
73
|
+
'no-delete-var': 'error',
|
|
74
|
+
'no-div-regex': 'error',
|
|
75
|
+
'no-dupe-class-members': 'error',
|
|
76
|
+
'no-dupe-keys': 'error',
|
|
77
|
+
'no-dupe-args': 'error',
|
|
78
|
+
'no-duplicate-case': 'error',
|
|
79
|
+
'no-duplicate-imports': 'error',
|
|
80
|
+
'no-else-return': [ 'error', { allowElseIf: false } ],
|
|
81
|
+
'no-empty': [ 'error', { allowEmptyCatch: true } ],
|
|
82
|
+
'no-empty-character-class': 'error',
|
|
83
|
+
'no-empty-function': 'off',
|
|
84
|
+
'no-empty-pattern': 'error',
|
|
85
|
+
'no-empty-static-block': 'error',
|
|
86
|
+
'no-eq-null': 'error',
|
|
87
|
+
'no-eval': 'error',
|
|
88
|
+
'no-ex-assign': 'error',
|
|
89
|
+
'no-extend-native': 'error',
|
|
90
|
+
'no-extra-bind': 'error',
|
|
91
|
+
'no-extra-boolean-cast': 'error',
|
|
92
|
+
'no-extra-label': 'error',
|
|
93
|
+
'no-fallthrough': 'error',
|
|
94
|
+
'no-func-assign': 'error',
|
|
95
|
+
'no-implicit-coercion': 'error',
|
|
96
|
+
'no-implicit-globals': 'error',
|
|
97
|
+
'no-implied-eval': 'error',
|
|
98
|
+
'no-inline-comments': 'off',
|
|
99
|
+
'no-inner-declarations': [ 'error', 'functions' ],
|
|
100
|
+
'no-invalid-regexp': 'error',
|
|
101
|
+
'no-invalid-this': 'off',
|
|
102
|
+
'no-irregular-whitespace': 'error',
|
|
103
|
+
'no-iterator': 'error',
|
|
104
|
+
'no-label-var': 'error',
|
|
105
|
+
'no-labels': 'error',
|
|
106
|
+
'no-lone-blocks': 'error',
|
|
107
|
+
'no-lonely-if': 'error',
|
|
108
|
+
'no-loop-func': 'error',
|
|
109
|
+
'no-new-native-nonconstructor': 'error',
|
|
110
|
+
'no-multi-str': 'error',
|
|
111
|
+
'no-global-assign': 'error',
|
|
112
|
+
'no-negated-condition': 'off',
|
|
113
|
+
'no-nested-ternary': 'error',
|
|
114
|
+
'no-new': 'error',
|
|
115
|
+
'no-new-func': 'error',
|
|
116
|
+
'no-new-wrappers': 'error',
|
|
117
|
+
'no-obj-calls': 'error',
|
|
118
|
+
'no-object-constructor': 'error',
|
|
119
|
+
'no-octal': 'error',
|
|
120
|
+
'no-octal-escape': 'error',
|
|
121
|
+
'no-param-reassign': [ 'error', { props: true } ],
|
|
122
|
+
'no-plusplus': 'error',
|
|
123
|
+
'no-proto': 'error',
|
|
124
|
+
'no-prototype-builtins': 'error',
|
|
125
|
+
'no-redeclare': [ 'error', { builtinGlobals: true } ],
|
|
126
|
+
'no-regex-spaces': 'error',
|
|
127
|
+
'no-restricted-syntax': 'off',
|
|
128
|
+
'restricted-syntax/no-class-declaration': [ 'error', noClassDeclarationRestriction ],
|
|
129
|
+
'restricted-syntax/no-switch-statement': [ 'error', noSwitchStatementRestriction ],
|
|
130
|
+
'restricted-syntax/no-empty-function-body': [ 'error', noEmptyFunctionBodyRestriction ],
|
|
131
|
+
'no-return-assign': [ 'error', 'always' ],
|
|
132
|
+
'no-self-assign': [ 'error', { props: true } ],
|
|
133
|
+
'no-self-compare': 'error',
|
|
134
|
+
'no-sequences': 'error',
|
|
135
|
+
'no-shadow': [ 'error', { builtinGlobals: true } ],
|
|
136
|
+
'no-shadow-restricted-names': 'error',
|
|
137
|
+
'no-sparse-arrays': 'error',
|
|
138
|
+
'no-ternary': 'off',
|
|
139
|
+
'no-this-before-super': 'error',
|
|
140
|
+
'no-throw-literal': 'error',
|
|
141
|
+
'no-unassigned-vars': 'error',
|
|
142
|
+
'no-undef': [ 'error', { typeof: true } ],
|
|
143
|
+
'no-undef-init': 'error',
|
|
144
|
+
'no-undefined': 'off',
|
|
145
|
+
'no-unexpected-multiline': 'error',
|
|
146
|
+
'no-underscore-dangle': 'error',
|
|
147
|
+
'no-unmodified-loop-condition': 'error',
|
|
148
|
+
'no-unneeded-ternary': 'error',
|
|
149
|
+
'no-unreachable': 'error',
|
|
150
|
+
'no-unsafe-finally': 'error',
|
|
151
|
+
'no-unused-expressions': 'error',
|
|
152
|
+
'no-unused-labels': 'error',
|
|
153
|
+
'no-unused-vars': [
|
|
154
|
+
'error',
|
|
155
|
+
{
|
|
156
|
+
vars: 'all',
|
|
157
|
+
args: 'after-used',
|
|
158
|
+
ignoreRestSiblings: true,
|
|
159
|
+
argsIgnorePattern: '^_$',
|
|
160
|
+
caughtErrors: 'all',
|
|
161
|
+
caughtErrorsIgnorePattern: '^_$'
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
'no-use-before-define': 'error',
|
|
165
|
+
'no-useless-call': 'error',
|
|
166
|
+
'no-useless-computed-key': 'error',
|
|
167
|
+
'no-useless-concat': 'error',
|
|
168
|
+
'no-useless-constructor': 'error',
|
|
169
|
+
'no-useless-escape': 'error',
|
|
170
|
+
'no-useless-rename': 'error',
|
|
171
|
+
'no-void': 'error',
|
|
172
|
+
'prefer-const': [
|
|
173
|
+
'error',
|
|
174
|
+
{
|
|
175
|
+
destructuring: 'all'
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
'prefer-spread': 'error',
|
|
179
|
+
'prefer-template': 'error',
|
|
180
|
+
'preserve-caught-error': 'error',
|
|
181
|
+
'no-var': 'error',
|
|
182
|
+
'no-warning-comments': [
|
|
183
|
+
'error',
|
|
184
|
+
{
|
|
185
|
+
terms: [ 'todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8' ],
|
|
186
|
+
location: 'anywhere'
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
'no-with': 'error',
|
|
190
|
+
'no-magic-numbers': [
|
|
191
|
+
'error',
|
|
192
|
+
{
|
|
193
|
+
ignoreDefaultValues: true,
|
|
194
|
+
ignoreArrayIndexes: false,
|
|
195
|
+
detectObjects: false,
|
|
196
|
+
enforceConst: false,
|
|
197
|
+
ignoreClassFieldInitialValues: false,
|
|
198
|
+
ignore: [ -1, 0, 1 ]
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
'arrow-body-style': [ 'error', 'always' ],
|
|
202
|
+
'accessor-pairs': [
|
|
203
|
+
'error',
|
|
204
|
+
{
|
|
205
|
+
enforceForClassMembers: true
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
'block-scoped-var': 'off',
|
|
209
|
+
complexity: [ 'error', { max: 6 } ],
|
|
210
|
+
'consistent-return': 'error',
|
|
211
|
+
'consistent-this': [ 'error', 'self' ],
|
|
212
|
+
'constructor-super': 'error',
|
|
213
|
+
curly: [ 'error', 'all' ],
|
|
214
|
+
'default-case': 'error',
|
|
215
|
+
'dot-notation': 'error',
|
|
216
|
+
eqeqeq: 'error',
|
|
217
|
+
'func-names': 'off',
|
|
218
|
+
'func-style': 'off',
|
|
219
|
+
'guard-for-in': 'error',
|
|
220
|
+
'id-length': [ 'error', { min: 2, properties: 'never' } ],
|
|
221
|
+
'init-declarations': [ 'error', 'always' ],
|
|
222
|
+
'max-depth': [ 'error', { max: 5 } ],
|
|
223
|
+
'max-lines': [ 'error', { max: 500, skipBlankLines: true, skipComments: true } ],
|
|
224
|
+
'max-nested-callbacks': [ 'error', { max: 4 } ],
|
|
225
|
+
'max-params': [ 'error', { max: 4 } ],
|
|
226
|
+
'max-statements': [ 'error', { max: 10 } ],
|
|
227
|
+
'new-cap': [
|
|
228
|
+
'error',
|
|
229
|
+
{
|
|
230
|
+
newIsCap: true,
|
|
231
|
+
capIsNew: true
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
'object-shorthand': [ 'error', 'always' ],
|
|
235
|
+
'one-var': [ 'error', 'never' ],
|
|
236
|
+
'operator-assignment': [ 'error', 'always' ],
|
|
237
|
+
'prefer-arrow-callback': [
|
|
238
|
+
'error',
|
|
239
|
+
{
|
|
240
|
+
allowNamedFunctions: true
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
'prefer-rest-params': 'error',
|
|
244
|
+
radix: 'error',
|
|
245
|
+
'id-match': 'off',
|
|
246
|
+
'require-yield': 'error',
|
|
247
|
+
'sort-vars': 'off',
|
|
248
|
+
'sort-imports': 'off',
|
|
249
|
+
strict: [ 'error', 'safe' ],
|
|
250
|
+
'unicode-bom': [ 'error', 'never' ],
|
|
251
|
+
'use-isnan': 'error',
|
|
252
|
+
'valid-typeof': 'error',
|
|
253
|
+
'vars-on-top': 'error',
|
|
254
|
+
yoda: [ 'error', 'never' ],
|
|
255
|
+
'capitalized-comments': 'off',
|
|
256
|
+
'class-methods-use-this': 'error',
|
|
257
|
+
'func-name-matching': 'off',
|
|
258
|
+
'no-await-in-loop': 'off',
|
|
259
|
+
'no-compare-neg-zero': 'error',
|
|
260
|
+
'no-multi-assign': 'error',
|
|
261
|
+
'no-restricted-properties': 'off',
|
|
262
|
+
'no-template-curly-in-string': 'error',
|
|
263
|
+
'no-unsafe-negation': 'error',
|
|
264
|
+
'no-useless-return': 'error',
|
|
265
|
+
'prefer-destructuring': [
|
|
266
|
+
'error',
|
|
267
|
+
{
|
|
268
|
+
VariableDeclarator: {
|
|
269
|
+
array: false,
|
|
270
|
+
object: true
|
|
271
|
+
},
|
|
272
|
+
AssignmentExpression: {
|
|
273
|
+
array: false,
|
|
274
|
+
object: false
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
enforceForRenamedProperties: false
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
'prefer-numeric-literals': 'error',
|
|
282
|
+
'prefer-promise-reject-errors': [
|
|
283
|
+
'error',
|
|
284
|
+
{
|
|
285
|
+
allowEmptyReject: false
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
'require-await': 'off',
|
|
289
|
+
'sort-keys': 'off',
|
|
290
|
+
'symbol-description': 'error',
|
|
291
|
+
'for-direction': 'off',
|
|
292
|
+
'getter-return': [
|
|
293
|
+
'error',
|
|
294
|
+
{
|
|
295
|
+
allowImplicit: false
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
'max-classes-per-file': 'off',
|
|
299
|
+
'max-lines-per-function': 'off',
|
|
300
|
+
'prefer-object-spread': 'error',
|
|
301
|
+
'no-async-promise-executor': 'error',
|
|
302
|
+
'no-misleading-character-class': 'error',
|
|
303
|
+
'default-param-last': 'error',
|
|
304
|
+
'prefer-regex-literals': 'error',
|
|
305
|
+
'require-unicode-regexp': 'off',
|
|
306
|
+
'no-useless-catch': 'error',
|
|
307
|
+
'prefer-named-capture-group': 'error',
|
|
308
|
+
'no-import-assign': 'error',
|
|
309
|
+
'require-atomic-updates': 'error',
|
|
310
|
+
|
|
311
|
+
'no-restricted-imports': 'off',
|
|
312
|
+
|
|
313
|
+
'no-alert': 'off',
|
|
314
|
+
'no-script-url': 'off',
|
|
315
|
+
'no-restricted-globals': 'off',
|
|
316
|
+
|
|
317
|
+
'grouped-accessor-pairs': 'off',
|
|
318
|
+
'no-constructor-return': 'error',
|
|
319
|
+
'no-dupe-else-if': 'error',
|
|
320
|
+
'no-setter-return': 'error',
|
|
321
|
+
'prefer-exponentiation-operator': 'error',
|
|
322
|
+
|
|
323
|
+
'default-case-last': 'error',
|
|
324
|
+
'no-restricted-exports': 'off',
|
|
325
|
+
'no-useless-backreference': 'error',
|
|
326
|
+
'id-denylist': 'off',
|
|
327
|
+
'no-loss-of-precision': 'off',
|
|
328
|
+
'no-promise-executor-return': 'error',
|
|
329
|
+
'no-unreachable-loop': 'error',
|
|
330
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
331
|
+
'no-unsafe-optional-chaining': 'error',
|
|
332
|
+
'no-unused-private-class-members': 'error',
|
|
333
|
+
'no-constant-binary-expression': 'error',
|
|
334
|
+
'logical-assignment-operators': [ 'error', 'never' ],
|
|
335
|
+
'prefer-object-has-own': 'error',
|
|
336
|
+
'no-useless-assignment': 'error',
|
|
337
|
+
|
|
338
|
+
'no-secrets/no-secrets': [ 'error', { tolerance: 5 } ],
|
|
339
|
+
'no-secrets/no-pattern-match': 'off',
|
|
340
|
+
|
|
341
|
+
'eslint-comments/disable-enable-pair': [
|
|
342
|
+
'error',
|
|
343
|
+
{
|
|
344
|
+
allowWholeFile: true
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
'eslint-comments/no-aggregating-enable': 'error',
|
|
348
|
+
'eslint-comments/no-duplicate-disable': 'error',
|
|
349
|
+
'eslint-comments/no-unused-enable': 'error',
|
|
350
|
+
'eslint-comments/no-restricted-disable': 'off',
|
|
351
|
+
'eslint-comments/no-unlimited-disable': 'error',
|
|
352
|
+
'eslint-comments/no-use': 'off',
|
|
353
|
+
'eslint-comments/require-description': 'error',
|
|
354
|
+
|
|
355
|
+
'import/no-deprecated': 'error',
|
|
356
|
+
'import/exports-last': 'off',
|
|
357
|
+
'import/dynamic-import-chunkname': 'off',
|
|
358
|
+
'import/unambiguous': 'off',
|
|
359
|
+
'import/no-dynamic-require': 'error',
|
|
360
|
+
'import/no-named-export': 'off',
|
|
361
|
+
'import/no-default-export': 'error',
|
|
362
|
+
'import/prefer-default-export': 'off',
|
|
363
|
+
'import/newline-after-import': 'error',
|
|
364
|
+
'import/no-nodejs-modules': 'off',
|
|
365
|
+
'import/max-dependencies': [ 'error', { max: 10 } ],
|
|
366
|
+
'import/first': 'error',
|
|
367
|
+
'import/no-unused-modules': [ 'error', { unusedExports: true, suppressMissingFileEnumeratorAPIWarning: true } ],
|
|
368
|
+
'import/no-anonymous-default-export': 'off',
|
|
369
|
+
'import/no-named-default': 'off',
|
|
370
|
+
'import/no-cycle': 'error',
|
|
371
|
+
'import/no-relative-parent-imports': 'off',
|
|
372
|
+
'import/group-exports': 'off',
|
|
373
|
+
'import/no-internal-modules': 'off',
|
|
374
|
+
'import/no-restricted-paths': 'off',
|
|
375
|
+
'import/named': 'off',
|
|
376
|
+
'import/no-namespace': 'off',
|
|
377
|
+
'import/default': 'error',
|
|
378
|
+
'import/export': 'error',
|
|
379
|
+
'import/extensions': [
|
|
380
|
+
'error',
|
|
381
|
+
{
|
|
382
|
+
js: 'ignorePackages',
|
|
383
|
+
jsx: 'ignorePackages',
|
|
384
|
+
json: 'ignorePackages'
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
'import/namespace': [
|
|
388
|
+
'error',
|
|
389
|
+
{
|
|
390
|
+
allowComputed: true
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
'import/no-absolute-path': 'error',
|
|
394
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
395
|
+
'import/no-self-import': 'error',
|
|
396
|
+
'import/no-useless-path-segments': [
|
|
397
|
+
'error',
|
|
398
|
+
{
|
|
399
|
+
noUselessIndex: true
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
'import/no-amd': 'error',
|
|
403
|
+
'import/no-commonjs': 'error',
|
|
404
|
+
'import/no-duplicates': 'error',
|
|
405
|
+
'import/no-extraneous-dependencies': 'error',
|
|
406
|
+
'import/no-mutable-exports': 'error',
|
|
407
|
+
'import/no-named-as-default-member': 'error',
|
|
408
|
+
'import/no-named-as-default': 'error',
|
|
409
|
+
'import/order': 'error',
|
|
410
|
+
'import/no-unassigned-import': [
|
|
411
|
+
'error',
|
|
412
|
+
{
|
|
413
|
+
allow: []
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
// this rule doesn’t work correctly for ESM modules which use the exports field in package.json instead of main, see also https://github.com/import-js/eslint-plugin-import/issues/2703
|
|
417
|
+
'import/no-unresolved': 'off',
|
|
418
|
+
'import/no-relative-packages': 'off',
|
|
419
|
+
'import/no-import-module-exports': 'off',
|
|
420
|
+
'import/no-empty-named-blocks': 'error',
|
|
421
|
+
'import/consistent-type-specifier-style': 'off',
|
|
422
|
+
'import/no-rename-default': 'off',
|
|
423
|
+
'import/prefer-namespace-import': 'off',
|
|
424
|
+
|
|
425
|
+
'@cspell/spellchecker': [
|
|
426
|
+
'warn',
|
|
427
|
+
{
|
|
428
|
+
autoFix: false,
|
|
429
|
+
numSuggestions: 3,
|
|
430
|
+
generateSuggestions: true,
|
|
431
|
+
ignoreImports: true,
|
|
432
|
+
ignoreImportProperties: true,
|
|
433
|
+
checkIdentifiers: true,
|
|
434
|
+
checkStrings: true,
|
|
435
|
+
checkStringTemplates: true,
|
|
436
|
+
checkJSXText: true,
|
|
437
|
+
checkComments: true,
|
|
438
|
+
cspell: {
|
|
439
|
+
words: [],
|
|
440
|
+
ignoreWords: [],
|
|
441
|
+
flagWords: [],
|
|
442
|
+
ignoreRegExpList: [],
|
|
443
|
+
includeRegExpList: [],
|
|
444
|
+
allowCompoundWords: true,
|
|
445
|
+
import: [],
|
|
446
|
+
dictionaries: []
|
|
447
|
+
},
|
|
448
|
+
customWordListFile: undefined,
|
|
449
|
+
debugMode: false
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
2
|
+
import { baseSharedConfig } from '../base/base-shared.js';
|
|
3
|
+
|
|
4
|
+
export const baseWithPrettierConfig = {
|
|
5
|
+
...baseSharedConfig,
|
|
6
|
+
plugins: {
|
|
7
|
+
...baseSharedConfig.plugins,
|
|
8
|
+
prettier: prettierPlugin
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
...baseSharedConfig.rules,
|
|
12
|
+
|
|
13
|
+
'prettier/prettier': 'error'
|
|
14
|
+
}
|
|
15
|
+
};
|
package/readme.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# `@enormora/eslint-config-base-with-prettier`
|
|
2
|
+
|
|
3
|
+
Drop-in alternative to [`@enormora/eslint-config-base`](../base/base.md) that formats with
|
|
4
|
+
[prettier](https://prettier.io/) instead of dprint.
|
|
5
|
+
|
|
6
|
+
This preset is itself a base preset — pick this one **or** `@enormora/eslint-config-base`, never both. It contains the
|
|
7
|
+
same set of lint rules as the regular base preset; the only difference is the formatter integration.
|
|
8
|
+
|
|
9
|
+
## Install & Setup
|
|
10
|
+
|
|
11
|
+
Install the `@enormora/eslint-config-base-with-prettier` package together with prettier itself via npm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --save-dev @enormora/eslint-config-base-with-prettier prettier
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Provide a `prettier.config.js` at your project root with the formatting options you want (see the
|
|
18
|
+
[prettier configuration reference](https://prettier.io/docs/en/options.html)):
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
export default {
|
|
22
|
+
printWidth: 120,
|
|
23
|
+
tabWidth: 4,
|
|
24
|
+
singleQuote: true,
|
|
25
|
+
trailingComma: "none",
|
|
26
|
+
arrowParens: "always",
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Create an ESLint configuration file (e.g., `eslint.config.js`) in your project and add the preset to the configuration
|
|
31
|
+
array:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import { baseWithPrettierConfig } from "@enormora/eslint-config-base-with-prettier";
|
|
35
|
+
|
|
36
|
+
export default [
|
|
37
|
+
{
|
|
38
|
+
ignores: ["dist/**/*"],
|
|
39
|
+
},
|
|
40
|
+
baseWithPrettierConfig,
|
|
41
|
+
];
|
|
42
|
+
```
|