@alexlit/lint-kit 214.4.0 → 216.0.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.
Files changed (157) hide show
  1. package/README.md +27 -22
  2. package/eslint.config.js +31 -60
  3. package/lint-staged.config.js +2 -2
  4. package/linthtml.config.js +2 -2
  5. package/package.json +3 -2
  6. package/packages/config-eslint/README.md +181 -106
  7. package/packages/config-eslint/base.js +8 -3
  8. package/packages/config-eslint/index.d.ts +114 -0
  9. package/packages/config-eslint/index.js +82 -23
  10. package/packages/config-eslint/package.json +20 -17
  11. package/packages/config-eslint/plugins/de-morgan.js +11 -4
  12. package/packages/config-eslint/plugins/import-x.js +54 -37
  13. package/packages/config-eslint/plugins/javascript.js +100 -85
  14. package/packages/config-eslint/plugins/jsdoc.js +28 -17
  15. package/packages/config-eslint/plugins/json.js +35 -24
  16. package/packages/config-eslint/plugins/perfectionist.js +112 -95
  17. package/packages/config-eslint/plugins/pinia.js +21 -10
  18. package/packages/config-eslint/plugins/prettier.js +32 -10
  19. package/packages/config-eslint/plugins/regexp.js +20 -9
  20. package/packages/config-eslint/plugins/sonar.js +23 -12
  21. package/packages/config-eslint/plugins/stylistic.js +111 -100
  22. package/packages/config-eslint/plugins/tailwindcss.js +24 -10
  23. package/packages/config-eslint/plugins/tanstack-query.js +20 -9
  24. package/packages/config-eslint/plugins/typescript-type-checked.js +42 -33
  25. package/packages/config-eslint/plugins/typescript.js +27 -14
  26. package/packages/config-eslint/plugins/unicorn.js +77 -64
  27. package/packages/config-eslint/plugins/unocss.js +16 -5
  28. package/packages/config-eslint/plugins/vitest.js +24 -13
  29. package/packages/config-eslint/plugins/vue-accessibility.js +26 -13
  30. package/packages/config-eslint/plugins/vue-i18n.js +43 -31
  31. package/packages/config-eslint/plugins/vue.js +259 -242
  32. package/packages/config-eslint/plugins/zod.js +21 -10
  33. package/packages/config-eslint/rules/typescript.js +1 -1
  34. package/packages/config-hooks/README.md +119 -37
  35. package/packages/config-hooks/index.d.ts +19 -0
  36. package/packages/config-hooks/lint-staged.js +8 -6
  37. package/packages/config-hooks/package.json +3 -1
  38. package/packages/config-htmllint/README.md +50 -22
  39. package/packages/config-htmllint/index.d.ts +13 -0
  40. package/packages/config-htmllint/index.js +15 -7
  41. package/packages/config-htmllint/package.json +4 -2
  42. package/packages/config-markdownlint/README.md +40 -5
  43. package/packages/config-markdownlint/index.json +0 -2
  44. package/packages/config-markdownlint/package.json +1 -1
  45. package/packages/config-npmlint/README.md +48 -5
  46. package/packages/config-npmlint/package.json +3 -3
  47. package/packages/config-prettier/README.md +158 -23
  48. package/packages/config-prettier/index.d.ts +100 -0
  49. package/packages/config-prettier/index.js +63 -85
  50. package/packages/config-prettier/package.json +6 -4
  51. package/packages/config-prettier/plugins/jsdoc.js +17 -2
  52. package/packages/config-prettier/plugins/mdc.js +17 -2
  53. package/packages/config-prettier/plugins/packagejson.js +17 -4
  54. package/packages/config-prettier/plugins/php.js +17 -4
  55. package/packages/config-prettier/plugins/pug.js +17 -2
  56. package/packages/config-prettier/plugins/ruby.js +17 -11
  57. package/packages/config-prettier/plugins/sh.js +17 -4
  58. package/packages/config-prettier/plugins/solidity.js +17 -4
  59. package/packages/config-prettier/plugins/sort-json.js +17 -2
  60. package/packages/config-prettier/plugins/sql.js +17 -4
  61. package/packages/config-prettier/plugins/tailwindcss.js +17 -2
  62. package/packages/config-prettier/plugins/xml.js +17 -2
  63. package/packages/config-prettier/utils/merge-configs.js +18 -0
  64. package/packages/config-stylelint/README.md +182 -44
  65. package/packages/config-stylelint/index.d.ts +56 -0
  66. package/packages/config-stylelint/index.js +161 -165
  67. package/packages/config-stylelint/package.json +5 -2
  68. package/packages/config-stylelint/plugins/a11y.js +13 -6
  69. package/packages/config-stylelint/plugins/bem.js +14 -6
  70. package/packages/config-stylelint/plugins/color-format.js +14 -2
  71. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +14 -5
  72. package/packages/config-stylelint/plugins/gamut.js +13 -5
  73. package/packages/config-stylelint/plugins/high-performance-animation.js +15 -6
  74. package/packages/config-stylelint/plugins/logical-css.js +13 -5
  75. package/packages/config-stylelint/plugins/media-use-custom-media.js +14 -5
  76. package/packages/config-stylelint/plugins/no-indistinguishable-colors.js +14 -5
  77. package/packages/config-stylelint/plugins/no-nested-media.js +13 -5
  78. package/packages/config-stylelint/plugins/no-unresolved-module.js +15 -6
  79. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +15 -6
  80. package/packages/config-stylelint/plugins/order.js +14 -6
  81. package/packages/config-stylelint/plugins/prettier.js +13 -5
  82. package/packages/config-stylelint/plugins/scss.js +13 -6
  83. package/packages/config-stylelint/plugins/selector-no-empty.js +14 -5
  84. package/packages/config-stylelint/plugins/use-nesting.js +13 -5
  85. package/packages/config-stylelint/plugins/vue.js +10 -2
  86. package/packages/config-stylelint/utils/merge-configs.js +20 -0
  87. package/prettier.config.js +15 -7
  88. package/scripts/semver.sh +3 -3
  89. package/stylelint.config.js +25 -11
  90. package/packages/config-eslint/_legacy/LICENSE +0 -20
  91. package/packages/config-eslint/_legacy/README.md +0 -48
  92. package/packages/config-eslint/_legacy/constants/allow-boolean-property-list.js +0 -38
  93. package/packages/config-eslint/_legacy/constants/boolean-prefixes.js +0 -11
  94. package/packages/config-eslint/_legacy/constants/english-verbs.js +0 -3368
  95. package/packages/config-eslint/_legacy/dictionaries/index.js +0 -467
  96. package/packages/config-eslint/_legacy/dictionaries/programming/bash.js +0 -25
  97. package/packages/config-eslint/_legacy/dictionaries/programming/django.js +0 -2345
  98. package/packages/config-eslint/_legacy/dictionaries/programming/elixir.js +0 -64
  99. package/packages/config-eslint/_legacy/dictionaries/programming/go.js +0 -7748
  100. package/packages/config-eslint/_legacy/dictionaries/programming/java.js +0 -33527
  101. package/packages/config-eslint/_legacy/dictionaries/programming/latex.js +0 -675
  102. package/packages/config-eslint/_legacy/dictionaries/programming/lua.js +0 -394
  103. package/packages/config-eslint/_legacy/dictionaries/programming/php.js +0 -9788
  104. package/packages/config-eslint/_legacy/dictionaries/programming/python.js +0 -367
  105. package/packages/config-eslint/_legacy/dictionaries/programming/ruby.js +0 -357
  106. package/packages/config-eslint/_legacy/dictionaries/programming/rust.js +0 -115
  107. package/packages/config-eslint/_legacy/dictionaries/programming/scala.js +0 -2755
  108. package/packages/config-eslint/_legacy/dictionaries/specialized/html-symbol-entities.js +0 -1118
  109. package/packages/config-eslint/_legacy/dictionaries/specialized/lorem-ipsum.js +0 -359
  110. package/packages/config-eslint/_legacy/index.js +0 -12
  111. package/packages/config-eslint/_legacy/legacy.js +0 -3
  112. package/packages/config-eslint/_legacy/package.json +0 -97
  113. package/packages/config-eslint/_legacy/plugins/array-func.js +0 -20
  114. package/packages/config-eslint/_legacy/plugins/compat.js +0 -7
  115. package/packages/config-eslint/_legacy/plugins/decorator-position.js +0 -15
  116. package/packages/config-eslint/_legacy/plugins/eslint-comments.js +0 -9
  117. package/packages/config-eslint/_legacy/plugins/etc.js +0 -13
  118. package/packages/config-eslint/_legacy/plugins/ext.js +0 -12
  119. package/packages/config-eslint/_legacy/plugins/filenames.js +0 -38
  120. package/packages/config-eslint/_legacy/plugins/import.js +0 -133
  121. package/packages/config-eslint/_legacy/plugins/jsdoc.js +0 -32
  122. package/packages/config-eslint/_legacy/plugins/jsx-a11y.js +0 -5
  123. package/packages/config-eslint/_legacy/plugins/lit-a11y.js +0 -5
  124. package/packages/config-eslint/_legacy/plugins/lit.js +0 -9
  125. package/packages/config-eslint/_legacy/plugins/more.js +0 -17
  126. package/packages/config-eslint/_legacy/plugins/no-await-in-promise.js +0 -5
  127. package/packages/config-eslint/_legacy/plugins/no-constructor-bind.js +0 -8
  128. package/packages/config-eslint/_legacy/plugins/no-explicit-type-exports.js +0 -7
  129. package/packages/config-eslint/_legacy/plugins/no-loops.js +0 -7
  130. package/packages/config-eslint/_legacy/plugins/no-secrets.js +0 -12
  131. package/packages/config-eslint/_legacy/plugins/no-use-extend-native.js +0 -5
  132. package/packages/config-eslint/_legacy/plugins/node.js +0 -5
  133. package/packages/config-eslint/_legacy/plugins/prettier.js +0 -24
  134. package/packages/config-eslint/_legacy/plugins/promise.js +0 -10
  135. package/packages/config-eslint/_legacy/plugins/regexp.js +0 -7
  136. package/packages/config-eslint/_legacy/plugins/security.js +0 -10
  137. package/packages/config-eslint/_legacy/plugins/simple-import-sort.js +0 -7
  138. package/packages/config-eslint/_legacy/plugins/sonar.js +0 -5
  139. package/packages/config-eslint/_legacy/plugins/sort-class-members.js +0 -298
  140. package/packages/config-eslint/_legacy/plugins/sort-destructure-keys.js +0 -10
  141. package/packages/config-eslint/_legacy/plugins/sort-keys-fix.js +0 -7
  142. package/packages/config-eslint/_legacy/plugins/spellcheck.js +0 -9
  143. package/packages/config-eslint/_legacy/plugins/sql.js +0 -26
  144. package/packages/config-eslint/_legacy/plugins/tanstack-query.js +0 -4
  145. package/packages/config-eslint/_legacy/plugins/testing-library.js +0 -9
  146. package/packages/config-eslint/_legacy/plugins/typescript-sort-keys.js +0 -5
  147. package/packages/config-eslint/_legacy/plugins/typescript.js +0 -157
  148. package/packages/config-eslint/_legacy/plugins/unicorn.js +0 -70
  149. package/packages/config-eslint/_legacy/plugins/unused-imports.js +0 -17
  150. package/packages/config-eslint/_legacy/plugins/vitest.js +0 -16
  151. package/packages/config-eslint/_legacy/plugins/vue-i18n.js +0 -34
  152. package/packages/config-eslint/_legacy/plugins/vue.js +0 -291
  153. package/packages/config-eslint/_legacy/plugins/vuejs-accessibility.js +0 -20
  154. package/packages/config-eslint/_legacy/plugins/wc.js +0 -5
  155. package/packages/config-eslint/_legacy/plugins/write-good-comments.js +0 -7
  156. package/packages/config-eslint/_legacy/utils/create-config.js +0 -377
  157. package/packages/config-eslint/_legacy/utils/extend-spell-checker.js +0 -23
