@flarian/frontend-preset 1.6.1 → 2.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.
Files changed (89) hide show
  1. package/README.md +269 -129
  2. package/dist/eslint/config/imports.cjs +8 -3
  3. package/dist/eslint/config/imports.d.cts +5 -3
  4. package/dist/eslint/config/imports.d.mts +5 -3
  5. package/dist/eslint/config/imports.d.ts +5 -3
  6. package/dist/eslint/config/imports.mjs +7 -3
  7. package/dist/eslint/config/javascript.cjs +72 -0
  8. package/dist/eslint/config/javascript.d.cts +7 -0
  9. package/dist/eslint/config/javascript.d.mts +7 -0
  10. package/dist/eslint/config/javascript.d.ts +7 -0
  11. package/dist/eslint/config/javascript.mjs +64 -0
  12. package/dist/eslint/config/json.cjs +31 -9
  13. package/dist/eslint/config/json.d.cts +12 -3
  14. package/dist/eslint/config/json.d.mts +12 -3
  15. package/dist/eslint/config/json.d.ts +12 -3
  16. package/dist/eslint/config/json.mjs +26 -9
  17. package/dist/eslint/config/jsx.cjs +34 -20
  18. package/dist/eslint/config/jsx.d.cts +5 -3
  19. package/dist/eslint/config/jsx.d.mts +5 -3
  20. package/dist/eslint/config/jsx.d.ts +5 -3
  21. package/dist/eslint/config/jsx.mjs +33 -20
  22. package/dist/eslint/config/prettier.cjs +50 -11
  23. package/dist/eslint/config/prettier.d.cts +5 -3
  24. package/dist/eslint/config/prettier.d.mts +5 -3
  25. package/dist/eslint/config/prettier.d.ts +5 -3
  26. package/dist/eslint/config/prettier.mjs +46 -9
  27. package/dist/eslint/config/react.cjs +12 -7
  28. package/dist/eslint/config/react.d.cts +5 -3
  29. package/dist/eslint/config/react.d.mts +5 -3
  30. package/dist/eslint/config/react.d.ts +5 -3
  31. package/dist/eslint/config/react.mjs +11 -7
  32. package/dist/eslint/config/{base.cjs → stylistic.cjs} +292 -186
  33. package/dist/eslint/config/stylistic.d.cts +7 -0
  34. package/dist/eslint/config/stylistic.d.mts +7 -0
  35. package/dist/eslint/config/stylistic.d.ts +7 -0
  36. package/dist/eslint/config/{base.mjs → stylistic.mjs} +291 -182
  37. package/dist/eslint/config/typescript.cjs +43 -0
  38. package/dist/eslint/config/typescript.d.cts +7 -0
  39. package/dist/eslint/config/typescript.d.mts +7 -0
  40. package/dist/eslint/config/typescript.d.ts +7 -0
  41. package/dist/eslint/config/typescript.mjs +36 -0
  42. package/dist/eslint/config/vue.cjs +24 -13
  43. package/dist/eslint/config/vue.d.cts +5 -6
  44. package/dist/eslint/config/vue.d.mts +5 -6
  45. package/dist/eslint/config/vue.d.ts +5 -6
  46. package/dist/eslint/config/vue.mjs +23 -13
  47. package/dist/eslint/index.cjs +37 -21
  48. package/dist/eslint/index.d.cts +10 -8
  49. package/dist/eslint/index.d.mts +10 -8
  50. package/dist/eslint/index.d.ts +10 -8
  51. package/dist/eslint/index.mjs +19 -14
  52. package/dist/index.cjs +13 -12
  53. package/dist/index.d.cts +9 -7
  54. package/dist/index.d.mts +9 -7
  55. package/dist/index.d.ts +9 -7
  56. package/dist/index.mjs +13 -12
  57. package/dist/prettier/config/base.cjs +1 -1
  58. package/dist/prettier/config/base.mjs +1 -1
  59. package/dist/shared/frontend-preset.B9JjGTzu.d.mts +60 -0
  60. package/dist/shared/frontend-preset.BUXYewoh.d.ts +60 -0
  61. package/dist/shared/frontend-preset.CADA8VXw.mjs +37 -0
  62. package/dist/shared/frontend-preset.Cco7BHYd.cjs +5 -0
  63. package/dist/shared/frontend-preset.CnYH3mAs.d.cts +60 -0
  64. package/dist/shared/frontend-preset.CtslHPdG.mjs +3 -0
  65. package/dist/shared/frontend-preset.DEAWyl_Y.d.cts +8 -0
  66. package/dist/shared/frontend-preset.DEAWyl_Y.d.mts +8 -0
  67. package/dist/shared/frontend-preset.DEAWyl_Y.d.ts +8 -0
  68. package/dist/shared/frontend-preset.GULoLGRF.cjs +39 -0
  69. package/dist/stylelint/config/all.d.cts +4 -2
  70. package/dist/stylelint/config/all.d.mts +4 -2
  71. package/dist/stylelint/config/all.d.ts +4 -2
  72. package/dist/stylelint/config/less.cjs +5 -1
  73. package/dist/stylelint/config/less.mjs +5 -1
  74. package/dist/stylelint/config/scss.cjs +5 -1
  75. package/dist/stylelint/config/scss.mjs +5 -1
  76. package/package.json +78 -28
  77. package/dist/eslint/config/all.cjs +0 -36
  78. package/dist/eslint/config/all.d.cts +0 -14
  79. package/dist/eslint/config/all.d.mts +0 -14
  80. package/dist/eslint/config/all.d.ts +0 -14
  81. package/dist/eslint/config/all.mjs +0 -33
  82. package/dist/eslint/config/base.d.cts +0 -8
  83. package/dist/eslint/config/base.d.mts +0 -8
  84. package/dist/eslint/config/base.d.ts +0 -8
  85. package/dist/shared/frontend-preset.BXVU99PK.d.mts +0 -37
  86. package/dist/shared/frontend-preset.Bfc_XKcp.d.cts +0 -37
  87. package/dist/shared/frontend-preset.CbViwkJz.cjs +0 -27
  88. package/dist/shared/frontend-preset.CiCuZ-UD.d.ts +0 -37
  89. package/dist/shared/frontend-preset.DbH8phB0.mjs +0 -25
