@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,12 +3,23 @@ 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
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [@tanstack/query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
14
+ */
15
+ export const tanstackQuery = (config = []) =>
16
+ defineConfig([
17
+ // The shipped config has no `files` key, so it would also cover data files.
18
+ ...plugin.configs['flat/recommended'].map((config) => ({
19
+ ...config,
20
+ ignores: [...(config.ignores ?? []), ...DATA_FILES],
21
+ })),
22
+ { rules: { '@tanstack/query/infinite-query-property-order': 'off' } },
23
+
24
+ config,
25
+ ]);
@@ -5,46 +5,55 @@ import { DATA_FILES, FILES, TEST_FILES, TS_FILES } from '../base.js';
5
5
  import { TS_RULES } from '../rules/typescript.js';
6
6
 
7
7
  /**
8
- * Type-aware TypeScript config.
8
+ * Type-aware правила TypeScript.
9
9
  *
10
10
  * Opt-in: requires a `tsconfig.json` in the project and needs type information,
11
11
  * which makes linting slower. Use it instead of `typescript`, not alongside
12
12
  * it.
13
13
  *
14
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
15
+ *
16
+ * @returns {import('eslint').Linter.Config[]}
17
+ *
14
18
  * @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
15
19
  */
16
- export const typescriptTypeChecked = defineConfig([
17
- // The parser is needed for every JS/TS/Vue file, not only for TypeScript ones,
18
- // otherwise `.js` files fall back to the default parser and modern syntax
19
- // (`import.meta`, top-level await) breaks.
20
- { ...plugin.configs.base, files: FILES },
20
+ export const typescriptTypeChecked = (config = []) =>
21
+ defineConfig([
22
+ // The parser is needed for every JS/TS/Vue file, not only for TypeScript ones,
23
+ // otherwise `.js` files fall back to the default parser and modern syntax
24
+ // (`import.meta`, top-level await) breaks.
25
+ { ...plugin.configs.base, files: FILES },
26
+
27
+ // Non type-aware rules - the same scope as the regular `typescript` plugin,
28
+ // so `.js`/`.vue` files keep the TypeScript versions of the rules.
29
+ // `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
30
+ // so they would also land on data files that are not JavaScript at all.
31
+ ...[...plugin.configs.strict, ...plugin.configs.stylistic].map(
32
+ (config) => ({
33
+ ...config,
34
+ ignores: [...(config.ignores ?? []), ...DATA_FILES],
35
+ }),
36
+ ),
21
37
 
22
- // Non type-aware rules — the same scope as the regular `typescript` plugin,
23
- // so `.js`/`.vue` files keep the TypeScript versions of the rules.
24
- // `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
25
- // so they would also land on data files that are not JavaScript at all.
26
- ...[...plugin.configs.strict, ...plugin.configs.stylistic].map((config) => ({
27
- ...config,
28
- ignores: [...(config.ignores ?? []), ...DATA_FILES],
29
- })),
38
+ // Type-aware rules only make sense where the type information is available.
39
+ ...plugin.configs.strictTypeChecked.map((config) => ({
40
+ ...config,
41
+ files: TS_FILES,
42
+ })),
43
+ ...plugin.configs.stylisticTypeChecked.map((config) => ({
44
+ ...config,
45
+ files: TS_FILES,
46
+ })),
30
47
 
31
- // Type-aware rules only make sense where the type information is available.
32
- ...plugin.configs.strictTypeChecked.map((config) => ({
33
- ...config,
34
- files: TS_FILES,
35
- })),
36
- ...plugin.configs.stylisticTypeChecked.map((config) => ({
37
- ...config,
38
- files: TS_FILES,
39
- })),
48
+ {
49
+ files: TS_FILES,
50
+ languageOptions: { parserOptions: { projectService: true } },
51
+ rules: TS_RULES,
52
+ },
53
+ {
54
+ files: TEST_FILES,
55
+ rules: { '@typescript-eslint/no-empty-function': 'off' },
56
+ },
40
57
 
41
- {
42
- files: TS_FILES,
43
- languageOptions: { parserOptions: { projectService: true } },
44
- rules: TS_RULES,
45
- },
46
- {
47
- files: TEST_FILES,
48
- rules: { '@typescript-eslint/no-empty-function': 'off' },
49
- },
50
- ]);
58
+ config,
59
+ ]);
@@ -4,18 +4,31 @@ import plugin from 'typescript-eslint';
4
4
  import { DATA_FILES, FILES, TEST_FILES } from '../base.js';
5
5
  import { TS_RULES } from '../rules/typescript.js';
6
6
 
7
- /** @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) */
8
- export const typescript = defineConfig([
9
- // `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
10
- // so they would also land on data files that are not JavaScript at all.
11
- ...[...plugin.configs.strict, ...plugin.configs.stylistic].map((config) => ({
12
- ...config,
13
- ignores: [...(config.ignores ?? []), ...DATA_FILES],
14
- })),
7
+ /**
8
+ * Правила TypeScript без анализа типов.
9
+ *
10
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
11
+ *
12
+ * @returns {import('eslint').Linter.Config[]}
13
+ *
14
+ * @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
15
+ */
16
+ export const typescript = (config = []) =>
17
+ defineConfig([
18
+ // `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
19
+ // so they would also land on data files that are not JavaScript at all.
20
+ ...[...plugin.configs.strict, ...plugin.configs.stylistic].map(
21
+ (config) => ({
22
+ ...config,
23
+ ignores: [...(config.ignores ?? []), ...DATA_FILES],
24
+ }),
25
+ ),
15
26
 
16
- { files: FILES, rules: TS_RULES },
17
- {
18
- files: TEST_FILES,
19
- rules: { '@typescript-eslint/no-empty-function': 'off' },
20
- },
21
- ]);
27
+ { files: FILES, rules: TS_RULES },
28
+ {
29
+ files: TEST_FILES,
30
+ rules: { '@typescript-eslint/no-empty-function': 'off' },
31
+ },
32
+
33
+ config,
34
+ ]);
@@ -3,70 +3,83 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { DTS_FILES, FILES, VUE_FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) */
7
- export const unicorn = defineConfig([
8
- { ...plugin.configs.recommended, files: FILES },
9
- {
10
- files: FILES,
11
- rules: {
12
- 'unicorn/comment-content': ['warn'],
13
- 'unicorn/consistent-function-scoping': [
14
- 'error',
15
- { checkArrowFunctions: false },
16
- ],
17
- 'unicorn/consistent-function-style': [
18
- 'error',
19
- { default: 'arrow-function' },
6
+ /**
7
+ * Правила unicorn.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
14
+ */
15
+ export const unicorn = (config = []) =>
16
+ defineConfig([
17
+ { ...plugin.configs.recommended, files: FILES },
18
+ {
19
+ files: FILES,
20
+ rules: {
21
+ 'unicorn/comment-content': ['warn'],
22
+ 'unicorn/consistent-function-scoping': [
23
+ 'error',
24
+ { checkArrowFunctions: false },
25
+ ],
26
+ 'unicorn/consistent-function-style': [
27
+ 'error',
28
+ { default: 'arrow-function' },
29
+ ],
30
+ // Explicit: the default happens to be kebab case, but the intent is
31
+ // worth pinning down. Applies to `.vue` components too, which is why
32
+ // `vue/match-component-file-name` is kept in sync with it in `vue.js`.
33
+ 'unicorn/filename-case': ['error', { case: 'kebabCase' }],
34
+ 'unicorn/iteration-fallback-style': ['error', 'guard'],
35
+ 'unicorn/name-replacements': 'off',
36
+ 'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
37
+ 'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
38
+ 'unicorn/no-empty-file': 'off',
39
+ 'unicorn/no-for-each': 'off',
40
+ 'unicorn/no-this-outside-of-class': 'off', // used in setters/getters
41
+ 'unicorn/no-top-level-side-effects': 'off', // Vue.js specific
42
+ 'unicorn/no-unused-properties': 'off', // don't respect local keys
43
+ 'unicorn/prefer-dom-node-html-methods': 'off', // Safari not supports setHTML()
44
+ 'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
45
+ 'unicorn/prefer-https': 'off', // SVG need HTTP
46
+ 'unicorn/prefer-import-meta-properties': 'warn',
47
+ 'unicorn/prefer-iterator-concat': 'off', // ES2026 only
48
+ 'unicorn/prefer-json-import': 'warn',
49
+ 'unicorn/prefer-module': 'warn',
50
+ 'unicorn/prefer-node-protocol': 'warn',
51
+ 'unicorn/prefer-temporal': 'off', // ES2026 only
52
+ 'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
53
+ 'unicorn/prefer-uint8array-hex': 'warn',
54
+ 'unicorn/relative-url-style': ['error', 'always'],
55
+ 'unicorn/single-line-block-comment-style': 'off',
56
+ },
57
+ },
58
+ { files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
59
+ { files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
60
+ {
61
+ // `null` is part of the type contract in Vue.js SFC:
62
+ // `ref<Type | null>(null)` is the idiomatic way to declare an initially
63
+ // empty reactive value. Everywhere else `null` remains an error.
64
+ files: VUE_FILES,
65
+ rules: { 'unicorn/no-null': 'off' },
66
+ },
67
+ {
68
+ files: [
69
+ '**/*.{api,endpoints,fixtures,schemas,service,spec,test}.{js,ts}',
20
70
  ],
21
- // Explicit: the default happens to be kebab case, but the intent is
22
- // worth pinning down. Applies to `.vue` components too, which is why
23
- // `vue/match-component-file-name` is kept in sync with it in `vue.js`.
24
- 'unicorn/filename-case': ['error', { case: 'kebabCase' }],
25
- 'unicorn/iteration-fallback-style': ['error', 'guard'],
26
- 'unicorn/name-replacements': 'off',
27
- 'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
28
- 'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
29
- 'unicorn/no-empty-file': 'off',
30
- 'unicorn/no-for-each': 'off',
31
- 'unicorn/no-this-outside-of-class': 'off', // used in setters/getters
32
- 'unicorn/no-top-level-side-effects': 'off', // Vue.js specific
33
- 'unicorn/no-unused-properties': 'off', // don't respect local keys
34
- 'unicorn/prefer-dom-node-html-methods': 'off', // Safari not supports setHTML()
35
- 'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
36
- 'unicorn/prefer-https': 'off', // SVG need HTTP
37
- 'unicorn/prefer-import-meta-properties': 'warn',
38
- 'unicorn/prefer-iterator-concat': 'off', // ES2026 only
39
- 'unicorn/prefer-json-import': 'warn',
40
- 'unicorn/prefer-module': 'warn',
41
- 'unicorn/prefer-node-protocol': 'warn',
42
- 'unicorn/prefer-temporal': 'off', // ES2026 only
43
- 'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
44
- 'unicorn/prefer-uint8array-hex': 'warn',
45
- 'unicorn/relative-url-style': ['error', 'always'],
46
- 'unicorn/single-line-block-comment-style': 'off',
71
+ rules: {
72
+ 'unicorn/max-nested-calls': 'off',
73
+ 'unicorn/no-keyword-prefix': 'off',
74
+ 'unicorn/no-null': 'off',
75
+ 'unicorn/no-object-as-default-parameter': 'off',
76
+ 'unicorn/no-useless-undefined': 'off',
77
+ },
47
78
  },
48
- },
49
- { files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
50
- { files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
51
- {
52
- // `null` is part of the type contract in Vue.js SFC:
53
- // `ref<Type | null>(null)` is the idiomatic way to declare an initially
54
- // empty reactive value. Everywhere else `null` remains an error.
55
- files: VUE_FILES,
56
- rules: { 'unicorn/no-null': 'off' },
57
- },
58
- {
59
- files: ['**/*.{api,endpoints,fixtures,schemas,service,spec,test}.{js,ts}'],
60
- rules: {
61
- 'unicorn/max-nested-calls': 'off',
62
- 'unicorn/no-keyword-prefix': 'off',
63
- 'unicorn/no-null': 'off',
64
- 'unicorn/no-object-as-default-parameter': 'off',
65
- 'unicorn/no-useless-undefined': 'off',
79
+ {
80
+ files: ['**/temp/**/*.vue'],
81
+ rules: { 'unicorn/name-replacements': 'off' },
66
82
  },
67
- },
68
- {
69
- files: ['**/temp/**/*.vue'],
70
- rules: { 'unicorn/name-replacements': 'off' },
71
- },
72
- ]);
83
+
84
+ config,
85
+ ]);
@@ -3,8 +3,19 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint) */
7
- export const unocss = defineConfig([
8
- { files: FILES, ...plugin },
9
- { files: FILES, rules: { 'unocss/order-attributify': 'off' } },
10
- ]);
6
+ /**
7
+ * Правила для UnoCSS.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint)
14
+ */
15
+ export const unocss = (config = []) =>
16
+ defineConfig([
17
+ { files: FILES, ...plugin },
18
+ { files: FILES, rules: { 'unocss/order-attributify': 'off' } },
19
+
20
+ config,
21
+ ]);
@@ -3,18 +3,29 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { TEST_FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) */
7
- export const vitest = defineConfig([
8
- {
9
- files: TEST_FILES,
10
- plugins: { vitest: plugin },
11
- rules: {
12
- ...plugin.configs.recommended.rules,
6
+ /**
7
+ * Правила для тестов Vitest.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
14
+ */
15
+ export const vitest = (config = []) =>
16
+ defineConfig([
17
+ {
18
+ files: TEST_FILES,
19
+ plugins: { vitest: plugin },
20
+ rules: {
21
+ ...plugin.configs.recommended.rules,
13
22
 
14
- 'vitest/no-conditional-in-test': 'off',
15
- 'vitest/no-conditional-tests': 'off',
16
- 'vitest/no-hooks': 'off',
17
- 'vitest/require-to-throw-message': 'off',
23
+ 'vitest/no-conditional-in-test': 'off',
24
+ 'vitest/no-conditional-tests': 'off',
25
+ 'vitest/no-hooks': 'off',
26
+ 'vitest/require-to-throw-message': 'off',
27
+ },
18
28
  },
19
- },
20
- ]);
29
+
30
+ config,
31
+ ]);
@@ -1,18 +1,31 @@
1
1
  import plugin from 'eslint-plugin-vuejs-accessibility';
2
2
  import { defineConfig } from 'eslint/config';
3
3
 
4
- /** @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/) */
5
- export const vueAccessibility = defineConfig([
6
- ...plugin.configs['flat/recommended'],
4
+ import { VUE_FILES } from '../base.js';
7
5
 
8
- {
9
- files: ['**/*.vue'],
10
- rules: {
11
- 'vuejs-accessibility/label-has-for': [
12
- 'warn',
13
- { allowChildren: true, required: { some: ['nesting', 'id'] } },
14
- ],
15
- 'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
6
+ /**
7
+ * Правила доступности Vue.js-компонентов.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/)
14
+ */
15
+ export const vueAccessibility = (config = []) =>
16
+ defineConfig([
17
+ ...plugin.configs['flat/recommended'],
18
+
19
+ {
20
+ files: VUE_FILES,
21
+ rules: {
22
+ 'vuejs-accessibility/label-has-for': [
23
+ 'warn',
24
+ { allowChildren: true, required: { some: ['nesting', 'id'] } },
25
+ ],
26
+ 'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
27
+ },
16
28
  },
17
- },
18
- ]);
29
+
30
+ config,
31
+ ]);
@@ -1,39 +1,51 @@
1
1
  import plugin from '@intlify/eslint-plugin-vue-i18n';
2
2
  import { defineConfig } from 'eslint/config';
3
3
 
4
- import { DATA_FILES } from '../base.js';
4
+ import { DATA_FILES, VUE_FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/) */
7
- export const vueI18n = defineConfig([
8
- ...plugin.configs['flat/recommended'].map((config) => ({
9
- ...config,
10
- ignores: [...(config.ignores ?? []), ...DATA_FILES],
11
- })),
6
+ /**
7
+ * Правила для Vue.js I18n.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/)
14
+ */
15
+ export const vueI18n = (config = []) =>
16
+ defineConfig([
17
+ ...plugin.configs['flat/recommended'].map((config) =>
18
+ config.files
19
+ ? config
20
+ : { ...config, ignores: [...(config.ignores ?? []), ...DATA_FILES] },
21
+ ),
12
22
 
13
- {
14
- files: ['**/*.vue'],
15
- rules: {
16
- '@intlify/vue-i18n/key-format-style': [
17
- 'error',
18
- 'snake_case',
19
- { allowArray: false },
20
- ],
21
- '@intlify/vue-i18n/no-duplicate-keys-in-locale': [
22
- 'error',
23
- { ignoreI18nBlock: false },
24
- ],
25
- '@intlify/vue-i18n/no-dynamic-keys': 'warn',
26
- '@intlify/vue-i18n/no-raw-text': 'off',
27
- '@intlify/vue-i18n/no-unused-keys': 'warn',
28
- '@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
23
+ {
24
+ files: VUE_FILES,
25
+ rules: {
26
+ '@intlify/vue-i18n/key-format-style': [
27
+ 'error',
28
+ 'snake_case',
29
+ { allowArray: false },
30
+ ],
31
+ '@intlify/vue-i18n/no-duplicate-keys-in-locale': [
32
+ 'error',
33
+ { ignoreI18nBlock: false },
34
+ ],
35
+ '@intlify/vue-i18n/no-dynamic-keys': 'warn',
36
+ '@intlify/vue-i18n/no-raw-text': 'off',
37
+ '@intlify/vue-i18n/no-unused-keys': 'warn',
38
+ '@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
39
+ },
29
40
  },
30
- },
31
- {
32
- settings: {
33
- 'vue-i18n': {
34
- localeDir: './**/locales/*.{json,json5,yaml,yml}',
35
- messageSyntaxVersion: '^9.0.0',
41
+ {
42
+ settings: {
43
+ 'vue-i18n': {
44
+ localeDir: './**/locales/*.{json,json5,yaml,yml}',
45
+ messageSyntaxVersion: '^9.0.0',
46
+ },
36
47
  },
37
48
  },
38
- },
39
- ]);
49
+
50
+ config,
51
+ ]);