@frontify/eslint-config-basic 0.18.1 → 0.19.0-next.0
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/index.js +223 -28
- package/package.json +11 -8
package/index.js
CHANGED
|
@@ -1,29 +1,94 @@
|
|
|
1
1
|
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
reportUnusedDisableDirectives: true,
|
|
4
5
|
env: {
|
|
5
6
|
es6: true,
|
|
6
7
|
browser: true,
|
|
7
8
|
node: true,
|
|
8
9
|
},
|
|
9
|
-
plugins: ['
|
|
10
|
+
plugins: ['@typescript-eslint', 'unicorn', 'no-only-tests', 'promise', 'lodash', 'prettier'],
|
|
10
11
|
extends: [
|
|
12
|
+
'eslint:recommended',
|
|
13
|
+
'plugin:eslint-comments/recommended',
|
|
11
14
|
'plugin:jsonc/recommended-with-jsonc',
|
|
12
15
|
'plugin:yml/standard',
|
|
13
16
|
'plugin:markdown/recommended',
|
|
14
|
-
'plugin:
|
|
17
|
+
'plugin:import/recommended',
|
|
18
|
+
'plugin:import/typescript',
|
|
19
|
+
'prettier',
|
|
15
20
|
],
|
|
16
21
|
ignorePatterns: [
|
|
22
|
+
'.next',
|
|
17
23
|
'*.min.*',
|
|
24
|
+
'*.d.ts',
|
|
25
|
+
'CHANGELOG.md',
|
|
18
26
|
'dist',
|
|
19
27
|
'LICENSE*',
|
|
28
|
+
'output',
|
|
29
|
+
'out',
|
|
20
30
|
'coverage',
|
|
31
|
+
'public',
|
|
21
32
|
'temp',
|
|
22
33
|
'package-lock.json',
|
|
23
34
|
'pnpm-lock.yaml',
|
|
24
35
|
'yarn.lock',
|
|
36
|
+
'__snapshots__',
|
|
25
37
|
],
|
|
38
|
+
parserOptions: {
|
|
39
|
+
project: true,
|
|
40
|
+
},
|
|
41
|
+
parser: '@typescript-eslint/parser',
|
|
42
|
+
settings: {
|
|
43
|
+
'import/resolver': {
|
|
44
|
+
typescript: true,
|
|
45
|
+
node: true,
|
|
46
|
+
},
|
|
47
|
+
'import/parsers': {
|
|
48
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
26
51
|
overrides: [
|
|
52
|
+
{
|
|
53
|
+
excludedFiles: ['**/*.md/*.*'],
|
|
54
|
+
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
|
|
55
|
+
parserOptions: {
|
|
56
|
+
project: true,
|
|
57
|
+
},
|
|
58
|
+
parser: '@typescript-eslint/parser',
|
|
59
|
+
rules: {
|
|
60
|
+
// As we're using @typescript-eslint it's recommended to turn off
|
|
61
|
+
// the standard eslint rule for unused variables and use the @typescript-eslint rule instead.
|
|
62
|
+
// See here: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
63
|
+
'no-unused-vars': 'off',
|
|
64
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
65
|
+
|
|
66
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
67
|
+
'no-throw-literal': 'off',
|
|
68
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
69
|
+
'no-implied-eval': 'off',
|
|
70
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
71
|
+
'dot-notation': 'off',
|
|
72
|
+
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
73
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
74
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
75
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
76
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
77
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
78
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
79
|
+
'require-await': 'off',
|
|
80
|
+
'@typescript-eslint/require-await': 'error',
|
|
81
|
+
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
82
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
83
|
+
'@typescript-eslint/unbound-method': 'error',
|
|
84
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
85
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
86
|
+
'warn',
|
|
87
|
+
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
|
|
88
|
+
],
|
|
89
|
+
'@typescript-eslint/no-misused-promises': [2, { checksVoidReturn: { attributes: false } }],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
27
92
|
{
|
|
28
93
|
files: ['*.json', '*.json5'],
|
|
29
94
|
parser: 'jsonc-eslint-parser',
|
|
@@ -100,9 +165,6 @@ module.exports = {
|
|
|
100
165
|
'pnpm',
|
|
101
166
|
'overrides',
|
|
102
167
|
'resolutions',
|
|
103
|
-
'husky',
|
|
104
|
-
'simple-git-hooks',
|
|
105
|
-
'lint-staged',
|
|
106
168
|
'eslintConfig',
|
|
107
169
|
],
|
|
108
170
|
},
|
|
@@ -118,9 +180,10 @@ module.exports = {
|
|
|
118
180
|
},
|
|
119
181
|
},
|
|
120
182
|
{
|
|
121
|
-
files: ['*.js'],
|
|
183
|
+
files: ['*.js', '*.cjs', '*.jsx'],
|
|
122
184
|
rules: {
|
|
123
185
|
'@typescript-eslint/no-var-requires': 'off',
|
|
186
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
124
187
|
},
|
|
125
188
|
},
|
|
126
189
|
{
|
|
@@ -130,20 +193,55 @@ module.exports = {
|
|
|
130
193
|
},
|
|
131
194
|
},
|
|
132
195
|
{
|
|
133
|
-
files: ['scripts/**/*.*'],
|
|
196
|
+
files: ['scripts/**/*.*', 'cli/**/*.*'],
|
|
134
197
|
rules: {
|
|
135
198
|
'no-console': 'off',
|
|
136
199
|
},
|
|
137
200
|
},
|
|
138
201
|
{
|
|
139
|
-
files: [
|
|
202
|
+
files: [
|
|
203
|
+
'*.test.ts',
|
|
204
|
+
'*.test.tsx',
|
|
205
|
+
'*.test.js',
|
|
206
|
+
'*.test.jsx',
|
|
207
|
+
'*.spec.ts',
|
|
208
|
+
'*.spec.tsx',
|
|
209
|
+
'*.spec.js',
|
|
210
|
+
'*.spec.jsx',
|
|
211
|
+
],
|
|
140
212
|
rules: {
|
|
141
213
|
'no-unused-expressions': 'off',
|
|
142
214
|
'no-only-tests/no-only-tests': 'error',
|
|
143
215
|
},
|
|
144
216
|
},
|
|
217
|
+
{
|
|
218
|
+
// Code blocks in markdown file
|
|
219
|
+
files: ['**/*.md/*.*'],
|
|
220
|
+
rules: {
|
|
221
|
+
'@typescript-eslint/no-redeclare': 'off',
|
|
222
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
223
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
224
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
225
|
+
'@typescript-eslint/comma-dangle': 'off',
|
|
226
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
227
|
+
'import/no-unresolved': 'off',
|
|
228
|
+
'unused-imports/no-unused-imports': 'off',
|
|
229
|
+
'unused-imports/no-unused-vars': 'off',
|
|
230
|
+
'no-alert': 'off',
|
|
231
|
+
'no-console': 'off',
|
|
232
|
+
'no-restricted-imports': 'off',
|
|
233
|
+
'no-unused-expressions': 'off',
|
|
234
|
+
'no-unused-vars': 'off',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
145
237
|
],
|
|
146
238
|
rules: {
|
|
239
|
+
// Eslint prettier
|
|
240
|
+
'prettier/prettier': 'error',
|
|
241
|
+
'arrow-body-style': 'off', // Problematic with Prettier
|
|
242
|
+
'prefer-arrow-callback': 'off', // Problematic with Prettier
|
|
243
|
+
|
|
244
|
+
// Eslint (base)
|
|
147
245
|
'linebreak-style': ['error', 'unix'],
|
|
148
246
|
'prefer-template': 'error',
|
|
149
247
|
'template-curly-spacing': 'error',
|
|
@@ -160,6 +258,7 @@ module.exports = {
|
|
|
160
258
|
'vars-on-top': 'error',
|
|
161
259
|
'block-scoped-var': 'error',
|
|
162
260
|
'array-callback-return': 'error',
|
|
261
|
+
'no-use-before-define': 'off',
|
|
163
262
|
'object-shorthand': [
|
|
164
263
|
'error',
|
|
165
264
|
'always',
|
|
@@ -168,48 +267,144 @@ module.exports = {
|
|
|
168
267
|
avoidQuotes: true,
|
|
169
268
|
},
|
|
170
269
|
],
|
|
270
|
+
'no-case-declarations': 'error',
|
|
271
|
+
'no-multi-spaces': 'error',
|
|
272
|
+
'no-multi-str': 'error',
|
|
273
|
+
'no-with': 'error',
|
|
274
|
+
'no-void': 'error',
|
|
275
|
+
'no-useless-escape': 'off',
|
|
276
|
+
'no-invalid-this': 'error',
|
|
277
|
+
'require-await': 'off',
|
|
278
|
+
'no-return-assign': 'off',
|
|
279
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
280
|
+
'prefer-exponentiation-operator': 'error',
|
|
281
|
+
'prefer-rest-params': 'error',
|
|
282
|
+
'prefer-spread': 'error',
|
|
283
|
+
'generator-star-spacing': 'off',
|
|
284
|
+
'no-debugger': 'error',
|
|
285
|
+
'no-constant-condition': 'warn',
|
|
286
|
+
'object-curly-spacing': ['error', 'always'],
|
|
287
|
+
'prefer-const': [
|
|
288
|
+
'error',
|
|
289
|
+
{
|
|
290
|
+
destructuring: 'all',
|
|
291
|
+
ignoreReadBeforeAssign: true,
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
'prefer-arrow-callback': [
|
|
295
|
+
'error',
|
|
296
|
+
{
|
|
297
|
+
allowNamedFunctions: false,
|
|
298
|
+
allowUnboundThis: true,
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
'no-unreachable': 'error',
|
|
302
|
+
'no-unused-labels': 'error',
|
|
303
|
+
'no-useless-computed-key': 'error',
|
|
304
|
+
'no-useless-concat': 'error',
|
|
305
|
+
'no-useless-escape': 'error',
|
|
306
|
+
'no-useless-rename': [
|
|
307
|
+
'error',
|
|
308
|
+
{
|
|
309
|
+
ignoreDestructuring: false,
|
|
310
|
+
ignoreImport: false,
|
|
311
|
+
ignoreExport: false,
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
'no-with': 'error',
|
|
315
|
+
'no-whitespace-before-property': 'error',
|
|
316
|
+
'no-undef': 'off', // Doesn't works well with TypeScript
|
|
317
|
+
|
|
318
|
+
// Eslint Comments
|
|
319
|
+
'spaced-comment': [
|
|
320
|
+
'error',
|
|
321
|
+
'always',
|
|
322
|
+
{
|
|
323
|
+
line: {
|
|
324
|
+
markers: ['/'],
|
|
325
|
+
exceptions: ['/', '#'],
|
|
326
|
+
},
|
|
327
|
+
block: {
|
|
328
|
+
markers: ['!'],
|
|
329
|
+
exceptions: ['*'],
|
|
330
|
+
balanced: true,
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
],
|
|
171
334
|
|
|
335
|
+
// Eslint Import
|
|
336
|
+
'import/no-unresolved': 'off',
|
|
337
|
+
'import/no-internal-modules': 'off',
|
|
338
|
+
'import/no-relative-parent-imports': 'off',
|
|
339
|
+
'import/no-named-as-default': 'off',
|
|
340
|
+
'import/exports-last': 'off',
|
|
341
|
+
'import/no-namespace': 'off',
|
|
342
|
+
'import/extensions': 'off',
|
|
343
|
+
'import/order': [
|
|
344
|
+
'error',
|
|
345
|
+
{
|
|
346
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
347
|
+
'newlines-between': 'always',
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
'import/prefer-default-export': 'off',
|
|
351
|
+
'import/max-dependencies': 'off',
|
|
352
|
+
'import/no-unassigned-import': 'off',
|
|
353
|
+
'import/no-default-export': 'off',
|
|
354
|
+
'import/no-named-export': 'off',
|
|
355
|
+
'import/group-exports': 'off',
|
|
356
|
+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
357
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
358
|
+
|
|
359
|
+
// Unicorn
|
|
360
|
+
// Pass error message when throwing errors
|
|
172
361
|
'unicorn/error-message': 'error',
|
|
362
|
+
// Uppercase regex escapes
|
|
173
363
|
'unicorn/escape-case': 'error',
|
|
174
|
-
|
|
364
|
+
// Array.isArray instead of instanceof
|
|
365
|
+
'unicorn/no-instanceof-array': 'error',
|
|
366
|
+
// Prevent deprecated `new Buffer()`
|
|
175
367
|
'unicorn/no-new-buffer': 'error',
|
|
176
|
-
|
|
368
|
+
// Keep regex literals safe!
|
|
369
|
+
'unicorn/no-unsafe-regex': 'error',
|
|
370
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
177
371
|
'unicorn/number-literal-case': 'error',
|
|
178
|
-
|
|
372
|
+
// use find when possible
|
|
373
|
+
'unicorn/prefer-array-find': 'error',
|
|
374
|
+
// use default param instead of foo = foo || 'bar';
|
|
375
|
+
'unicorn/prefer-default-parameters': 'error',
|
|
376
|
+
// includes over indexOf when checking for existence
|
|
179
377
|
'unicorn/prefer-includes': 'error',
|
|
180
|
-
|
|
378
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
379
|
+
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
380
|
+
// Use replaceAll instead of replace with regex
|
|
381
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
382
|
+
// textContent instead of innerText
|
|
181
383
|
'unicorn/prefer-text-content': 'error',
|
|
384
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
182
385
|
'unicorn/prefer-type-error': 'error',
|
|
386
|
+
// Use new when throwing error
|
|
183
387
|
'unicorn/throw-new-error': 'error',
|
|
184
|
-
|
|
185
|
-
'unicorn/prefer-
|
|
186
|
-
'unicorn/prefer-array-find': 'error',
|
|
388
|
+
// Prefer using the `node:` protocol
|
|
389
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
187
390
|
'unicorn/no-array-for-each': 'error',
|
|
188
391
|
'unicorn/custom-error-definition': 'error',
|
|
189
392
|
'unicorn/better-regex': 'error',
|
|
190
393
|
'unicorn/explicit-length-check': 'error',
|
|
191
394
|
'unicorn/no-await-expression-member': 'error',
|
|
192
|
-
'unicorn/no-nested-ternary': '
|
|
395
|
+
'unicorn/no-nested-ternary': 'off', // Conflict with prettier
|
|
193
396
|
'unicorn/no-new-array': 'error',
|
|
194
397
|
'unicorn/no-this-assignment': 'error',
|
|
195
|
-
'unicorn/no-unsafe-regex': 'error',
|
|
196
398
|
'unicorn/no-useless-length-check': 'error',
|
|
197
399
|
'unicorn/catch-error-name': 'error',
|
|
198
400
|
|
|
199
|
-
|
|
401
|
+
// Eslint Promise
|
|
200
402
|
'promise/param-names': 'error',
|
|
201
403
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
{
|
|
205
|
-
ignoreCase: false,
|
|
206
|
-
ignoreDeclarationSort: true,
|
|
207
|
-
ignoreMemberSort: false,
|
|
208
|
-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
209
|
-
allowSeparatedGroups: false,
|
|
210
|
-
},
|
|
211
|
-
],
|
|
404
|
+
// Eslint Jsonc
|
|
405
|
+
'jsonc/no-dupe-keys': 'error',
|
|
212
406
|
|
|
407
|
+
// Eslint Lodash
|
|
213
408
|
'lodash/import-scope': [2, 'method'],
|
|
214
409
|
},
|
|
215
410
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontify/eslint-config-basic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-next.0",
|
|
4
4
|
"author": "Frontify Developers <developers@frontify.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,21 +20,24 @@
|
|
|
20
20
|
"prettier": ">=3.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
24
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
23
25
|
"eslint-config-prettier": "^9.0.0",
|
|
24
|
-
"eslint-
|
|
25
|
-
"eslint-plugin-
|
|
26
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
27
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
28
|
+
"eslint-plugin-import": "^2.29.0",
|
|
29
|
+
"eslint-plugin-jsonc": "^2.10.0",
|
|
26
30
|
"eslint-plugin-lodash": "^7.4.0",
|
|
27
31
|
"eslint-plugin-markdown": "^3.0.1",
|
|
28
32
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
29
|
-
"eslint-plugin-
|
|
30
|
-
"eslint-plugin-prettier": "^5.0.0",
|
|
33
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
31
34
|
"eslint-plugin-promise": "^6.1.1",
|
|
32
|
-
"eslint-plugin-unicorn": "^
|
|
33
|
-
"eslint-plugin-yml": "^1.
|
|
35
|
+
"eslint-plugin-unicorn": "^49.0.0",
|
|
36
|
+
"eslint-plugin-yml": "^1.10.0",
|
|
34
37
|
"yaml-eslint-parser": "^1.2.2"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
37
|
-
"eslint": "^8.
|
|
40
|
+
"eslint": "^8.53.0",
|
|
38
41
|
"prettier": "^3.0.3"
|
|
39
42
|
},
|
|
40
43
|
"scripts": {
|