@@ -1,65 +1,7 @@
1
- import globals from 'globals';
2
- import tsPlugin from 'typescript-eslint';
3
- import jsPlugin from '@eslint/js';
1
+ import { s as stripPlugins } from '../../shared/frontend-preset.CtslHPdG.mjs';
4
2
  import stylisticJs from '@stylistic/eslint-plugin';
5
3
 
6
- const esLintJavaScriptRules = {
7
- files: ["**/*.{js,ts,jsx,tsx,cjs,mjs,vue}"],
8
- rules: {
9
- "arrow-body-style": ["error", "as-needed"],
10
- curly: "error",
11
- "func-names": ["error", "always"],
12
- "no-undef": "off",
13
- "no-alert": "error",
14
- "no-console": "error",
15
- "no-var": "error",
16
- "no-duplicate-imports": [
17
- "error",
18
- {
19
- includeExports: true
20
- }
21
- ],
22
- "no-magic-numbers": [
23
- "error",
24
- {
25
- ignore: [-1, 0, 1],
26
- ignoreArrayIndexes: true,
27
- ignoreDefaultValues: true,
28
- enforceConst: true
29
- }
30
- ],
31
- "no-plusplus": [
32
- "error",
33
- {
34
- allowForLoopAfterthoughts: true
35
- }
36
- ],
37
- "no-restricted-syntax": [
38
- "error",
39
- {
40
- selector: "ForInStatement",
41
- message: "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
42
- },
43
- {
44
- selector: "LabeledStatement",
45
- message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
46
- },
47
- {
48
- selector: "WithStatement",
49
- message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
50
- }
51
- ],
52
- "no-unused-expressions": [
53
- "error",
54
- {
55
- allowShortCircuit: true
56
- }
57
- ]
58
- }
59
- };
60
-
61
4
  const esLintStylisticRules = {
62
- files: ["**/*.{js,ts,jsx,tsx,cjs,mjs,vue}"],
63
5
  plugins: {
64
6
  "@stylistic": stylisticJs
65
7
  },
@@ -68,7 +10,7 @@ const esLintStylisticRules = {
68
10
  * Принудительно вводить переносы строк после открытия и перед закрытием скобок массива
69
11
  * https://eslint.style/rules/default/array-bracket-newline
70
12
  */
71
- "@stylistic/array-bracket-newline": ["warn", { multiline: true, minItems: 4 }],
13
+ "@stylistic/array-bracket-newline": ["warn", "consistent"],
72
14
  /**
73
15
  * Обеспечить единообразие интервалов внутри скобок массива
74
16
  * https://eslint.style/rules/default/array-bracket-spacing
@@ -78,17 +20,23 @@ const esLintStylisticRules = {
78
20
  * Принудительно вставлять переносы строк после каждого элемента массива
79
21
  * https://eslint.style/rules/default/array-element-newline
80
22
  */
81
- "@stylistic/array-element-newline": ["warn", { consistent: true, multiline: true, minItems: 4 }],
23
+ "@stylistic/array-element-newline": ["warn", "consistent"],
82
24
  /**
83
25
  * Требуйте заключения аргументов стрелочной функции в скобки
84
26
  * https://eslint.style/rules/default/arrow-parens
85
27
  */
86
- "@stylistic/arrow-parens": ["off"],
28
+ "@stylistic/arrow-parens": ["warn", "as-needed"],
87
29
  /**
88
30
  * Обеспечить одинаковый интервал до и после стрелки в стрелочных функциях
89
31
  * https://eslint.style/rules/default/arrow-spacing
90
32
  */
91
- "@stylistic/arrow-spacing": ["warn", { before: true, after: true }],
33
+ "@stylistic/arrow-spacing": [
34
+ "warn",
35
+ {
36
+ before: true,
37
+ after: true
38
+ }
39
+ ],
92
40
  /**
93
41
  * Запрещать или принудительно вводить пробелы внутри блоков после открытия блока и перед закрытием блока
94
42
  * https://eslint.style/rules/default/block-spacing
@@ -108,18 +56,27 @@ const esLintStylisticRules = {
108
56
  {
109
57
  arrays: "always-multiline",
110
58
  objects: "always-multiline",
111
- imports: "never",
112
- exports: "never",
113
- functions: "never",
114
- importAttributes: "never",
115
- dynamicImports: "never"
59
+ imports: "always-multiline",
60
+ exports: "always-multiline",
61
+ functions: "only-multiline",
62
+ importAttributes: "always-multiline",
63
+ dynamicImports: "always-multiline",
64
+ enums: "always-multiline",
65
+ generics: "only-multiline",
66
+ tuples: "always-multiline"
116
67
  }
117
68
  ],
118
69
  /**
119
70
  * Обеспечьте одинаковый интервал до и после запятых
120
71
  * https://eslint.style/rules/default/comma-spacing
121
72
  */
122
- "@stylistic/comma-spacing": ["warn", { before: false, after: true }],
73
+ "@stylistic/comma-spacing": [
74
+ "warn",
75
+ {
76
+ before: false,
77
+ after: true
78
+ }
79
+ ],
123
80
  /**
124
81
  * Обеспечить единообразие стиля запятых
125
82
  * https://eslint.style/rules/default/comma-style
@@ -164,7 +121,13 @@ const esLintStylisticRules = {
164
121
  * Обеспечить единообразие интервалов вокруг операторов `*` в функциях генератора
165
122
  * https://eslint.style/rules/default/generator-star-spacing
166
123
  */
167
- "@stylistic/generator-star-spacing": ["warn", { before: true, after: false }],
124
+ "@stylistic/generator-star-spacing": [
125
+ "warn",
126
+ {
127
+ before: false,
128
+ after: true
129
+ }
130
+ ],
168
131
  /**
169
132
  * Обеспечить расположение тел стрелочных функций
170
133
  * https://eslint.style/rules/default/implicit-arrow-linebreak
@@ -184,12 +147,24 @@ const esLintStylisticRules = {
184
147
  * Обеспечьте соблюдение единообразных интервалов между именами свойств и аннотациями типов в типах и интерфейсах.
185
148
  * https://eslint.style/rules/default/key-spacing
186
149
  */
187
- "@stylistic/key-spacing": ["warn", { beforeColon: false }],
150
+ "@stylistic/key-spacing": [
151
+ "warn",
152
+ {
153
+ beforeColon: false,
154
+ afterColon: true
155
+ }
156
+ ],
188
157
  /**
189
158
  * Обеспечьте одинаковый интервал до и после ключевых слов.
190
159
  * https://eslint.style/rules/default/keyword-spacing
191
160
  */
192
- "@stylistic/keyword-spacing": ["warn", { before: true }],
161
+ "@stylistic/keyword-spacing": [
162
+ "warn",
163
+ {
164
+ before: true,
165
+ after: true
166
+ }
167
+ ],
193
168
  /**
194
169
  * Обеспечить положение строчных комментариев
195
170
  * https://eslint.style/rules/default/line-comment-position
@@ -207,22 +182,54 @@ const esLintStylisticRules = {
207
182
  "@stylistic/lines-around-comment": [
208
183
  "warn",
209
184
  {
185
+ beforeBlockComment: true,
186
+ afterBlockComment: false,
187
+ beforeLineComment: true,
188
+ afterLineComment: false,
210
189
  allowBlockStart: true,
190
+ allowBlockEnd: true,
211
191
  allowObjectStart: true,
212
- beforeLineComment: true,
213
- afterLineComment: false
192
+ allowObjectEnd: true,
193
+ allowArrayStart: true,
194
+ allowArrayEnd: true,
195
+ allowClassStart: true,
196
+ allowClassEnd: true,
197
+ allowEnumStart: true,
198
+ allowEnumEnd: true,
199
+ allowInterfaceStart: true,
200
+ allowInterfaceEnd: true,
201
+ allowModuleStart: true,
202
+ allowModuleEnd: true,
203
+ allowTypeStart: true,
204
+ allowTypeEnd: true
214
205
  }
215
206
  ],
216
207
  /**
217
208
  * Требовать или запрещать пустую строку между членами класса
218
209
  * https://eslint.style/rules/default/lines-between-class-members
219
210
  */
220
- "@stylistic/lines-between-class-members": ["warn", "always", { exceptAfterSingleLine: true }],
211
+ "@stylistic/lines-between-class-members": [
212
+ "warn",
213
+ "always",
214
+ { exceptAfterSingleLine: true }
215
+ ],
221
216
  /**
222
217
  * Обеспечить максимальную длину строки
223
218
  * https://eslint.style/rules/default/max-len
224
219
  */
225
- "@stylistic/max-len": ["off"],
220
+ "@stylistic/max-len": [
221
+ "warn",
222
+ {
223
+ code: 100,
224
+ ignoreUrls: true,
225
+ ignoreStrings: true,
226
+ ignoreTemplateLiterals: true,
227
+ ignoreRegExpLiterals: true,
228
+ ignoreComments: true,
229
+ ignoreTrailingComments: true,
230
+ ignorePattern: "^\\s*//[-!]?"
231
+ }
232
+ ],
226
233
  /**
227
234
  * Обеспечить максимально допустимое количество утверждений в строке
228
235
  * https://eslint.style/rules/default/max-statements-per-line
@@ -277,12 +284,12 @@ const esLintStylisticRules = {
277
284
  * Запретить стрелочные функции там, где их можно спутать со сравнениями
278
285
  * https://eslint.style/rules/default/no-confusing-arrow
279
286
  */
280
- "@stylistic/no-confusing-arrow": ["warn"],
287
+ "@stylistic/no-confusing-arrow": ["off"],
281
288
  /**
282
289
  * Запретить ненужные скобки
283
290
  * https://eslint.style/rules/default/no-extra-parens
284
291
  */
285
- "@stylistic/no-extra-parens": ["warn"],
292
+ "@stylistic/no-extra-parens": ["off"],
286
293
  /**
287
294
  * Запретить ненужные точки с запятой
288
295
  * https://eslint.style/rules/default/no-extra-semi
@@ -297,22 +304,29 @@ const esLintStylisticRules = {
297
304
  * Запретить смешанные бинарные операторы
298
305
  * https://eslint.style/rules/default/no-mixed-operators
299
306
  */
300
- "@stylistic/no-mixed-operators": ["error"],
307
+ "@stylistic/no-mixed-operators": "off",
301
308
  /**
302
309
  * Запретить смешанные пробелы и табуляции для отступов
303
310
  * https://eslint.style/rules/default/no-mixed-spaces-and-tabs
304
311
  */
305
- "@stylistic/no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
312
+ "@stylistic/no-mixed-spaces-and-tabs": ["warn"],
306
313
  /**
307
- * Запретить множественные пробелы
314
+ * Запретить множественные пробелы.
308
315
  * https://eslint.style/rules/default/no-multi-spaces
309
316
  */
310
- "@stylistic/no-multi-spaces": ["warn", { ignoreEOLComments: true }],
317
+ "@stylistic/no-multi-spaces": ["warn"],
311
318
  /**
312
319
  * Запретить несколько пустых строк
313
320
  * https://eslint.style/rules/default/no-multiple-empty-lines
314
321
  */
315
- "@stylistic/no-multiple-empty-lines": ["warn", { max: 1, maxBOF: 0, maxEOF: 0 }],
322
+ "@stylistic/no-multiple-empty-lines": [
323
+ "warn",
324
+ {
325
+ max: 1,
326
+ maxBOF: 0,
327
+ maxEOF: 1
328
+ }
329
+ ],
316
330
  /**
317
331
  * Запретить табуляцию
318
332
  * https://eslint.style/rules/default/no-tabs
@@ -337,23 +351,7 @@ const esLintStylisticRules = {
337
351
  * Обеспечивать единообразие переносов строк после открывающихся и перед закрывающимися фигурными скобками
338
352
  * https://eslint.style/rules/default/object-curly-newline
339
353
  */
340
- "@stylistic/object-curly-newline": [
341
- "warn",
342
- {
343
- ObjectExpression: {
344
- multiline: true,
345
- minProperties: 4,
346
- consistent: true
347
- },
348
- ObjectPattern: {
349
- multiline: true,
350
- minProperties: 4,
351
- consistent: true
352
- },
353
- ImportDeclaration: { multiline: true, minProperties: 4 },
354
- ExportDeclaration: { multiline: true, minProperties: 4 }
355
- }
356
- ],
354
+ "@stylistic/object-curly-newline": ["warn", { consistent: true }],
357
355
  /**
358
356
  * Обеспечьте постоянный интервал внутри скобок
359
357
  * https://eslint.style/rules/default/object-curly-spacing
@@ -373,42 +371,118 @@ const esLintStylisticRules = {
373
371
  * Обеспечить единый стиль переноса строк для операторов
374
372
  * https://eslint.style/rules/default/operator-linebreak
375
373
  */
376
- "@stylistic/operator-linebreak": ["warn", "before"],
374
+ "@stylistic/operator-linebreak": ["warn", "after", { overrides: { "?": "before", ":": "before", "|": "before" } }],
377
375
  /**
378
376
  * Требовать или запрещать отступы внутри блоков
379
377
  * https://eslint.style/rules/default/padded-blocks
380
378
  */
381
- "@stylistic/padded-blocks": ["off"],
379
+ "@stylistic/padded-blocks": ["warn", "never"],
382
380
  /**
383
381
  * Требовать или запрещать заполнение строк между операторами
384
382
  * https://eslint.style/rules/default/padding-line-between-statements
385
383
  */
386
384
  "@stylistic/padding-line-between-statements": [
387
385
  "warn",
388
- { blankLine: "always", prev: "*", next: ["*"] },
386
+ {
387
+ blankLine: "always",
388
+ prev: "*",
389
+ next: ["*"]
390
+ },
389
391
  {
390
392
  blankLine: "any",
391
393
  prev: ["const", "let", "var"],
392
394
  next: ["const", "let", "var"]
393
395
  },
394
- { blankLine: "any", prev: ["block"], next: ["block"] },
395
- { blankLine: "any", prev: ["block-like"], next: ["block-like"] },
396
- { blankLine: "any", prev: ["cjs-export"], next: ["cjs-export"] },
397
- { blankLine: "any", prev: ["cjs-import"], next: ["cjs-import"] },
398
- { blankLine: "any", prev: ["class"], next: ["class"] },
399
- { blankLine: "any", prev: ["continue"], next: ["continue"] },
400
- { blankLine: "any", prev: ["debugger"], next: ["debugger"] },
401
- { blankLine: "any", prev: ["default"], next: ["default"] },
402
- { blankLine: "any", prev: ["directive"], next: ["directive"] },
403
- { blankLine: "any", prev: ["do"], next: ["do"] },
404
- { blankLine: "any", prev: ["empty"], next: ["empty"] },
405
- { blankLine: "any", prev: ["export"], next: ["export"] },
406
- { blankLine: "any", prev: ["expression"], next: ["expression"] },
407
- { blankLine: "any", prev: ["for"], next: ["for"] },
408
- { blankLine: "any", prev: ["function"], next: ["function"] },
409
- { blankLine: "any", prev: ["if"], next: ["if"] },
410
- { blankLine: "any", prev: ["iife"], next: ["iife"] },
411
- { blankLine: "any", prev: ["import"], next: ["import"] },
396
+ {
397
+ blankLine: "any",
398
+ prev: ["block"],
399
+ next: ["block"]
400
+ },
401
+ {
402
+ blankLine: "any",
403
+ prev: ["block-like"],
404
+ next: ["block-like"]
405
+ },
406
+ {
407
+ blankLine: "any",
408
+ prev: ["cjs-export"],
409
+ next: ["cjs-export"]
410
+ },
411
+ {
412
+ blankLine: "any",
413
+ prev: ["cjs-import"],
414
+ next: ["cjs-import"]
415
+ },
416
+ {
417
+ blankLine: "any",
418
+ prev: ["class"],
419
+ next: ["class"]
420
+ },
421
+ {
422
+ blankLine: "any",
423
+ prev: ["continue"],
424
+ next: ["continue"]
425
+ },
426
+ {
427
+ blankLine: "any",
428
+ prev: ["debugger"],
429
+ next: ["debugger"]
430
+ },
431
+ {
432
+ blankLine: "any",
433
+ prev: ["default"],
434
+ next: ["default"]
435
+ },
436
+ {
437
+ blankLine: "any",
438
+ prev: ["directive"],
439
+ next: ["directive"]
440
+ },
441
+ {
442
+ blankLine: "any",
443
+ prev: ["do"],
444
+ next: ["do"]
445
+ },
446
+ {
447
+ blankLine: "any",
448
+ prev: ["empty"],
449
+ next: ["empty"]
450
+ },
451
+ {
452
+ blankLine: "any",
453
+ prev: ["export"],
454
+ next: ["export"]
455
+ },
456
+ {
457
+ blankLine: "any",
458
+ prev: ["expression"],
459
+ next: ["expression"]
460
+ },
461
+ {
462
+ blankLine: "any",
463
+ prev: ["for"],
464
+ next: ["for"]
465
+ },
466
+ {
467
+ blankLine: "any",
468
+ prev: ["function"],
469
+ next: ["function"]
470
+ },
471
+ {
472
+ blankLine: "any",
473
+ prev: ["if"],
474
+ next: ["if"]
475
+ },
476
+ {
477
+ blankLine: "any",
478
+ prev: ["iife"],
479
+ next: ["iife"]
480
+ },
481
+ {
482
+ blankLine: "any",
483
+ prev: ["import"],
484
+ next: ["import"]
485
+ },
412
486
  {
413
487
  blankLine: "any",
414
488
  prev: ["multiline-block-like"],
@@ -429,7 +503,11 @@ const esLintStylisticRules = {
429
503
  prev: ["multiline-expression"],
430
504
  next: ["multiline-expression"]
431
505
  },
432
- { blankLine: "any", prev: ["return"], next: ["return"] },
506
+ {
507
+ blankLine: "any",
508
+ prev: ["return"],
509
+ next: ["return"]
510
+ },
433
511
  {
434
512
  blankLine: "any",
435
513
  prev: ["singleline-const", "singleline-let", "singleline-var"],
@@ -440,24 +518,58 @@ const esLintStylisticRules = {
440
518
  prev: ["singleline-export"],
441
519
  next: ["singleline-export"]
442
520
  },
443
- { blankLine: "any", prev: ["switch"], next: ["switch"] },
444
- { blankLine: "any", prev: ["throw"], next: ["throw"] },
445
- { blankLine: "any", prev: ["try"], next: ["try"] },
446
- { blankLine: "any", prev: ["while"], next: ["while"] },
447
- { blankLine: "any", prev: ["with"], next: ["with"] },
448
- { blankLine: "any", prev: ["type"], next: ["type"] },
449
- { blankLine: "any", prev: ["interface"], next: ["interface"] }
521
+ {
522
+ blankLine: "any",
523
+ prev: ["switch"],
524
+ next: ["switch"]
525
+ },
526
+ {
527
+ blankLine: "any",
528
+ prev: ["throw"],
529
+ next: ["throw"]
530
+ },
531
+ {
532
+ blankLine: "any",
533
+ prev: ["try"],
534
+ next: ["try"]
535
+ },
536
+ {
537
+ blankLine: "any",
538
+ prev: ["while"],
539
+ next: ["while"]
540
+ },
541
+ {
542
+ blankLine: "any",
543
+ prev: ["with"],
544
+ next: ["with"]
545
+ },
546
+ {
547
+ blankLine: "any",
548
+ prev: ["type"],
549
+ next: ["type"]
550
+ },
551
+ {
552
+ blankLine: "any",
553
+ prev: ["interface"],
554
+ next: ["interface"]
555
+ }
450
556
  ],
451
557
  /**
452
558
  * Обязательно заключайте в кавычки имена свойств объектов, типов, интерфейсов и перечислений.
453
559
  * https://eslint.style/rules/default/quote-props
454
560
  */
455
- "@stylistic/quote-props": ["warn", "as-needed", { keywords: false, numbers: true }],
561
+ "@stylistic/quote-props": ["warn", "as-needed"],
456
562
  /**
457
563
  * Обеспечить последовательное использование обратных кавычек, двойных или одинарных кавычек
458
564
  * https://eslint.style/rules/default/quotes
459
565
  */
460
- "@stylistic/quotes": ["warn", "single"],
566
+ "@stylistic/quotes": [
567
+ "warn",
568
+ "single",
569
+ {
570
+ avoidEscape: true
571
+ }
572
+ ],
461
573
  /**
462
574
  * Обеспечить соблюдение интервалов между операторами rest и spread и их выражениями
463
575
  * https://eslint.style/rules/default/rest-spread-spacing
@@ -472,7 +584,13 @@ const esLintStylisticRules = {
472
584
  * Обеспечьте одинаковый интервал до и после точек с запятой
473
585
  * https://eslint.style/rules/default/semi-spacing
474
586
  */
475
- "@stylistic/semi-spacing": ["warn", { before: false, after: true }],
587
+ "@stylistic/semi-spacing": [
588
+ "warn",
589
+ {
590
+ before: false,
591
+ after: true
592
+ }
593
+ ],
476
594
  /**
477
595
  * Обеспечить правильное расположение точек с запятой
478
596
  * https://eslint.style/rules/default/semi-style
@@ -487,7 +605,14 @@ const esLintStylisticRules = {
487
605
  * Обеспечить одинаковый интервал перед скобками функций
488
606
  * https://eslint.style/rules/default/space-before-function-paren
489
607
  */
490
- "@stylistic/space-before-function-paren": ["warn", "always"],
608
+ "@stylistic/space-before-function-paren": [
609
+ "warn",
610
+ {
611
+ anonymous: "never",
612
+ named: "never",
613
+ asyncArrow: "always"
614
+ }
615
+ ],
491
616
  /**
492
617
  * Обеспечьте одинаковый интервал внутри скобок
493
618
  * https://eslint.style/rules/default/space-in-parens
@@ -502,7 +627,13 @@ const esLintStylisticRules = {
502
627
  * Обеспечивать единообразие интервалов до и после унарных операторов
503
628
  * https://eslint.style/rules/default/space-unary-ops
504
629
  */
505
- "@stylistic/space-unary-ops": ["warn"],
630
+ "@stylistic/space-unary-ops": [
631
+ "warn",
632
+ {
633
+ words: true,
634
+ nonwords: false
635
+ }
636
+ ],
506
637
  /**
507
638
  * Обеспечьте единообразие интервалов после `//` или `/*` в комментариях
508
639
  * https://eslint.style/rules/default/spaced-comment
@@ -512,7 +643,13 @@ const esLintStylisticRules = {
512
643
  * Обеспечить наличие пробелов вокруг двоеточий в операторах switch
513
644
  * https://eslint.style/rules/default/switch-colon-spacing
514
645
  */
515
- "@stylistic/switch-colon-spacing": ["warn", { after: true, before: false }],
646
+ "@stylistic/switch-colon-spacing": [
647
+ "warn",
648
+ {
649
+ before: false,
650
+ after: true
651
+ }
652
+ ],
516
653
  /**
517
654
  * Требовать или запрещать пробелы вокруг встроенных выражений строк шаблонов
518
655
  * https://eslint.style/rules/default/template-curly-spacing
@@ -527,7 +664,14 @@ const esLintStylisticRules = {
527
664
  * Требуйте одинакового интервала вокруг аннотаций типов.
528
665
  * https://eslint.style/rules/default/type-annotation-spacing
529
666
  */
530
- "@stylistic/type-annotation-spacing": ["warn"],
667
+ "@stylistic/type-annotation-spacing": [
668
+ "warn",
669
+ {
670
+ before: true,
671
+ after: true,
672
+ overrides: { colon: { before: false, after: true } }
673
+ }
674
+ ],
531
675
  /**
532
676
  * Обеспечивает единообразие интервалов внутри обобщенных типов TypeScript
533
677
  * https://eslint.style/rules/default/type-generic-spacing
@@ -547,53 +691,18 @@ const esLintStylisticRules = {
547
691
  * Требуйте заключения в скобки литералов регулярных выражений
548
692
  * https://eslint.style/rules/default/wrap-regex
549
693
  */
550
- "@stylistic/wrap-regex": ["warn"]
551
- }
552
- };
553
-
554
- const esLintTypeScriptRules = {
555
- files: ["**/*.{ts,tsx,vue}"],
556
- languageOptions: {
557
- parserOptions: {
558
- parser: tsPlugin.parser
559
- }
560
- },
561
- plugins: {
562
- "@typescript-eslint": tsPlugin.plugin
563
- },
564
- rules: {
565
- "@typescript-eslint/consistent-type-definitions": "off",
566
- "@typescript-eslint/no-shadow": "error",
567
- "@typescript-eslint/no-unused-vars": "off",
568
- "@typescript-eslint/no-namespace": "off",
569
- "@typescript-eslint/consistent-type-imports": [
570
- "error",
571
- {
572
- prefer: "type-imports",
573
- disallowTypeAnnotations: false,
574
- fixStyle: "inline-type-imports"
575
- }
576
- ]
694
+ "@stylistic/wrap-regex": ["off"],
695
+ /**
696
+ * Пробелы вокруг * в yield*: yield* generator
697
+ * https://eslint.style/rules/yield-star-spacing
698
+ */
699
+ "@stylistic/yield-star-spacing": ["warn", "after"]
577
700
  }
578
701
  };
579
702
 
580
- function stripPlugins({ plugins, ...rest }) {
581
- return rest;
582
- }
583
- function createBaseConfig({ registerPlugins = true } = {}) {
584
- return [
585
- {
586
- languageOptions: {
587
- globals: { ...globals.browser, ...globals.node }
588
- }
589
- },
590
- jsPlugin.configs.recommended,
591
- ...registerPlugins ? tsPlugin.configs.recommended : tsPlugin.configs.recommended.map(stripPlugins),
592
- esLintJavaScriptRules,
593
- registerPlugins ? esLintTypeScriptRules : stripPlugins(esLintTypeScriptRules),
594
- esLintStylisticRules
595
- ];
596
- }
597
- const baseConfig = createBaseConfig();
703
+ const createStylisticConfig = ({ registerPlugins = true } = {}) => [
704
+ registerPlugins ? esLintStylisticRules : stripPlugins(esLintStylisticRules)
705
+ ];
706
+ const stylistic = createStylisticConfig();
598
707
 
599
- export { baseConfig, createBaseConfig };
708
+ export { createStylisticConfig, stylistic };