@frontify/eslint-config-basic 0.18.1 → 0.19.0-next.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/index.js +228 -28
- package/package.json +11 -8
package/index.js
CHANGED
|
@@ -1,29 +1,98 @@
|
|
|
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://typescript-eslint.io/rules/no-unused-vars/
|
|
63
|
+
'no-unused-vars': 'off',
|
|
64
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
65
|
+
|
|
66
|
+
// Allow overload of functions: https://typescript-eslint.io/rules/no-dupe-class-members/
|
|
67
|
+
'no-dupe-class-members': 'off',
|
|
68
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
69
|
+
|
|
70
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
71
|
+
'no-throw-literal': 'off',
|
|
72
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
73
|
+
'no-implied-eval': 'off',
|
|
74
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
75
|
+
'dot-notation': 'off',
|
|
76
|
+
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
77
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
78
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
79
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
80
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
81
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
82
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
83
|
+
'require-await': 'off',
|
|
84
|
+
'@typescript-eslint/require-await': 'error',
|
|
85
|
+
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
86
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
87
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
88
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
89
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
90
|
+
'warn',
|
|
91
|
+
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
|
|
92
|
+
],
|
|
93
|
+
'@typescript-eslint/no-misused-promises': [2, { checksVoidReturn: { attributes: false } }],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
27
96
|
{
|
|
28
97
|
files: ['*.json', '*.json5'],
|
|
29
98
|
parser: 'jsonc-eslint-parser',
|
|
@@ -100,9 +169,6 @@ module.exports = {
|
|
|
100
169
|
'pnpm',
|
|
101
170
|
'overrides',
|
|
102
171
|
'resolutions',
|
|
103
|
-
'husky',
|
|
104
|
-
'simple-git-hooks',
|
|
105
|
-
'lint-staged',
|
|
106
172
|
'eslintConfig',
|
|
107
173
|
],
|
|
108
174
|
},
|
|
@@ -118,9 +184,10 @@ module.exports = {
|
|
|
118
184
|
},
|
|
119
185
|
},
|
|
120
186
|
{
|
|
121
|
-
files: ['*.js'],
|
|
187
|
+
files: ['*.js', '*.cjs', '*.jsx'],
|
|
122
188
|
rules: {
|
|
123
189
|
'@typescript-eslint/no-var-requires': 'off',
|
|
190
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
124
191
|
},
|
|
125
192
|
},
|
|
126
193
|
{
|
|
@@ -130,20 +197,56 @@ module.exports = {
|
|
|
130
197
|
},
|
|
131
198
|
},
|
|
132
199
|
{
|
|
133
|
-
files: ['scripts/**/*.*'],
|
|
200
|
+
files: ['scripts/**/*.*', 'cli/**/*.*'],
|
|
134
201
|
rules: {
|
|
135
202
|
'no-console': 'off',
|
|
136
203
|
},
|
|
137
204
|
},
|
|
138
205
|
{
|
|
139
|
-
files: [
|
|
206
|
+
files: [
|
|
207
|
+
'*.test.ts',
|
|
208
|
+
'*.test.tsx',
|
|
209
|
+
'*.test.js',
|
|
210
|
+
'*.test.jsx',
|
|
211
|
+
'*.spec.ts',
|
|
212
|
+
'*.spec.tsx',
|
|
213
|
+
'*.spec.js',
|
|
214
|
+
'*.spec.jsx',
|
|
215
|
+
],
|
|
140
216
|
rules: {
|
|
141
217
|
'no-unused-expressions': 'off',
|
|
142
218
|
'no-only-tests/no-only-tests': 'error',
|
|
219
|
+
'@typescript-eslint/unbound-method': 'off', // Allows to use `vi.fn()` or spy/mock in tests
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
// Code blocks in markdown file
|
|
224
|
+
files: ['**/*.md/*.*'],
|
|
225
|
+
rules: {
|
|
226
|
+
'@typescript-eslint/no-redeclare': 'off',
|
|
227
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
228
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
229
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
230
|
+
'@typescript-eslint/comma-dangle': 'off',
|
|
231
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
232
|
+
'import/no-unresolved': 'off',
|
|
233
|
+
'unused-imports/no-unused-imports': 'off',
|
|
234
|
+
'unused-imports/no-unused-vars': 'off',
|
|
235
|
+
'no-alert': 'off',
|
|
236
|
+
'no-console': 'off',
|
|
237
|
+
'no-restricted-imports': 'off',
|
|
238
|
+
'no-unused-expressions': 'off',
|
|
239
|
+
'no-unused-vars': 'off',
|
|
143
240
|
},
|
|
144
241
|
},
|
|
145
242
|
],
|
|
146
243
|
rules: {
|
|
244
|
+
// Eslint prettier
|
|
245
|
+
'prettier/prettier': 'error',
|
|
246
|
+
'arrow-body-style': 'off', // Problematic with Prettier
|
|
247
|
+
'prefer-arrow-callback': 'off', // Problematic with Prettier
|
|
248
|
+
|
|
249
|
+
// Eslint (base)
|
|
147
250
|
'linebreak-style': ['error', 'unix'],
|
|
148
251
|
'prefer-template': 'error',
|
|
149
252
|
'template-curly-spacing': 'error',
|
|
@@ -160,6 +263,7 @@ module.exports = {
|
|
|
160
263
|
'vars-on-top': 'error',
|
|
161
264
|
'block-scoped-var': 'error',
|
|
162
265
|
'array-callback-return': 'error',
|
|
266
|
+
'no-use-before-define': 'off',
|
|
163
267
|
'object-shorthand': [
|
|
164
268
|
'error',
|
|
165
269
|
'always',
|
|
@@ -168,48 +272,144 @@ module.exports = {
|
|
|
168
272
|
avoidQuotes: true,
|
|
169
273
|
},
|
|
170
274
|
],
|
|
275
|
+
'no-case-declarations': 'error',
|
|
276
|
+
'no-multi-spaces': 'error',
|
|
277
|
+
'no-multi-str': 'error',
|
|
278
|
+
'no-with': 'error',
|
|
279
|
+
'no-void': 'error',
|
|
280
|
+
'no-useless-escape': 'off',
|
|
281
|
+
'no-invalid-this': 'error',
|
|
282
|
+
'require-await': 'off',
|
|
283
|
+
'no-return-assign': 'off',
|
|
284
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
285
|
+
'prefer-exponentiation-operator': 'error',
|
|
286
|
+
'prefer-rest-params': 'error',
|
|
287
|
+
'prefer-spread': 'error',
|
|
288
|
+
'generator-star-spacing': 'off',
|
|
289
|
+
'no-debugger': 'error',
|
|
290
|
+
'no-constant-condition': 'warn',
|
|
291
|
+
'object-curly-spacing': ['error', 'always'],
|
|
292
|
+
'prefer-const': [
|
|
293
|
+
'error',
|
|
294
|
+
{
|
|
295
|
+
destructuring: 'all',
|
|
296
|
+
ignoreReadBeforeAssign: true,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
'prefer-arrow-callback': [
|
|
300
|
+
'error',
|
|
301
|
+
{
|
|
302
|
+
allowNamedFunctions: false,
|
|
303
|
+
allowUnboundThis: true,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
'no-unreachable': 'error',
|
|
307
|
+
'no-unused-labels': 'error',
|
|
308
|
+
'no-useless-computed-key': 'error',
|
|
309
|
+
'no-useless-concat': 'error',
|
|
310
|
+
'no-useless-escape': 'error',
|
|
311
|
+
'no-useless-rename': [
|
|
312
|
+
'error',
|
|
313
|
+
{
|
|
314
|
+
ignoreDestructuring: false,
|
|
315
|
+
ignoreImport: false,
|
|
316
|
+
ignoreExport: false,
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
'no-with': 'error',
|
|
320
|
+
'no-whitespace-before-property': 'error',
|
|
321
|
+
'no-undef': 'off', // Doesn't works well with TypeScript
|
|
322
|
+
|
|
323
|
+
// Eslint Comments
|
|
324
|
+
'spaced-comment': [
|
|
325
|
+
'error',
|
|
326
|
+
'always',
|
|
327
|
+
{
|
|
328
|
+
line: {
|
|
329
|
+
markers: ['/'],
|
|
330
|
+
exceptions: ['/', '#'],
|
|
331
|
+
},
|
|
332
|
+
block: {
|
|
333
|
+
markers: ['!'],
|
|
334
|
+
exceptions: ['*'],
|
|
335
|
+
balanced: true,
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
|
|
340
|
+
// Eslint Import
|
|
341
|
+
'import/no-unresolved': 'off',
|
|
342
|
+
'import/no-internal-modules': 'off',
|
|
343
|
+
'import/no-relative-parent-imports': 'off',
|
|
344
|
+
'import/no-named-as-default': 'off',
|
|
345
|
+
'import/exports-last': 'off',
|
|
346
|
+
'import/no-namespace': 'off',
|
|
347
|
+
'import/extensions': 'off',
|
|
348
|
+
'import/order': [
|
|
349
|
+
'error',
|
|
350
|
+
{
|
|
351
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
352
|
+
'newlines-between': 'always',
|
|
353
|
+
},
|
|
354
|
+
],
|
|
355
|
+
'import/prefer-default-export': 'off',
|
|
356
|
+
'import/max-dependencies': 'off',
|
|
357
|
+
'import/no-unassigned-import': 'off',
|
|
358
|
+
'import/no-default-export': 'off',
|
|
359
|
+
'import/no-named-export': 'off',
|
|
360
|
+
'import/group-exports': 'off',
|
|
361
|
+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
362
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
171
363
|
|
|
364
|
+
// Unicorn
|
|
365
|
+
// Pass error message when throwing errors
|
|
172
366
|
'unicorn/error-message': 'error',
|
|
367
|
+
// Uppercase regex escapes
|
|
173
368
|
'unicorn/escape-case': 'error',
|
|
174
|
-
|
|
369
|
+
// Array.isArray instead of instanceof
|
|
370
|
+
'unicorn/no-instanceof-array': 'error',
|
|
371
|
+
// Prevent deprecated `new Buffer()`
|
|
175
372
|
'unicorn/no-new-buffer': 'error',
|
|
176
|
-
|
|
373
|
+
// Keep regex literals safe!
|
|
374
|
+
'unicorn/no-unsafe-regex': 'error',
|
|
375
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
177
376
|
'unicorn/number-literal-case': 'error',
|
|
178
|
-
|
|
377
|
+
// use find when possible
|
|
378
|
+
'unicorn/prefer-array-find': 'error',
|
|
379
|
+
// use default param instead of foo = foo || 'bar';
|
|
380
|
+
'unicorn/prefer-default-parameters': 'error',
|
|
381
|
+
// includes over indexOf when checking for existence
|
|
179
382
|
'unicorn/prefer-includes': 'error',
|
|
180
|
-
|
|
383
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
384
|
+
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
385
|
+
// Use replaceAll instead of replace with regex
|
|
386
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
387
|
+
// textContent instead of innerText
|
|
181
388
|
'unicorn/prefer-text-content': 'error',
|
|
389
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
182
390
|
'unicorn/prefer-type-error': 'error',
|
|
391
|
+
// Use new when throwing error
|
|
183
392
|
'unicorn/throw-new-error': 'error',
|
|
184
|
-
|
|
185
|
-
'unicorn/prefer-
|
|
186
|
-
'unicorn/prefer-array-find': 'error',
|
|
393
|
+
// Prefer using the `node:` protocol
|
|
394
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
187
395
|
'unicorn/no-array-for-each': 'error',
|
|
188
396
|
'unicorn/custom-error-definition': 'error',
|
|
189
397
|
'unicorn/better-regex': 'error',
|
|
190
398
|
'unicorn/explicit-length-check': 'error',
|
|
191
399
|
'unicorn/no-await-expression-member': 'error',
|
|
192
|
-
'unicorn/no-nested-ternary': '
|
|
400
|
+
'unicorn/no-nested-ternary': 'off', // Conflict with prettier
|
|
193
401
|
'unicorn/no-new-array': 'error',
|
|
194
402
|
'unicorn/no-this-assignment': 'error',
|
|
195
|
-
'unicorn/no-unsafe-regex': 'error',
|
|
196
403
|
'unicorn/no-useless-length-check': 'error',
|
|
197
404
|
'unicorn/catch-error-name': 'error',
|
|
198
405
|
|
|
199
|
-
|
|
406
|
+
// Eslint Promise
|
|
200
407
|
'promise/param-names': 'error',
|
|
201
408
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
{
|
|
205
|
-
ignoreCase: false,
|
|
206
|
-
ignoreDeclarationSort: true,
|
|
207
|
-
ignoreMemberSort: false,
|
|
208
|
-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
209
|
-
allowSeparatedGroups: false,
|
|
210
|
-
},
|
|
211
|
-
],
|
|
409
|
+
// Eslint Jsonc
|
|
410
|
+
'jsonc/no-dupe-keys': 'error',
|
|
212
411
|
|
|
412
|
+
// Eslint Lodash
|
|
213
413
|
'lodash/import-scope': [2, 'method'],
|
|
214
414
|
},
|
|
215
415
|
};
|
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.1",
|
|
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": {
|