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