@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
@@ -1,3 +1,85 @@
1
+ import { defineConfig as defineFlatConfig } from 'eslint/config';
2
+
3
+ import { base } from './base.js';
4
+ import { deMorgan } from './plugins/de-morgan.js';
5
+ import { importX } from './plugins/import-x.js';
6
+ import { javascript } from './plugins/javascript.js';
7
+ import { jsdoc } from './plugins/jsdoc.js';
8
+ import { json } from './plugins/json.js';
9
+ import { perfectionist } from './plugins/perfectionist.js';
10
+ import { pinia } from './plugins/pinia.js';
11
+ import { prettier, prettierConfig } from './plugins/prettier.js';
12
+ import { regexp } from './plugins/regexp.js';
13
+ import { sonar } from './plugins/sonar.js';
14
+ import { stylistic } from './plugins/stylistic.js';
15
+ import { tailwindcss } from './plugins/tailwindcss.js';
16
+ import { tanstackQuery } from './plugins/tanstack-query.js';
17
+ import { typescriptTypeChecked } from './plugins/typescript-type-checked.js';
18
+ import { typescript } from './plugins/typescript.js';
19
+ import { unicorn } from './plugins/unicorn.js';
20
+ import { unocss } from './plugins/unocss.js';
21
+ import { vitest } from './plugins/vitest.js';
22
+ import { vueAccessibility } from './plugins/vue-accessibility.js';
23
+ import { vueI18n } from './plugins/vue-i18n.js';
24
+ import { vue } from './plugins/vue.js';
25
+ import { zod } from './plugins/zod.js';
26
+
27
+ /**
28
+ * Фабрики плагинов. Каждый вызов возвращает массив flat-конфигов, который нужно
29
+ * развернуть через spread: `...plugins.<name>()`.
30
+ *
31
+ * Любая фабрика принимает необязательный конфиг, который добавляется после
32
+ * предустановленных блоков и переопределяет их.
33
+ */
34
+ export const plugins = {
35
+ deMorgan,
36
+ importX,
37
+ javascript,
38
+ jsdoc,
39
+ json,
40
+ perfectionist,
41
+ pinia,
42
+ prettier,
43
+ prettierConfig,
44
+ regexp,
45
+ sonar,
46
+ stylistic,
47
+ tailwindcss,
48
+ tanstackQuery,
49
+ typescript,
50
+ typescriptTypeChecked,
51
+ unicorn,
52
+ unocss,
53
+ vitest,
54
+ vue,
55
+ vueAccessibility,
56
+ vueI18n,
57
+ zod,
58
+ };
59
+
60
+ /**
61
+ * Создать конфигурацию ESLint
62
+ *
63
+ * Базовые настройки (`base`) добавляются автоматически и всегда идут первыми.
64
+ * Разворачивайте вызовы плагинов через spread-оператор, а переопределения
65
+ * добавляйте прямо в массив.
66
+ *
67
+ * @example
68
+ * import { defineConfig, plugins } from '@alexlit/config-eslint';
69
+ *
70
+ * export default defineConfig([
71
+ * ...plugins.javascript(),
72
+ * ...plugins.unicorn({ rules: { 'unicorn/no-null': 'off' } }),
73
+ * { rules: { 'no-console': 'off' } },
74
+ * ...plugins.prettierConfig(), // последним
75
+ * ]);
76
+ *
77
+ * @param {import('eslint').Linter.Config[]} [configs] - Массив flat-конфигов
78
+ *
79
+ * @returns {import('eslint').Linter.Config[]}
80
+ */
81
+ export const defineConfig = (configs = []) => defineFlatConfig([base, configs]);
82
+
1
83
  export {
2
84
  base,
3
85
  DATA_FILES,
@@ -10,28 +92,5 @@ export {
10
92
  VUE_FILES,
11
93
  YAML_FILES,
12
94
  } from './base.js';
13
-
14
- export { deMorgan } from './plugins/de-morgan.js';
15
- export { importX } from './plugins/import-x.js';
16
- export { javascript } from './plugins/javascript.js';
17
- export { jsdoc } from './plugins/jsdoc.js';
18
- export { json } from './plugins/json.js';
19
- export { perfectionist } from './plugins/perfectionist.js';
20
- export { pinia } from './plugins/pinia.js';
21
- export { prettier, prettierConfig } from './plugins/prettier.js';
22
- export { regexp } from './plugins/regexp.js';
23
- export { sonar } from './plugins/sonar.js';
24
- export { stylistic } from './plugins/stylistic.js';
25
- export { tailwindcss } from './plugins/tailwindcss.js';
26
- export { tanstackQuery } from './plugins/tanstack-query.js';
27
- export { typescriptTypeChecked } from './plugins/typescript-type-checked.js';
28
- export { typescript } from './plugins/typescript.js';
29
- export { unicorn } from './plugins/unicorn.js';
30
- export { unocss } from './plugins/unocss.js';
31
- export { vitest } from './plugins/vitest.js';
32
- export { vueAccessibility } from './plugins/vue-accessibility.js';
33
- export { vueI18n } from './plugins/vue-i18n.js';
34
- export { vue } from './plugins/vue.js';
35
- export { zod } from './plugins/zod.js';
36
95
  export { NO_RESTRICTED_SYNTAX } from './rules/restricted-syntax.js';
37
96
  export { TS_RULES } from './rules/typescript.js';
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@alexlit/config-eslint",
3
- "version": "161.4.0",
3
+ "version": "163.0.0",
4
4
  "private": false,
5
- "description": "Sharable ESLint configuration",
5
+ "description": "eslint config",
6
6
  "keywords": [
7
+ "code-quality",
8
+ "config",
7
9
  "eslint",
8
10
  "eslint-config",
9
- "lint",
10
- "code-quality",
11
11
  "javascript",
12
+ "lint",
12
13
  "typescript"
13
14
  ],
14
15
  "homepage": "https://github.com/alex-lit/lint-kit/tree/master/packages/config-eslint#readme",
@@ -23,21 +24,23 @@
23
24
  "license": "MIT",
24
25
  "author": "Alexey Litovchenko <alex.lit@outlook.com> (https://github.com/alex-lit)",
25
26
  "type": "module",
26
- "main": "./index.js",
27
+ "main": "index.js",
28
+ "types": "index.d.ts",
27
29
  "files": [
28
- "index.js",
30
+ "README.md",
29
31
  "base.js",
32
+ "index.d.ts",
33
+ "index.js",
30
34
  "plugins/",
31
- "rules/",
32
- "README.md"
35
+ "rules/"
33
36
  ],
34
37
  "scripts": {
35
38
  "inspect": "npx @eslint/config-inspector@latest",
36
39
  "lint": "cd ../../ && ./scripts/lint.eslint.sh",
37
- "ou": "sh ../../scripts/ou.sh",
38
- "release": "sh ../../scripts/release.sh",
39
- "semver": "sh ../../scripts/semver.sh",
40
- "up": "sh ../../scripts/up.sh"
40
+ "ou": "../../scripts/ou.sh",
41
+ "release": "../../scripts/release.sh",
42
+ "semver": "../../scripts/semver.sh",
43
+ "up": "../../scripts/up.sh"
41
44
  },
42
45
  "dependencies": {
43
46
  "@eslint/js": "^10.0.1",
@@ -46,13 +49,13 @@
46
49
  "@stylistic/eslint-plugin": "^5.10.0",
47
50
  "@tanstack/eslint-plugin-query": "^5.104.5",
48
51
  "@unocss/eslint-config": "^66.11.0",
49
- "@vitest/eslint-plugin": "^1.6.27",
52
+ "@vitest/eslint-plugin": "^1.6.28",
50
53
  "eslint": "^10.13.0",
51
54
  "eslint-config-prettier": "^10.1.8",
52
55
  "eslint-plugin-de-morgan": "^2.2.1",
53
56
  "eslint-plugin-import-x": "^4.17.1",
54
- "eslint-plugin-jsdoc": "^65.3.15",
55
- "eslint-plugin-perfectionist": "^5.12.1",
57
+ "eslint-plugin-jsdoc": "^65.4.1",
58
+ "eslint-plugin-perfectionist": "^5.13.0",
56
59
  "eslint-plugin-pinia": "^0.4.2",
57
60
  "eslint-plugin-prettier": "^5.5.7",
58
61
  "eslint-plugin-regexp": "^3.3.1",
@@ -60,8 +63,8 @@
60
63
  "eslint-plugin-tailwindcss": "^4.4.0",
61
64
  "eslint-plugin-unicorn": "^78.0.0",
62
65
  "eslint-plugin-vue": "^10.11.1",
63
- "eslint-plugin-vuejs-accessibility": "^2.6.2",
64
- "eslint-plugin-zod": "^5.2.0",
66
+ "eslint-plugin-vuejs-accessibility": "^2.6.3",
67
+ "eslint-plugin-zod": "^5.2.1",
65
68
  "globals": "^17.13.0",
66
69
  "jsonc-eslint-parser": "^3.3.0",
67
70
  "typescript": "^6.0.3",
@@ -3,7 +3,14 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan) */
7
- export const deMorgan = defineConfig([
8
- { files: FILES, ...plugin.configs.recommended },
9
- ]);
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-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
14
+ */
15
+ export const deMorgan = (config = []) =>
16
+ defineConfig([{ files: FILES, ...plugin.configs.recommended }, config]);
@@ -18,44 +18,61 @@ const EXTENSIONS = [
18
18
  '.json',
19
19
  ];
20
20
 
21
- /** @see [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) */
22
- export const importX = defineConfig([
23
- { ...plugin.flatConfigs.recommended, files: FILES, ignores: DATA_FILES },
21
+ /**
22
+ * Правила для импортов и модулей.
23
+ *
24
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
25
+ *
26
+ * @returns {import('eslint').Linter.Config[]}
27
+ *
28
+ * @see [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
29
+ */
30
+ export const importX = (config = []) =>
31
+ defineConfig([
32
+ { ...plugin.flatConfigs.recommended, files: FILES, ignores: DATA_FILES },
24
33
 
25
- {
26
- files: FILES,
27
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
28
- plugins: { 'import-x': plugin },
29
- rules: {
30
- 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
31
- 'import-x/first': 'error',
32
- 'import-x/newline-after-import': 'warn',
33
- 'import-x/no-absolute-path': 'error',
34
- 'import-x/no-cycle': 'error',
35
- 'import-x/no-extraneous-dependencies': 'error',
36
- 'import-x/no-named-as-default': 'off',
37
- 'import-x/no-named-as-default-member': 'off',
38
- 'import-x/no-nodejs-modules': 'off',
39
- 'import-x/no-self-import': 'error',
40
- 'import-x/no-unresolved': 'off',
41
- 'import-x/no-useless-path-segments': ['error', { noUselessIndex: true }],
42
- 'import-x/unambiguous': 'error',
34
+ {
35
+ files: FILES,
36
+ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
37
+ plugins: { 'import-x': plugin },
38
+ rules: {
39
+ 'import-x/consistent-type-specifier-style': [
40
+ 'error',
41
+ 'prefer-top-level',
42
+ ],
43
+ 'import-x/first': 'error',
44
+ 'import-x/newline-after-import': 'warn',
45
+ 'import-x/no-absolute-path': 'error',
46
+ 'import-x/no-cycle': 'error',
47
+ 'import-x/no-extraneous-dependencies': 'error',
48
+ 'import-x/no-named-as-default': 'off',
49
+ 'import-x/no-named-as-default-member': 'off',
50
+ 'import-x/no-nodejs-modules': 'off',
51
+ 'import-x/no-self-import': 'error',
52
+ 'import-x/no-unresolved': 'off',
53
+ 'import-x/no-useless-path-segments': [
54
+ 'error',
55
+ { noUselessIndex: true },
56
+ ],
57
+ 'import-x/unambiguous': 'error',
58
+ },
59
+ settings: {
60
+ 'import-x/extensions': EXTENSIONS,
61
+ 'import-x/ignore': ['node_modules', String.raw`\.vue$`],
62
+ 'import-x/parsers': { '.vue': [vueParser] },
63
+ 'import-x/resolver-next': [
64
+ createNodeResolver({ extensions: EXTENSIONS, tsconfig: 'auto' }),
65
+ ],
66
+ },
43
67
  },
44
- settings: {
45
- 'import-x/extensions': EXTENSIONS,
46
- 'import-x/ignore': ['node_modules', String.raw`\.vue$`],
47
- 'import-x/parsers': { '.vue': [vueParser] },
48
- 'import-x/resolver-next': [
49
- createNodeResolver({ extensions: EXTENSIONS, tsconfig: 'auto' }),
50
- ],
51
- },
52
- },
53
68
 
54
- {
55
- files: VUE_FILES,
56
- rules: {
57
- 'import-x/no-useless-path-segments': 'off',
58
- 'import-x/unambiguous': 'off',
69
+ {
70
+ files: VUE_FILES,
71
+ rules: {
72
+ 'import-x/no-useless-path-segments': 'off',
73
+ 'import-x/unambiguous': 'off',
74
+ },
59
75
  },
60
- },
61
- ]);
76
+
77
+ config,
78
+ ]);
@@ -5,90 +5,105 @@ import { FILES, TEST_FILES } from '../base.js';
5
5
  import { NO_RESTRICTED_SYNTAX } from '../rules/restricted-syntax.js';
6
6
  import { STYLE_RULES } from '../rules/style.js';
7
7
 
8
- /** @see [eslint](https://eslint.org) */
9
- export const javascript = defineConfig([
10
- { files: FILES, ...plugin.configs.recommended },
11
- {
12
- files: FILES,
13
- rules: {
14
- 'arrow-body-style': ['error', 'as-needed'],
15
- ...STYLE_RULES,
16
- 'default-case-last': 'error',
17
- 'dot-notation': ['error'],
18
- 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
19
- 'no-alert': 'error',
20
- 'no-console': 'warn',
21
- 'no-duplicate-imports': [
22
- 'error',
23
- { allowSeparateTypeImports: true, includeExports: false },
24
- ],
25
- 'no-else-return': 'error',
26
- 'no-implicit-coercion': 'error',
27
- 'no-param-reassign': ['error', { props: false }],
28
- 'no-restricted-exports': [
29
- 'error',
30
- {
31
- restrictedNamedExports: ['then'],
32
- restrictedNamedExportsPattern: '^_',
33
- },
34
- ],
35
- 'no-restricted-globals': [
36
- 'error',
37
- // `event`, `top` and `parent` are global browser properties.
38
- // Reach for `window.event` / `window.top` / `window.parent` instead.
39
- { message: 'Use `window.event` instead.', name: 'event' },
40
- { message: 'Use `window.parent` instead.', name: 'parent' },
41
- { message: 'Use `window.top` instead.', name: 'top' },
42
- ],
43
- 'no-restricted-imports': [
44
- 'error',
45
- {
46
- patterns: [
47
- // Алиасы
48
- { group: ['~/', '~~/'], message: 'Используйте "@" вместо "~".' },
49
- // Расширения
50
- {
51
- message: 'Не указывайте расширения .ts или .js в путях импорта.',
52
- regex: String.raw`\.[jt]sx?$`,
53
- },
54
- // Относительные импорты
55
- { group: ['..', '*/..'], message: 'Используйте абсолютный путь.' },
56
- {
57
- message: 'Не используйте индексный импорт.',
58
- regex: String.raw`^\.$`,
59
- },
60
- {
61
- group: ['**/index'],
62
- message: 'Не используйте индексный импорт.',
63
- },
64
- // Внешние локальные ресурсы
65
- {
66
- group: ['@/**/_*', '@@/**/_*', '~/**/_*', '~~/**/_*'],
67
- message: 'Этот локальный ресурс не преднаназначен для импорта.',
68
- },
69
- // Устаревший функционал
70
- {
71
- message: 'Этот функционал устарел.',
72
- regex: '(_deprecated|_legacy)',
73
- },
74
- ],
75
- },
76
- ],
77
- 'no-restricted-syntax': ['error', ...NO_RESTRICTED_SYNTAX],
78
- 'no-useless-rename': 'error',
79
- 'prefer-arrow-callback': [
80
- 'error',
81
- { allowNamedFunctions: false, allowUnboundThis: false },
82
- ],
83
- 'prefer-const': 'warn',
84
- 'prefer-template': 'warn',
85
- 'require-await': 'error',
8
+ /**
9
+ * Базовые правила JavaScript.
10
+ *
11
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
12
+ *
13
+ * @returns {import('eslint').Linter.Config[]}
14
+ *
15
+ * @see [eslint](https://eslint.org)
16
+ */
17
+ export const javascript = (config = []) =>
18
+ defineConfig([
19
+ { files: FILES, ...plugin.configs.recommended },
20
+ {
21
+ files: FILES,
22
+ rules: {
23
+ 'arrow-body-style': ['error', 'as-needed'],
24
+ ...STYLE_RULES,
25
+ 'default-case-last': 'error',
26
+ 'dot-notation': ['error'],
27
+ 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
28
+ 'no-alert': 'error',
29
+ 'no-console': 'warn',
30
+ 'no-duplicate-imports': [
31
+ 'error',
32
+ { allowSeparateTypeImports: true, includeExports: false },
33
+ ],
34
+ 'no-else-return': 'error',
35
+ 'no-implicit-coercion': 'error',
36
+ 'no-param-reassign': ['error', { props: false }],
37
+ 'no-restricted-exports': [
38
+ 'error',
39
+ {
40
+ restrictedNamedExports: ['then'],
41
+ restrictedNamedExportsPattern: '^_',
42
+ },
43
+ ],
44
+ 'no-restricted-globals': [
45
+ 'error',
46
+ // `event`, `top` and `parent` are global browser properties.
47
+ // Reach for `window.event` / `window.top` / `window.parent` instead.
48
+ { message: 'Use `window.event` instead.', name: 'event' },
49
+ { message: 'Use `window.parent` instead.', name: 'parent' },
50
+ { message: 'Use `window.top` instead.', name: 'top' },
51
+ ],
52
+ 'no-restricted-imports': [
53
+ 'error',
54
+ {
55
+ patterns: [
56
+ // Алиасы
57
+ { group: ['~/', '~~/'], message: 'Используйте "@" вместо "~".' },
58
+ // Расширения
59
+ {
60
+ message:
61
+ 'Не указывайте расширения .ts или .js в путях импорта.',
62
+ regex: String.raw`\.[jt]sx?$`,
63
+ },
64
+ // Относительные импорты
65
+ {
66
+ group: ['..', '*/..'],
67
+ message: 'Используйте абсолютный путь.',
68
+ },
69
+ {
70
+ message: 'Не используйте индексный импорт.',
71
+ regex: String.raw`^\.$`,
72
+ },
73
+ {
74
+ group: ['**/index'],
75
+ message: 'Не используйте индексный импорт.',
76
+ },
77
+ // Внешние локальные ресурсы
78
+ {
79
+ group: ['@/**/_*', '@@/**/_*', '~/**/_*', '~~/**/_*'],
80
+ message: 'Этот локальный ресурс не преднаназначен для импорта.',
81
+ },
82
+ // Устаревший функционал
83
+ {
84
+ message: 'Этот функционал устарел.',
85
+ regex: '(_deprecated|_legacy)',
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ 'no-restricted-syntax': ['error', ...NO_RESTRICTED_SYNTAX],
91
+ 'no-useless-rename': 'error',
92
+ 'prefer-arrow-callback': [
93
+ 'error',
94
+ { allowNamedFunctions: false, allowUnboundThis: false },
95
+ ],
96
+ 'prefer-const': 'warn',
97
+ 'prefer-template': 'warn',
98
+ 'require-await': 'error',
99
+ },
86
100
  },
87
- },
88
101
 
89
- {
90
- // Tests are allowed to log and to alert
91
- files: TEST_FILES,
92
- rules: { 'no-alert': 'off', 'no-console': 'off' },
93
- },
94
- ]);
102
+ {
103
+ // Tests are allowed to log and to alert
104
+ files: TEST_FILES,
105
+ rules: { 'no-alert': 'off', 'no-console': 'off' },
106
+ },
107
+
108
+ config,
109
+ ]);
@@ -3,21 +3,32 @@ import { defineConfig } from 'eslint/config';
3
3
 
4
4
  import { FILES } from '../base.js';
5
5
 
6
- /** @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) */
7
- export const jsdoc = defineConfig([
8
- { files: FILES, ...plugin.configs['flat/recommended'] },
9
- {
10
- files: FILES,
11
- rules: {
12
- 'jsdoc/lines-before-block': 'off',
13
- 'jsdoc/no-undefined-types': 'off',
14
- 'jsdoc/require-jsdoc': 'off',
15
- 'jsdoc/require-param-description': 'off',
16
- 'jsdoc/require-param-type': 'off',
17
- 'jsdoc/require-returns': 'off',
18
- 'jsdoc/require-returns-description': 'off',
19
- 'jsdoc/require-returns-type': 'off',
20
- 'jsdoc/tag-lines': 'off',
6
+ /**
7
+ * Правила для JSDoc-комментариев.
8
+ *
9
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
10
+ *
11
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc)
14
+ */
15
+ export const jsdoc = (config = []) =>
16
+ defineConfig([
17
+ { files: FILES, ...plugin.configs['flat/recommended'] },
18
+ {
19
+ files: FILES,
20
+ rules: {
21
+ 'jsdoc/lines-before-block': 'off',
22
+ 'jsdoc/no-undefined-types': 'off',
23
+ 'jsdoc/require-jsdoc': 'off',
24
+ 'jsdoc/require-param-description': 'off',
25
+ 'jsdoc/require-param-type': 'off',
26
+ 'jsdoc/require-returns': 'off',
27
+ 'jsdoc/require-returns-description': 'off',
28
+ 'jsdoc/require-returns-type': 'off',
29
+ 'jsdoc/tag-lines': 'off',
30
+ },
21
31
  },
22
- },
23
- ]);
32
+
33
+ config,
34
+ ]);
@@ -4,30 +4,41 @@ import * as yamlParser from 'yaml-eslint-parser';
4
4
 
5
5
  import { YAML_FILES } from '../base.js';
6
6
 
7
- /** @see [ESLint/JSON](https://github.com/eslint/json) */
8
- export const json = defineConfig([
9
- {
10
- extends: ['json/recommended'],
11
- files: ['**/*.json'],
12
- ignores: ['**/package-lock.json'],
13
- language: 'json/json',
14
- plugins: { json: plugin },
15
- },
7
+ /**
8
+ * Правила для JSON, JSONC, JSON5 и YAML-файлов.
9
+ *
10
+ * @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
11
+ *
12
+ * @returns {import('eslint').Linter.Config[]}
13
+ *
14
+ * @see [ESLint/JSON](https://github.com/eslint/json)
15
+ */
16
+ export const json = (config = []) =>
17
+ defineConfig([
18
+ {
19
+ extends: ['json/recommended'],
20
+ files: ['**/*.json'],
21
+ ignores: ['**/package-lock.json'],
22
+ language: 'json/json',
23
+ plugins: { json: plugin },
24
+ },
16
25
 
17
- {
18
- extends: ['json/recommended'],
19
- files: ['**/*.jsonc'],
20
- language: 'json/jsonc',
21
- languageOptions: { allowTrailingCommas: true },
22
- plugins: { json: plugin },
23
- },
26
+ {
27
+ extends: ['json/recommended'],
28
+ files: ['**/*.jsonc'],
29
+ language: 'json/jsonc',
30
+ languageOptions: { allowTrailingCommas: true },
31
+ plugins: { json: plugin },
32
+ },
24
33
 
25
- {
26
- extends: ['json/recommended'],
27
- files: ['**/*.json5'],
28
- language: 'json/json5',
29
- plugins: { json: plugin },
30
- },
34
+ {
35
+ extends: ['json/recommended'],
36
+ files: ['**/*.json5'],
37
+ language: 'json/json5',
38
+ plugins: { json: plugin },
39
+ },
31
40
 
32
- { files: YAML_FILES, languageOptions: { parser: yamlParser } },
33
- ]);
41
+ { files: YAML_FILES, languageOptions: { parser: yamlParser } },
42
+
43
+ config,
44
+ ]);