@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.
- package/README.md +27 -22
- package/eslint.config.js +31 -60
- package/lint-staged.config.js +2 -2
- package/linthtml.config.js +2 -2
- package/package.json +3 -2
- package/packages/config-eslint/README.md +181 -106
- package/packages/config-eslint/base.js +8 -3
- package/packages/config-eslint/index.d.ts +114 -0
- package/packages/config-eslint/index.js +82 -23
- package/packages/config-eslint/package.json +20 -17
- package/packages/config-eslint/plugins/de-morgan.js +11 -4
- package/packages/config-eslint/plugins/import-x.js +54 -37
- package/packages/config-eslint/plugins/javascript.js +100 -85
- package/packages/config-eslint/plugins/jsdoc.js +28 -17
- package/packages/config-eslint/plugins/json.js +35 -24
- package/packages/config-eslint/plugins/perfectionist.js +112 -95
- package/packages/config-eslint/plugins/pinia.js +21 -10
- package/packages/config-eslint/plugins/prettier.js +32 -10
- package/packages/config-eslint/plugins/regexp.js +20 -9
- package/packages/config-eslint/plugins/sonar.js +23 -12
- package/packages/config-eslint/plugins/stylistic.js +111 -100
- package/packages/config-eslint/plugins/tailwindcss.js +24 -10
- package/packages/config-eslint/plugins/tanstack-query.js +20 -9
- package/packages/config-eslint/plugins/typescript-type-checked.js +42 -33
- package/packages/config-eslint/plugins/typescript.js +27 -14
- package/packages/config-eslint/plugins/unicorn.js +77 -64
- package/packages/config-eslint/plugins/unocss.js +16 -5
- package/packages/config-eslint/plugins/vitest.js +24 -13
- package/packages/config-eslint/plugins/vue-accessibility.js +26 -13
- package/packages/config-eslint/plugins/vue-i18n.js +43 -31
- package/packages/config-eslint/plugins/vue.js +259 -242
- package/packages/config-eslint/plugins/zod.js +21 -10
- package/packages/config-eslint/rules/typescript.js +1 -1
- package/packages/config-hooks/README.md +119 -37
- package/packages/config-hooks/index.d.ts +19 -0
- package/packages/config-hooks/lint-staged.js +8 -6
- package/packages/config-hooks/package.json +3 -1
- package/packages/config-htmllint/README.md +50 -22
- package/packages/config-htmllint/index.d.ts +13 -0
- package/packages/config-htmllint/index.js +15 -7
- package/packages/config-htmllint/package.json +4 -2
- package/packages/config-markdownlint/README.md +40 -5
- package/packages/config-markdownlint/index.json +0 -2
- package/packages/config-markdownlint/package.json +1 -1
- package/packages/config-npmlint/README.md +48 -5
- package/packages/config-npmlint/package.json +3 -3
- package/packages/config-prettier/README.md +158 -23
- package/packages/config-prettier/index.d.ts +100 -0
- package/packages/config-prettier/index.js +63 -85
- package/packages/config-prettier/package.json +6 -4
- package/packages/config-prettier/plugins/jsdoc.js +17 -2
- package/packages/config-prettier/plugins/mdc.js +17 -2
- package/packages/config-prettier/plugins/packagejson.js +17 -4
- package/packages/config-prettier/plugins/php.js +17 -4
- package/packages/config-prettier/plugins/pug.js +17 -2
- package/packages/config-prettier/plugins/ruby.js +17 -11
- package/packages/config-prettier/plugins/sh.js +17 -4
- package/packages/config-prettier/plugins/solidity.js +17 -4
- package/packages/config-prettier/plugins/sort-json.js +17 -2
- package/packages/config-prettier/plugins/sql.js +17 -4
- package/packages/config-prettier/plugins/tailwindcss.js +17 -2
- package/packages/config-prettier/plugins/xml.js +17 -2
- package/packages/config-prettier/utils/merge-configs.js +18 -0
- package/packages/config-stylelint/README.md +182 -44
- package/packages/config-stylelint/index.d.ts +56 -0
- package/packages/config-stylelint/index.js +161 -165
- package/packages/config-stylelint/package.json +5 -2
- package/packages/config-stylelint/plugins/a11y.js +13 -6
- package/packages/config-stylelint/plugins/bem.js +14 -6
- package/packages/config-stylelint/plugins/color-format.js +14 -2
- package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +14 -5
- package/packages/config-stylelint/plugins/gamut.js +13 -5
- package/packages/config-stylelint/plugins/high-performance-animation.js +15 -6
- package/packages/config-stylelint/plugins/logical-css.js +13 -5
- package/packages/config-stylelint/plugins/media-use-custom-media.js +14 -5
- package/packages/config-stylelint/plugins/no-indistinguishable-colors.js +14 -5
- package/packages/config-stylelint/plugins/no-nested-media.js +13 -5
- package/packages/config-stylelint/plugins/no-unresolved-module.js +15 -6
- package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +15 -6
- package/packages/config-stylelint/plugins/order.js +14 -6
- package/packages/config-stylelint/plugins/prettier.js +13 -5
- package/packages/config-stylelint/plugins/scss.js +13 -6
- package/packages/config-stylelint/plugins/selector-no-empty.js +14 -5
- package/packages/config-stylelint/plugins/use-nesting.js +13 -5
- package/packages/config-stylelint/plugins/vue.js +10 -2
- package/packages/config-stylelint/utils/merge-configs.js +20 -0
- package/prettier.config.js +15 -7
- package/scripts/semver.sh +3 -3
- package/stylelint.config.js +25 -11
- package/packages/config-eslint/_legacy/LICENSE +0 -20
- package/packages/config-eslint/_legacy/README.md +0 -48
- package/packages/config-eslint/_legacy/constants/allow-boolean-property-list.js +0 -38
- package/packages/config-eslint/_legacy/constants/boolean-prefixes.js +0 -11
- package/packages/config-eslint/_legacy/constants/english-verbs.js +0 -3368
- package/packages/config-eslint/_legacy/dictionaries/index.js +0 -467
- package/packages/config-eslint/_legacy/dictionaries/programming/bash.js +0 -25
- package/packages/config-eslint/_legacy/dictionaries/programming/django.js +0 -2345
- package/packages/config-eslint/_legacy/dictionaries/programming/elixir.js +0 -64
- package/packages/config-eslint/_legacy/dictionaries/programming/go.js +0 -7748
- package/packages/config-eslint/_legacy/dictionaries/programming/java.js +0 -33527
- package/packages/config-eslint/_legacy/dictionaries/programming/latex.js +0 -675
- package/packages/config-eslint/_legacy/dictionaries/programming/lua.js +0 -394
- package/packages/config-eslint/_legacy/dictionaries/programming/php.js +0 -9788
- package/packages/config-eslint/_legacy/dictionaries/programming/python.js +0 -367
- package/packages/config-eslint/_legacy/dictionaries/programming/ruby.js +0 -357
- package/packages/config-eslint/_legacy/dictionaries/programming/rust.js +0 -115
- package/packages/config-eslint/_legacy/dictionaries/programming/scala.js +0 -2755
- package/packages/config-eslint/_legacy/dictionaries/specialized/html-symbol-entities.js +0 -1118
- package/packages/config-eslint/_legacy/dictionaries/specialized/lorem-ipsum.js +0 -359
- package/packages/config-eslint/_legacy/index.js +0 -12
- package/packages/config-eslint/_legacy/legacy.js +0 -3
- package/packages/config-eslint/_legacy/package.json +0 -97
- package/packages/config-eslint/_legacy/plugins/array-func.js +0 -20
- package/packages/config-eslint/_legacy/plugins/compat.js +0 -7
- package/packages/config-eslint/_legacy/plugins/decorator-position.js +0 -15
- package/packages/config-eslint/_legacy/plugins/eslint-comments.js +0 -9
- package/packages/config-eslint/_legacy/plugins/etc.js +0 -13
- package/packages/config-eslint/_legacy/plugins/ext.js +0 -12
- package/packages/config-eslint/_legacy/plugins/filenames.js +0 -38
- package/packages/config-eslint/_legacy/plugins/import.js +0 -133
- package/packages/config-eslint/_legacy/plugins/jsdoc.js +0 -32
- package/packages/config-eslint/_legacy/plugins/jsx-a11y.js +0 -5
- package/packages/config-eslint/_legacy/plugins/lit-a11y.js +0 -5
- package/packages/config-eslint/_legacy/plugins/lit.js +0 -9
- package/packages/config-eslint/_legacy/plugins/more.js +0 -17
- package/packages/config-eslint/_legacy/plugins/no-await-in-promise.js +0 -5
- package/packages/config-eslint/_legacy/plugins/no-constructor-bind.js +0 -8
- package/packages/config-eslint/_legacy/plugins/no-explicit-type-exports.js +0 -7
- package/packages/config-eslint/_legacy/plugins/no-loops.js +0 -7
- package/packages/config-eslint/_legacy/plugins/no-secrets.js +0 -12
- package/packages/config-eslint/_legacy/plugins/no-use-extend-native.js +0 -5
- package/packages/config-eslint/_legacy/plugins/node.js +0 -5
- package/packages/config-eslint/_legacy/plugins/prettier.js +0 -24
- package/packages/config-eslint/_legacy/plugins/promise.js +0 -10
- package/packages/config-eslint/_legacy/plugins/regexp.js +0 -7
- package/packages/config-eslint/_legacy/plugins/security.js +0 -10
- package/packages/config-eslint/_legacy/plugins/simple-import-sort.js +0 -7
- package/packages/config-eslint/_legacy/plugins/sonar.js +0 -5
- package/packages/config-eslint/_legacy/plugins/sort-class-members.js +0 -298
- package/packages/config-eslint/_legacy/plugins/sort-destructure-keys.js +0 -10
- package/packages/config-eslint/_legacy/plugins/sort-keys-fix.js +0 -7
- package/packages/config-eslint/_legacy/plugins/spellcheck.js +0 -9
- package/packages/config-eslint/_legacy/plugins/sql.js +0 -26
- package/packages/config-eslint/_legacy/plugins/tanstack-query.js +0 -4
- package/packages/config-eslint/_legacy/plugins/testing-library.js +0 -9
- package/packages/config-eslint/_legacy/plugins/typescript-sort-keys.js +0 -5
- package/packages/config-eslint/_legacy/plugins/typescript.js +0 -157
- package/packages/config-eslint/_legacy/plugins/unicorn.js +0 -70
- package/packages/config-eslint/_legacy/plugins/unused-imports.js +0 -17
- package/packages/config-eslint/_legacy/plugins/vitest.js +0 -16
- package/packages/config-eslint/_legacy/plugins/vue-i18n.js +0 -34
- package/packages/config-eslint/_legacy/plugins/vue.js +0 -291
- package/packages/config-eslint/_legacy/plugins/vuejs-accessibility.js +0 -20
- package/packages/config-eslint/_legacy/plugins/wc.js +0 -5
- package/packages/config-eslint/_legacy/plugins/write-good-comments.js +0 -7
- package/packages/config-eslint/_legacy/utils/create-config.js +0 -377
- 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": "
|
|
3
|
+
"version": "163.0.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
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": "
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"types": "index.d.ts",
|
|
27
29
|
"files": [
|
|
28
|
-
"
|
|
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": "
|
|
38
|
-
"release": "
|
|
39
|
-
"semver": "
|
|
40
|
-
"up": "
|
|
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.
|
|
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.
|
|
55
|
-
"eslint-plugin-perfectionist": "^5.
|
|
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.
|
|
64
|
-
"eslint-plugin-zod": "^5.2.
|
|
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
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'error',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
message: '
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
{
|
|
35
|
+
extends: ['json/recommended'],
|
|
36
|
+
files: ['**/*.json5'],
|
|
37
|
+
language: 'json/json5',
|
|
38
|
+
plugins: { json: plugin },
|
|
39
|
+
},
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
{ files: YAML_FILES, languageOptions: { parser: yamlParser } },
|
|
42
|
+
|
|
43
|
+
config,
|
|
44
|
+
]);
|