@alexlit/lint-kit 214.4.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 +19 -16
  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 +4 -3
  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
@@ -1,3 +1,82 @@
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
+ export const plugins = {
32
+ deMorgan,
33
+ importX,
34
+ javascript,
35
+ jsdoc,
36
+ json,
37
+ perfectionist,
38
+ pinia,
39
+ prettier,
40
+ prettierConfig,
41
+ regexp,
42
+ sonar,
43
+ stylistic,
44
+ tailwindcss,
45
+ tanstackQuery,
46
+ typescript,
47
+ typescriptTypeChecked,
48
+ unicorn,
49
+ unocss,
50
+ vitest,
51
+ vue,
52
+ vueAccessibility,
53
+ vueI18n,
54
+ zod,
55
+ };
56
+
57
+ /**
58
+ * Создать конфигурацию ESLint
59
+ *
60
+ * Базовые настройки (`base`) добавляются автоматически и всегда идут первыми.
61
+ * Разворачивайте вызовы плагинов через spread-оператор, а переопределения
62
+ * добавляйте прямо в массив.
63
+ *
64
+ * @example
65
+ * import { defineConfig, plugins } from '@alexlit/config-eslint';
66
+ *
67
+ * export default defineConfig([
68
+ * ...plugins.javascript(),
69
+ * ...plugins.unicorn(),
70
+ * ...plugins.prettierConfig(), // последним
71
+ * { rules: { 'no-console': 'off' } },
72
+ * ]);
73
+ *
74
+ * @param {import('eslint').Linter.Config[]} [configs] - Массив flat-конфигов
75
+ *
76
+ * @returns {import('eslint').Linter.Config[]}
77
+ */
78
+ export const defineConfig = (configs = []) => defineFlatConfig([base, configs]);
79
+
1
80
  export {
2
81
  base,
3
82
  DATA_FILES,
@@ -10,28 +89,5 @@ export {
10
89
  VUE_FILES,
11
90
  YAML_FILES,
12
91
  } 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
92
  export { NO_RESTRICTED_SYNTAX } from './rules/restricted-syntax.js';
37
93
  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": "162.1.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",
@@ -51,8 +54,8 @@
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.0",
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,12 @@ 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
+ * @returns {import('eslint').Linter.Config[]}
10
+ *
11
+ * @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
12
+ */
13
+ export const deMorgan = () =>
14
+ defineConfig([{ files: FILES, ...plugin.configs.recommended }]);
@@ -18,44 +18,57 @@ 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
+ * @returns {import('eslint').Linter.Config[]}
25
+ *
26
+ * @see [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
27
+ */
28
+ export const importX = () =>
29
+ defineConfig([
30
+ { ...plugin.flatConfigs.recommended, files: FILES, ignores: DATA_FILES },
24
31
 
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',
32
+ {
33
+ files: FILES,
34
+ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
35
+ plugins: { 'import-x': plugin },
36
+ rules: {
37
+ 'import-x/consistent-type-specifier-style': [
38
+ 'error',
39
+ 'prefer-top-level',
40
+ ],
41
+ 'import-x/first': 'error',
42
+ 'import-x/newline-after-import': 'warn',
43
+ 'import-x/no-absolute-path': 'error',
44
+ 'import-x/no-cycle': 'error',
45
+ 'import-x/no-extraneous-dependencies': 'error',
46
+ 'import-x/no-named-as-default': 'off',
47
+ 'import-x/no-named-as-default-member': 'off',
48
+ 'import-x/no-nodejs-modules': 'off',
49
+ 'import-x/no-self-import': 'error',
50
+ 'import-x/no-unresolved': 'off',
51
+ 'import-x/no-useless-path-segments': [
52
+ 'error',
53
+ { noUselessIndex: true },
54
+ ],
55
+ 'import-x/unambiguous': 'error',
56
+ },
57
+ settings: {
58
+ 'import-x/extensions': EXTENSIONS,
59
+ 'import-x/ignore': ['node_modules', String.raw`\.vue$`],
60
+ 'import-x/parsers': { '.vue': [vueParser] },
61
+ 'import-x/resolver-next': [
62
+ createNodeResolver({ extensions: EXTENSIONS, tsconfig: 'auto' }),
63
+ ],
64
+ },
43
65
  },
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
66
 
54
- {
55
- files: VUE_FILES,
56
- rules: {
57
- 'import-x/no-useless-path-segments': 'off',
58
- 'import-x/unambiguous': 'off',
67
+ {
68
+ files: VUE_FILES,
69
+ rules: {
70
+ 'import-x/no-useless-path-segments': 'off',
71
+ 'import-x/unambiguous': 'off',
72
+ },
59
73
  },
60
- },
61
- ]);
74
+ ]);
@@ -5,90 +5,101 @@ 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
+ * @returns {import('eslint').Linter.Config[]}
12
+ *
13
+ * @see [eslint](https://eslint.org)
14
+ */
15
+ export const javascript = () =>
16
+ defineConfig([
17
+ { files: FILES, ...plugin.configs.recommended },
18
+ {
19
+ files: FILES,
20
+ rules: {
21
+ 'arrow-body-style': ['error', 'as-needed'],
22
+ ...STYLE_RULES,
23
+ 'default-case-last': 'error',
24
+ 'dot-notation': ['error'],
25
+ 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
26
+ 'no-alert': 'error',
27
+ 'no-console': 'warn',
28
+ 'no-duplicate-imports': [
29
+ 'error',
30
+ { allowSeparateTypeImports: true, includeExports: false },
31
+ ],
32
+ 'no-else-return': 'error',
33
+ 'no-implicit-coercion': 'error',
34
+ 'no-param-reassign': ['error', { props: false }],
35
+ 'no-restricted-exports': [
36
+ 'error',
37
+ {
38
+ restrictedNamedExports: ['then'],
39
+ restrictedNamedExportsPattern: '^_',
40
+ },
41
+ ],
42
+ 'no-restricted-globals': [
43
+ 'error',
44
+ // `event`, `top` and `parent` are global browser properties.
45
+ // Reach for `window.event` / `window.top` / `window.parent` instead.
46
+ { message: 'Use `window.event` instead.', name: 'event' },
47
+ { message: 'Use `window.parent` instead.', name: 'parent' },
48
+ { message: 'Use `window.top` instead.', name: 'top' },
49
+ ],
50
+ 'no-restricted-imports': [
51
+ 'error',
52
+ {
53
+ patterns: [
54
+ // Алиасы
55
+ { group: ['~/', '~~/'], message: 'Используйте "@" вместо "~".' },
56
+ // Расширения
57
+ {
58
+ message:
59
+ 'Не указывайте расширения .ts или .js в путях импорта.',
60
+ regex: String.raw`\.[jt]sx?$`,
61
+ },
62
+ // Относительные импорты
63
+ {
64
+ group: ['..', '*/..'],
65
+ message: 'Используйте абсолютный путь.',
66
+ },
67
+ {
68
+ message: 'Не используйте индексный импорт.',
69
+ regex: String.raw`^\.$`,
70
+ },
71
+ {
72
+ group: ['**/index'],
73
+ message: 'Не используйте индексный импорт.',
74
+ },
75
+ // Внешние локальные ресурсы
76
+ {
77
+ group: ['@/**/_*', '@@/**/_*', '~/**/_*', '~~/**/_*'],
78
+ message: 'Этот локальный ресурс не преднаназначен для импорта.',
79
+ },
80
+ // Устаревший функционал
81
+ {
82
+ message: 'Этот функционал устарел.',
83
+ regex: '(_deprecated|_legacy)',
84
+ },
85
+ ],
86
+ },
87
+ ],
88
+ 'no-restricted-syntax': ['error', ...NO_RESTRICTED_SYNTAX],
89
+ 'no-useless-rename': 'error',
90
+ 'prefer-arrow-callback': [
91
+ 'error',
92
+ { allowNamedFunctions: false, allowUnboundThis: false },
93
+ ],
94
+ 'prefer-const': 'warn',
95
+ 'prefer-template': 'warn',
96
+ 'require-await': 'error',
97
+ },
86
98
  },
87
- },
88
99
 
89
- {
90
- // Tests are allowed to log and to alert
91
- files: TEST_FILES,
92
- rules: { 'no-alert': 'off', 'no-console': 'off' },
93
- },
94
- ]);
100
+ {
101
+ // Tests are allowed to log and to alert
102
+ files: TEST_FILES,
103
+ rules: { 'no-alert': 'off', 'no-console': 'off' },
104
+ },
105
+ ]);
@@ -3,21 +3,28 @@ 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
+ * @returns {import('eslint').Linter.Config[]}
10
+ *
11
+ * @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc)
12
+ */
13
+ export const jsdoc = () =>
14
+ defineConfig([
15
+ { files: FILES, ...plugin.configs['flat/recommended'] },
16
+ {
17
+ files: FILES,
18
+ rules: {
19
+ 'jsdoc/lines-before-block': 'off',
20
+ 'jsdoc/no-undefined-types': 'off',
21
+ 'jsdoc/require-jsdoc': 'off',
22
+ 'jsdoc/require-param-description': 'off',
23
+ 'jsdoc/require-param-type': 'off',
24
+ 'jsdoc/require-returns': 'off',
25
+ 'jsdoc/require-returns-description': 'off',
26
+ 'jsdoc/require-returns-type': 'off',
27
+ 'jsdoc/tag-lines': 'off',
28
+ },
21
29
  },
22
- },
23
- ]);
30
+ ]);
@@ -4,30 +4,37 @@ 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
+ * @returns {import('eslint').Linter.Config[]}
11
+ *
12
+ * @see [ESLint/JSON](https://github.com/eslint/json)
13
+ */
14
+ export const json = () =>
15
+ defineConfig([
16
+ {
17
+ extends: ['json/recommended'],
18
+ files: ['**/*.json'],
19
+ ignores: ['**/package-lock.json'],
20
+ language: 'json/json',
21
+ plugins: { json: plugin },
22
+ },
16
23
 
17
- {
18
- extends: ['json/recommended'],
19
- files: ['**/*.jsonc'],
20
- language: 'json/jsonc',
21
- languageOptions: { allowTrailingCommas: true },
22
- plugins: { json: plugin },
23
- },
24
+ {
25
+ extends: ['json/recommended'],
26
+ files: ['**/*.jsonc'],
27
+ language: 'json/jsonc',
28
+ languageOptions: { allowTrailingCommas: true },
29
+ plugins: { json: plugin },
30
+ },
24
31
 
25
- {
26
- extends: ['json/recommended'],
27
- files: ['**/*.json5'],
28
- language: 'json/json5',
29
- plugins: { json: plugin },
30
- },
32
+ {
33
+ extends: ['json/recommended'],
34
+ files: ['**/*.json5'],
35
+ language: 'json/json5',
36
+ plugins: { json: plugin },
37
+ },
31
38
 
32
- { files: YAML_FILES, languageOptions: { parser: yamlParser } },
33
- ]);
39
+ { files: YAML_FILES, languageOptions: { parser: yamlParser } },
40
+ ]);