@@ -3,107 +3,124 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-perfectionist](https://perfectionist.dev) */
7
- export const perfectionist = defineConfig([
8
- { ...plugin.configs['recommended-natural'], files: FILES },
9
- {
10
- files: FILES,
11
- rules: {
12
- 'perfectionist/sort-imports': [
13
- 'warn',
14
- {
15
- customGroups: [
16
- // hash (nuxt)
17
- { elementNamePattern: ['^#'], groupName: 'hash' },
6
+ /**
7
+ * Правила сортировки импортов, объектов, интерфейсов и типов.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-perfectionist](https://perfectionist.dev)
14
+ */
15
+ export const perfectionist = (config = []) =>
16
+ defineConfig([
17
+ { ...plugin.configs['recommended-natural'], files: FILES },
18
+ {
19
+ files: FILES,
20
+ rules: {
21
+ 'perfectionist/sort-imports': [
22
+ 'warn',
23
+ {
24
+ customGroups: [
25
+ // hash (nuxt)
26
+ { elementNamePattern: ['^#'], groupName: 'hash' },
18
27
 
19
- // @@/
20
- { elementNamePattern: ['^@@/'], groupName: 'double-at' },
28
+ // @@/
29
+ { elementNamePattern: ['^@@/'], groupName: 'double-at' },
21
30
 
22
- // universal
23
- { elementNamePattern: ['^@/api'], groupName: 'universal-api' },
24
- {
25
- elementNamePattern: ['^@/assets'],
26
- groupName: 'universal-assets',
27
- },
28
- {
29
- elementNamePattern: ['^@/components'],
30
- groupName: 'universal-components',
31
- },
32
- {
33
- elementNamePattern: ['^@/composables'],
34
- groupName: 'universal-composables',
35
- },
36
- {
37
- elementNamePattern: ['^@/constants'],
38
- groupName: 'universal-constants',
39
- },
40
- {
41
- elementNamePattern: ['^@/directives'],
42
- groupName: 'universal-directives',
43
- },
44
- {
45
- elementNamePattern: ['^@/layouts'],
46
- groupName: 'universal-layouts',
47
- },
48
- { elementNamePattern: ['^@/pages'], groupName: 'universal-pages' },
49
- {
50
- elementNamePattern: ['^@/plugins'],
51
- groupName: 'universal-plugins',
52
- },
53
- {
54
- elementNamePattern: ['^@/stores'],
55
- groupName: 'universal-stores',
56
- },
57
- { elementNamePattern: ['^@/utils'], groupName: 'universal-utils' },
58
- ],
59
- groups: [
60
- 'type-import',
61
- ['value-builtin', 'value-external'],
31
+ // universal
32
+ { elementNamePattern: ['^@/api'], groupName: 'universal-api' },
33
+ {
34
+ elementNamePattern: ['^@/assets'],
35
+ groupName: 'universal-assets',
36
+ },
37
+ {
38
+ elementNamePattern: ['^@/components'],
39
+ groupName: 'universal-components',
40
+ },
41
+ {
42
+ elementNamePattern: ['^@/composables'],
43
+ groupName: 'universal-composables',
44
+ },
45
+ {
46
+ elementNamePattern: ['^@/constants'],
47
+ groupName: 'universal-constants',
48
+ },
49
+ {
50
+ elementNamePattern: ['^@/directives'],
51
+ groupName: 'universal-directives',
52
+ },
53
+ {
54
+ elementNamePattern: ['^@/layouts'],
55
+ groupName: 'universal-layouts',
56
+ },
57
+ {
58
+ elementNamePattern: ['^@/pages'],
59
+ groupName: 'universal-pages',
60
+ },
61
+ {
62
+ elementNamePattern: ['^@/plugins'],
63
+ groupName: 'universal-plugins',
64
+ },
65
+ {
66
+ elementNamePattern: ['^@/stores'],
67
+ groupName: 'universal-stores',
68
+ },
69
+ {
70
+ elementNamePattern: ['^@/utils'],
71
+ groupName: 'universal-utils',
72
+ },
73
+ ],
74
+ groups: [
75
+ 'type-import',
76
+ ['value-builtin', 'value-external'],
62
77
 
63
- // hash (nuxt)
64
- 'hash',
78
+ // hash (nuxt)
79
+ 'hash',
65
80
 
66
- // @@/
67
- 'double-at',
81
+ // @@/
82
+ 'double-at',
68
83
 
69
- // universal
70
- 'universal-api',
71
- 'universal-assets',
72
- 'universal-components',
73
- 'universal-composables',
74
- 'universal-constants',
75
- 'universal-directives',
76
- 'universal-layouts',
77
- 'universal-pages',
78
- 'universal-plugins',
79
- 'universal-stores',
80
- 'universal-utils',
84
+ // universal
85
+ 'universal-api',
86
+ 'universal-assets',
87
+ 'universal-components',
88
+ 'universal-composables',
89
+ 'universal-constants',
90
+ 'universal-directives',
91
+ 'universal-layouts',
92
+ 'universal-pages',
93
+ 'universal-plugins',
94
+ 'universal-stores',
95
+ 'universal-utils',
81
96
 
82
- 'type-internal',
83
- 'value-internal',
97
+ 'type-internal',
98
+ 'value-internal',
84
99
 
85
- ['type-parent', 'type-sibling', 'type-index'],
86
- ['value-parent', 'value-sibling', 'value-index'],
100
+ ['type-parent', 'type-sibling', 'type-index'],
101
+ ['value-parent', 'value-sibling', 'value-index'],
87
102
 
88
- 'ts-equals-import',
89
- 'unknown',
90
- ],
91
- internalPattern: ['^@@/.*', '^@/.*'],
92
- type: 'natural',
93
- },
94
- ],
95
- 'perfectionist/sort-interfaces': [
96
- 'warn',
97
- { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
98
- ],
99
- 'perfectionist/sort-object-types': [
100
- 'warn',
101
- { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
102
- ],
103
- 'perfectionist/sort-objects': [
104
- 'warn',
105
- { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
106
- ],
103
+ 'ts-equals-import',
104
+ 'unknown',
105
+ ],
106
+ internalPattern: ['^@@/.*', '^@/.*'],
107
+ type: 'natural',
108
+ },
109
+ ],
110
+ 'perfectionist/sort-interfaces': [
111
+ 'warn',
112
+ { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
113
+ ],
114
+ 'perfectionist/sort-object-types': [
115
+ 'warn',
116
+ { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
117
+ ],
118
+ 'perfectionist/sort-objects': [
119
+ 'warn',
120
+ { newlinesBetween: 0, partitionByComment: false, type: 'natural' },
121
+ ],
122
+ },
107
123
  },
108
- },
109
- ]);
124
+
125
+ config,
126
+ ]);
@@ -3,14 +3,25 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-pinia](https://github.com/lisilinhart/eslint-plugin-pinia) */
7
- export const pinia = defineConfig([
8
- {
9
- ...plugin.configs['recommended-flat'],
10
- files: FILES,
11
- rules: {
12
- ...plugin.configs['recommended-flat'].rules,
13
- 'pinia/prefer-single-store-per-file': 'error',
6
+ /**
7
+ * Правила для Pinia-хранилищ.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-pinia](https://github.com/lisilinhart/eslint-plugin-pinia)
14
+ */
15
+ export const pinia = (config = []) =>
16
+ defineConfig([
17
+ {
18
+ ...plugin.configs['recommended-flat'],
19
+ files: FILES,
20
+ rules: {
21
+ ...plugin.configs['recommended-flat'].rules,
22
+ 'pinia/prefer-single-store-per-file': 'error',
23
+ },
14
24
  },
15
- },
16
- ]);
25
+
26
+ config,
27
+ ]);
@@ -17,14 +17,36 @@ const fixes = {
17
17
  ],
18
18
  };
19
19
 
20
- /** @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) */
21
- export const prettier = defineConfig([
22
- { files: FILES, ...plugin, rules: { ...plugin.rules, ...STYLE_RULES } },
23
- { files: VUE_FILES, rules: { ...fixes } },
24
- ]);
20
+ /**
21
+ * Форматирование кода самим Prettier (ESLint запускает Prettier как правило).
22
+ *
23
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
24
+ *
25
+ * @returns {import('eslint').Linter.Config[]}
26
+ *
27
+ * @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
28
+ */
29
+ export const prettier = (config = []) =>
30
+ defineConfig([
31
+ { files: FILES, ...plugin, rules: { ...plugin.rules, ...STYLE_RULES } },
32
+ { files: VUE_FILES, rules: { ...fixes } },
25
33
 
26
- /** @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) */
27
- export const prettierConfig = defineConfig([
28
- { files: FILES, ...config, rules: { ...config.rules, ...STYLE_RULES } },
29
- { files: VUE_FILES, rules: { ...fixes } },
30
- ]);
34
+ config,
35
+ ]);
36
+
37
+ /**
38
+ * Отключение правил, конфликтующих с Prettier.
39
+ *
40
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [customConfig]
41
+ *
42
+ * @returns {import('eslint').Linter.Config[]}
43
+ *
44
+ * @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
45
+ */
46
+ export const prettierConfig = (customConfig = []) =>
47
+ defineConfig([
48
+ { files: FILES, ...config, rules: { ...config.rules, ...STYLE_RULES } },
49
+ { files: VUE_FILES, rules: { ...fixes } },
50
+
51
+ customConfig,
52
+ ]);
@@ -3,13 +3,24 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp) */
7
- export const regexp = defineConfig([
8
- {
9
- files: FILES,
10
- ...plugin.configs['flat/recommended'],
11
- settings: {
12
- regexp: { allowedCharacterRanges: ['alphanumeric', 'а-я', 'А-Я'] },
6
+ /**
7
+ * Правила для регулярных выражений.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
14
+ */
15
+ export const regexp = (config = []) =>
16
+ defineConfig([
17
+ {
18
+ files: FILES,
19
+ ...plugin.configs['flat/recommended'],
20
+ settings: {
21
+ regexp: { allowedCharacterRanges: ['alphanumeric', 'а-я', 'А-Я'] },
22
+ },
13
23
  },
14
- },
15
- ]);
24
+
25
+ config,
26
+ ]);
@@ -3,16 +3,27 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md) */
7
- export const sonar = defineConfig([
8
- {
9
- files: FILES,
10
- ...plugin.configs.recommended,
11
- rules: {
12
- ...plugin.configs.recommended.rules,
13
- 'sonarjs/no-commented-code': 'warn',
14
- 'sonarjs/todo-tag': 'off',
15
- 'sonarjs/unused-import': 'off', // @typescript-eslint/no-unused-vars
6
+ /**
7
+ * Правила SonarJS.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
14
+ */
15
+ export const sonar = (config = []) =>
16
+ defineConfig([
17
+ {
18
+ files: FILES,
19
+ ...plugin.configs.recommended,
20
+ rules: {
21
+ ...plugin.configs.recommended.rules,
22
+ 'sonarjs/no-commented-code': 'warn',
23
+ 'sonarjs/todo-tag': 'off',
24
+ 'sonarjs/unused-import': 'off', // @typescript-eslint/no-unused-vars
25
+ },
16
26
  },
17
- },
18
- ]);
27
+
28
+ config,
29
+ ]);
@@ -3,104 +3,115 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { DATA_FILES, FILES } from '../base.js';
5
5
 
6
- /** @see [@stylistic/eslint-plugin](https://eslint.style/) */
7
- export const stylistic = defineConfig([
8
- {
9
- ...plugin.configs.recommended,
10
- ignores: [...(plugin.configs.recommended.ignores ?? []), ...DATA_FILES],
11
- },
12
- {
13
- files: FILES,
14
- plugins: { '@stylistic': plugin },
15
- rules: {
16
- '@stylistic/lines-around-comment': [
17
- 'warn',
18
- {
19
- afterBlockComment: false,
20
- afterHashbangComment: true,
21
- afterLineComment: false,
22
- allowArrayEnd: true,
23
- allowArrayStart: true,
24
- allowBlockEnd: true,
25
- allowBlockStart: true,
26
- allowClassEnd: true,
27
- allowClassStart: true,
28
- allowEnumEnd: true,
29
- allowEnumStart: true,
30
- allowInterfaceEnd: true,
31
- allowInterfaceStart: true,
32
- allowModuleEnd: true,
33
- allowModuleStart: true,
34
- allowObjectEnd: true,
35
- allowObjectStart: true,
36
- allowTypeEnd: true,
37
- allowTypeStart: true,
38
- applyDefaultIgnorePatterns: true,
39
- beforeBlockComment: false,
40
- beforeLineComment: false,
41
- },
42
- ],
43
- '@stylistic/padding-line-between-statements': [
44
- 'warn',
45
- // always
46
- { blankLine: 'always', next: '*', prev: 'block-like' },
47
- { blankLine: 'always', next: '*', prev: 'case' },
48
- { blankLine: 'always', next: '*', prev: 'cjs-export' },
49
- { blankLine: 'always', next: '*', prev: 'cjs-import' },
50
- { blankLine: 'always', next: '*', prev: 'class' },
51
- { blankLine: 'always', next: '*', prev: 'default' },
52
- { blankLine: 'always', next: '*', prev: 'directive' },
53
- { blankLine: 'always', next: '*', prev: 'enum' },
54
- { blankLine: 'always', next: '*', prev: 'export' },
55
- { blankLine: 'always', next: '*', prev: 'expression' },
56
- { blankLine: 'always', next: '*', prev: 'iife' },
57
- { blankLine: 'always', next: '*', prev: 'import' },
58
- { blankLine: 'always', next: '*', prev: 'interface' },
59
- { blankLine: 'always', next: '*', prev: 'multiline-block-like' },
60
- { blankLine: 'always', next: '*', prev: 'multiline-const' },
61
- { blankLine: 'always', next: '*', prev: 'multiline-expression' },
62
- { blankLine: 'always', next: '*', prev: 'multiline-let' },
63
- { blankLine: 'always', next: '*', prev: 'multiline-var' },
64
- { blankLine: 'always', next: '*', prev: 'singleline-const' },
65
- { blankLine: 'always', next: '*', prev: 'singleline-let' },
66
- { blankLine: 'always', next: '*', prev: 'singleline-var' },
67
- { blankLine: 'always', next: '*', prev: 'type' },
68
- { blankLine: 'always', next: 'block-like', prev: '*' },
69
- { blankLine: 'always', next: 'cjs-export', prev: '*' },
70
- { blankLine: 'always', next: 'cjs-import', prev: '*' },
71
- { blankLine: 'always', next: 'class', prev: '*' },
72
- { blankLine: 'always', next: 'enum', prev: '*' },
73
- { blankLine: 'always', next: 'export', prev: '*' },
74
- { blankLine: 'always', next: 'expression', prev: '*' },
75
- { blankLine: 'always', next: 'function', prev: '*' },
76
- { blankLine: 'always', next: 'iife', prev: '*' },
77
- { blankLine: 'always', next: 'import', prev: '*' },
78
- { blankLine: 'always', next: 'interface', prev: '*' },
79
- { blankLine: 'always', next: 'multiline-block-like', prev: '*' },
80
- { blankLine: 'always', next: 'multiline-const', prev: '*' },
81
- { blankLine: 'always', next: 'multiline-expression', prev: '*' },
82
- { blankLine: 'always', next: 'multiline-let', prev: '*' },
83
- { blankLine: 'always', next: 'multiline-var', prev: '*' },
84
- { blankLine: 'always', next: 'return', prev: '*' },
85
- { blankLine: 'always', next: 'switch', prev: '*' },
86
- { blankLine: 'always', next: 'type', prev: '*' },
87
- // any
88
- { blankLine: 'any', next: 'expression', prev: 'expression' },
89
- {
90
- blankLine: 'any',
91
- next: 'singleline-const',
92
- prev: 'singleline-const',
93
- },
94
- { blankLine: 'any', next: 'export', prev: 'export' },
95
- { blankLine: 'any', next: 'import', prev: 'import' },
96
- { blankLine: 'any', next: 'singleline-let', prev: 'singleline-let' },
97
- { blankLine: 'any', next: 'singleline-var', prev: 'singleline-var' },
98
- // never
99
- { blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
100
- { blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
101
- { blankLine: 'never', next: 'directive', prev: 'directive' },
102
- { blankLine: 'never', next: 'function', prev: 'function-overload' },
103
- ],
6
+ /**
7
+ * Правила форматирования и стиля кода.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [@stylistic/eslint-plugin](https://eslint.style/)
14
+ */
15
+ export const stylistic = (config = []) =>
16
+ defineConfig([
17
+ {
18
+ ...plugin.configs.recommended,
19
+ ignores: [...(plugin.configs.recommended.ignores ?? []), ...DATA_FILES],
104
20
  },
105
- },
106
- ]);
21
+ {
22
+ files: FILES,
23
+ plugins: { '@stylistic': plugin },
24
+ rules: {
25
+ '@stylistic/lines-around-comment': [
26
+ 'warn',
27
+ {
28
+ afterBlockComment: false,
29
+ afterHashbangComment: true,
30
+ afterLineComment: false,
31
+ allowArrayEnd: true,
32
+ allowArrayStart: true,
33
+ allowBlockEnd: true,
34
+ allowBlockStart: true,
35
+ allowClassEnd: true,
36
+ allowClassStart: true,
37
+ allowEnumEnd: true,
38
+ allowEnumStart: true,
39
+ allowInterfaceEnd: true,
40
+ allowInterfaceStart: true,
41
+ allowModuleEnd: true,
42
+ allowModuleStart: true,
43
+ allowObjectEnd: true,
44
+ allowObjectStart: true,
45
+ allowTypeEnd: true,
46
+ allowTypeStart: true,
47
+ applyDefaultIgnorePatterns: true,
48
+ beforeBlockComment: false,
49
+ beforeLineComment: false,
50
+ },
51
+ ],
52
+ '@stylistic/padding-line-between-statements': [
53
+ 'warn',
54
+ // always
55
+ { blankLine: 'always', next: '*', prev: 'block-like' },
56
+ { blankLine: 'always', next: '*', prev: 'case' },
57
+ { blankLine: 'always', next: '*', prev: 'cjs-export' },
58
+ { blankLine: 'always', next: '*', prev: 'cjs-import' },
59
+ { blankLine: 'always', next: '*', prev: 'class' },
60
+ { blankLine: 'always', next: '*', prev: 'default' },
61
+ { blankLine: 'always', next: '*', prev: 'directive' },
62
+ { blankLine: 'always', next: '*', prev: 'enum' },
63
+ { blankLine: 'always', next: '*', prev: 'export' },
64
+ { blankLine: 'always', next: '*', prev: 'expression' },
65
+ { blankLine: 'always', next: '*', prev: 'iife' },
66
+ { blankLine: 'always', next: '*', prev: 'import' },
67
+ { blankLine: 'always', next: '*', prev: 'interface' },
68
+ { blankLine: 'always', next: '*', prev: 'multiline-block-like' },
69
+ { blankLine: 'always', next: '*', prev: 'multiline-const' },
70
+ { blankLine: 'always', next: '*', prev: 'multiline-expression' },
71
+ { blankLine: 'always', next: '*', prev: 'multiline-let' },
72
+ { blankLine: 'always', next: '*', prev: 'multiline-var' },
73
+ { blankLine: 'always', next: '*', prev: 'singleline-const' },
74
+ { blankLine: 'always', next: '*', prev: 'singleline-let' },
75
+ { blankLine: 'always', next: '*', prev: 'singleline-var' },
76
+ { blankLine: 'always', next: '*', prev: 'type' },
77
+ { blankLine: 'always', next: 'block-like', prev: '*' },
78
+ { blankLine: 'always', next: 'cjs-export', prev: '*' },
79
+ { blankLine: 'always', next: 'cjs-import', prev: '*' },
80
+ { blankLine: 'always', next: 'class', prev: '*' },
81
+ { blankLine: 'always', next: 'enum', prev: '*' },
82
+ { blankLine: 'always', next: 'export', prev: '*' },
83
+ { blankLine: 'always', next: 'expression', prev: '*' },
84
+ { blankLine: 'always', next: 'function', prev: '*' },
85
+ { blankLine: 'always', next: 'iife', prev: '*' },
86
+ { blankLine: 'always', next: 'import', prev: '*' },
87
+ { blankLine: 'always', next: 'interface', prev: '*' },
88
+ { blankLine: 'always', next: 'multiline-block-like', prev: '*' },
89
+ { blankLine: 'always', next: 'multiline-const', prev: '*' },
90
+ { blankLine: 'always', next: 'multiline-expression', prev: '*' },
91
+ { blankLine: 'always', next: 'multiline-let', prev: '*' },
92
+ { blankLine: 'always', next: 'multiline-var', prev: '*' },
93
+ { blankLine: 'always', next: 'return', prev: '*' },
94
+ { blankLine: 'always', next: 'switch', prev: '*' },
95
+ { blankLine: 'always', next: 'type', prev: '*' },
96
+ // any
97
+ { blankLine: 'any', next: 'expression', prev: 'expression' },
98
+ {
99
+ blankLine: 'any',
100
+ next: 'singleline-const',
101
+ prev: 'singleline-const',
102
+ },
103
+ { blankLine: 'any', next: 'export', prev: 'export' },
104
+ { blankLine: 'any', next: 'import', prev: 'import' },
105
+ { blankLine: 'any', next: 'singleline-let', prev: 'singleline-let' },
106
+ { blankLine: 'any', next: 'singleline-var', prev: 'singleline-var' },
107
+ // never
108
+ { blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
109
+ { blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
110
+ { blankLine: 'never', next: 'directive', prev: 'directive' },
111
+ { blankLine: 'never', next: 'function', prev: 'function-overload' },
112
+ ],
113
+ },
114
+ },
115
+
116
+ config,
117
+ ]);
@@ -3,31 +3,45 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
+ const DEFAULT_CSS_CONFIG_PATH = './styles/tailwind.css';
7
+
8
+ const recommended = plugin.configs.recommended;
9
+
6
10
  /**
7
- * @example
8
- * import path from 'node:path';
11
+ * Правила для Tailwind CSS.
9
12
  *
10
- * tailwindcss({
11
- * cssConfigPath: path.resolve(import.meta.dirname, 'src/tailwind.css'),
13
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
14
+ * Например, чтобы переопределить путь к CSS-файлу Tailwind:
15
+ *
16
+ * ```js
17
+ * plugins.tailwindcss({
18
+ * settings: {
19
+ * tailwindcss: {
20
+ * cssConfigPath: path.resolve(import.meta.dirname, 'src/main.css'),
21
+ * },
22
+ * },
12
23
  * });
24
+ * ```
13
25
  *
14
- * @param settings {import('eslint-plugin-tailwindcss').PluginSettings}
26
+ * @returns {import('eslint').Linter.Config[]}
15
27
  *
16
28
  * @see [eslint-plugin-tailwindcss](https://github.com/francoismassart/eslint-plugin-tailwindcss)
17
29
  */
18
- export const tailwindcss = (settings) =>
30
+ export const tailwindcss = (config = []) =>
19
31
  defineConfig([
20
32
  {
33
+ ...recommended,
21
34
  files: FILES,
22
- plugins: { tailwindcss: plugin },
23
35
  rules: {
24
- ...plugin.configs.recommended.rules,
36
+ ...recommended.rules,
25
37
  'tailwindcss/no-custom-classname': 'off',
26
38
  'vue/static-class-names-order': 'off',
27
39
  },
28
40
  settings: {
29
- /** @type {import('eslint-plugin-tailwindcss').PluginSettings} */
30
- tailwindcss: { cssConfigPath: './styles/tailwind.css', ...settings },
41
+ ...recommended.settings,
42
+ tailwindcss: { cssConfigPath: DEFAULT_CSS_CONFIG_PATH },
31
43
  },
32
44
  },
45
+
46
+ config,
33
47
  ]);