@alexlit/config-eslint 161.4.0 → 162.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 +201 -105
- package/base.js +24 -3
- package/index.d.ts +111 -0
- package/index.js +81 -23
- package/package.json +15 -12
- package/plugins/de-morgan.js +13 -5
- package/plugins/import-x.js +54 -38
- package/plugins/javascript.js +100 -86
- package/plugins/jsdoc.js +28 -18
- package/plugins/json.js +35 -25
- package/plugins/perfectionist.js +112 -96
- package/plugins/pinia.js +21 -11
- package/plugins/prettier.js +31 -11
- package/plugins/regexp.js +20 -10
- package/plugins/sonar.js +23 -13
- package/plugins/stylistic.js +111 -101
- package/plugins/tailwindcss.js +23 -5
- package/plugins/tanstack-query.js +20 -10
- package/plugins/typescript-type-checked.js +48 -34
- package/plugins/typescript.js +27 -15
- package/plugins/unicorn.js +77 -65
- package/plugins/unocss.js +16 -6
- package/plugins/vitest.js +24 -14
- package/plugins/vue-accessibility.js +25 -13
- package/plugins/vue-i18n.js +41 -31
- package/plugins/vue.js +259 -243
- package/plugins/zod.js +21 -11
- package/rules/typescript.js +1 -1
package/plugins/de-morgan.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-de-morgan';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { FILES } from '../base.js';
|
|
4
|
+
import { createPlugin, FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
]
|
|
6
|
+
/**
|
|
7
|
+
* Упрощает логические выражения с помощью правила Де Моргана.
|
|
8
|
+
*
|
|
9
|
+
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
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 = createPlugin(() =>
|
|
16
|
+
defineConfig([{ files: FILES, ...plugin.configs.recommended }]),
|
|
17
|
+
);
|
package/plugins/import-x.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createNodeResolver } from 'eslint-plugin-import-x/node-resolver';
|
|
|
3
3
|
import { defineConfig } from 'eslint/config';
|
|
4
4
|
import vueParser from 'vue-eslint-parser';
|
|
5
5
|
|
|
6
|
-
import { DATA_FILES, FILES, VUE_FILES } from '../base.js';
|
|
6
|
+
import { createPlugin, DATA_FILES, FILES, VUE_FILES } from '../base.js';
|
|
7
7
|
|
|
8
8
|
const EXTENSIONS = [
|
|
9
9
|
'.ts',
|
|
@@ -18,44 +18,60 @@ const EXTENSIONS = [
|
|
|
18
18
|
'.json',
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Правила для импортов и модулей.
|
|
23
|
+
*
|
|
24
|
+
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
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 = createPlugin(() =>
|
|
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
|
+
);
|
package/plugins/javascript.js
CHANGED
|
@@ -1,94 +1,108 @@
|
|
|
1
1
|
import plugin from '@eslint/js';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { FILES, TEST_FILES } from '../base.js';
|
|
4
|
+
import { createPlugin, 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} [options] - Дополнительные flat-опции
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
14
|
+
*
|
|
15
|
+
* @see [eslint](https://eslint.org)
|
|
16
|
+
*/
|
|
17
|
+
export const javascript = createPlugin(() =>
|
|
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
|
+
);
|
package/plugins/jsdoc.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-jsdoc';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { FILES } from '../base.js';
|
|
4
|
+
import { createPlugin, 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} [options] - Дополнительные flat-опции
|
|
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 = createPlugin(() =>
|
|
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
|
+
);
|
package/plugins/json.js
CHANGED
|
@@ -2,32 +2,42 @@ import plugin from '@eslint/json';
|
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
import * as yamlParser from 'yaml-eslint-parser';
|
|
4
4
|
|
|
5
|
-
import { YAML_FILES } from '../base.js';
|
|
5
|
+
import { createPlugin, 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} [options] - Дополнительные flat-опции
|
|
11
|
+
*
|
|
12
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
13
|
+
*
|
|
14
|
+
* @see [ESLint/JSON](https://github.com/eslint/json)
|
|
15
|
+
*/
|
|
16
|
+
export const json = createPlugin(() =>
|
|
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
|
+
);
|