@alexlit/config-eslint 162.1.2 → 163.1.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 +30 -5
- package/index.d.ts +34 -32
- package/index.js +5 -2
- package/package.json +3 -3
- package/plugins/de-morgan.js +4 -2
- package/plugins/import-x.js +5 -1
- package/plugins/javascript.js +5 -1
- package/plugins/jsdoc.js +5 -1
- package/plugins/json.js +5 -1
- package/plugins/perfectionist.js +5 -1
- package/plugins/pinia.js +5 -1
- package/plugins/prettier.js +10 -2
- package/plugins/regexp.js +5 -1
- package/plugins/sonar.js +5 -1
- package/plugins/stylistic.js +5 -1
- package/plugins/tailwindcss.js +15 -19
- package/plugins/tanstack-query.js +5 -1
- package/plugins/typescript-type-checked.js +5 -1
- package/plugins/typescript.js +5 -1
- package/plugins/unicorn.js +5 -1
- package/plugins/unocss.js +5 -1
- package/plugins/vitest.js +5 -1
- package/plugins/vue-accessibility.js +5 -1
- package/plugins/vue-i18n.js +5 -1
- package/plugins/vue.js +5 -1
- package/plugins/zod.js +5 -1
package/README.md
CHANGED
|
@@ -108,10 +108,33 @@ export default defineConfig([
|
|
|
108
108
|
| `plugins.vueI18n()` | Проверяет Vue.js I18n | [`@intlify/eslint-plugin-vue-i18n`](https://vue-i18n.intlify.dev/) |
|
|
109
109
|
| `plugins.zod()` | Проверяет Zod-схемы | [`eslint-plugin-zod`](https://github.com/marcalexiei/eslint-zod/tree/main/plugins/eslint-plugin-zod) |
|
|
110
110
|
|
|
111
|
+
## Свой конфиг
|
|
112
|
+
|
|
113
|
+
Любая фабрика принимает необязательный flat-конфиг, который добавляется после
|
|
114
|
+
предустановленного. Это позволяет точечно переопределять правила, `settings`,
|
|
115
|
+
`files` и другие опции, не отказываясь от пресета:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
// eslint.config.js
|
|
119
|
+
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
120
|
+
|
|
121
|
+
export default defineConfig([
|
|
122
|
+
...plugins.javascript(),
|
|
123
|
+
...plugins.unicorn({ rules: { 'unicorn/no-null': 'off' } }),
|
|
124
|
+
...plugins.vue([
|
|
125
|
+
{ files: ['**/*.vue'], rules: { 'vue/max-lines-per-block': 'off' } },
|
|
126
|
+
]),
|
|
127
|
+
]);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Можно передать как один объект, так и массив блоков. Так как конфиг добавляется
|
|
131
|
+
последним, он имеет более высокий приоритет, чем настройки пресета.
|
|
132
|
+
|
|
111
133
|
## Настройки Tailwind CSS
|
|
112
134
|
|
|
113
|
-
|
|
114
|
-
с конфигурацией Tailwind CSS
|
|
135
|
+
По умолчанию `plugins.tailwindcss()` использует путь `./styles/tailwind.css`.
|
|
136
|
+
Чтобы указать другой CSS-файл с конфигурацией Tailwind CSS, передайте обычный
|
|
137
|
+
flat-конфиг с настройками плагина:
|
|
115
138
|
|
|
116
139
|
```js
|
|
117
140
|
// eslint.config.js
|
|
@@ -121,13 +144,15 @@ import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
|
121
144
|
|
|
122
145
|
export default defineConfig([
|
|
123
146
|
...plugins.tailwindcss({
|
|
124
|
-
|
|
147
|
+
settings: {
|
|
148
|
+
tailwindcss: {
|
|
149
|
+
cssConfigPath: path.resolve(import.meta.dirname, 'src/main.css'),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
125
152
|
}),
|
|
126
153
|
]);
|
|
127
154
|
```
|
|
128
155
|
|
|
129
|
-
По умолчанию используется путь `./styles/tailwind.css`.
|
|
130
|
-
|
|
131
156
|
## Type-aware правила
|
|
132
157
|
|
|
133
158
|
Type-aware правила (`no-floating-promises`, `no-misused-promises`,
|
package/index.d.ts
CHANGED
|
@@ -3,57 +3,66 @@ import type { Linter } from 'eslint';
|
|
|
3
3
|
/** Flat-конфиг ESLint. */
|
|
4
4
|
export type Config = Linter.Config;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Дополнительный flat-конфиг, который добавляется после предустановленного.
|
|
8
|
+
* Можно передать как один блок, так и массив блоков.
|
|
9
|
+
*/
|
|
10
|
+
export type PluginConfig = Config | Config[];
|
|
11
|
+
|
|
6
12
|
/**
|
|
7
13
|
* Фабрики плагинов. Каждый вызов возвращает массив flat-конфигов, который нужно
|
|
8
14
|
* развернуть через spread-оператор: `...plugins.<name>()`.
|
|
15
|
+
*
|
|
16
|
+
* Любая фабрика принимает необязательный конфиг, который добавляется после
|
|
17
|
+
* предустановленных блоков и переопределяет их.
|
|
9
18
|
*/
|
|
10
19
|
export interface Plugins {
|
|
11
20
|
/** @see eslint-plugin-de-morgan */
|
|
12
|
-
deMorgan(): Config[];
|
|
21
|
+
deMorgan(config?: PluginConfig): Config[];
|
|
13
22
|
/** @see eslint-plugin-import-x */
|
|
14
|
-
importX(): Config[];
|
|
23
|
+
importX(config?: PluginConfig): Config[];
|
|
15
24
|
/** @see eslint */
|
|
16
|
-
javascript(): Config[];
|
|
25
|
+
javascript(config?: PluginConfig): Config[];
|
|
17
26
|
/** @see eslint-plugin-jsdoc */
|
|
18
|
-
jsdoc(): Config[];
|
|
27
|
+
jsdoc(config?: PluginConfig): Config[];
|
|
19
28
|
/** @see ESLint/JSON */
|
|
20
|
-
json(): Config[];
|
|
29
|
+
json(config?: PluginConfig): Config[];
|
|
21
30
|
/** @see eslint-plugin-perfectionist */
|
|
22
|
-
perfectionist(): Config[];
|
|
31
|
+
perfectionist(config?: PluginConfig): Config[];
|
|
23
32
|
/** @see eslint-plugin-pinia */
|
|
24
|
-
pinia(): Config[];
|
|
33
|
+
pinia(config?: PluginConfig): Config[];
|
|
25
34
|
/** @see eslint-plugin-prettier */
|
|
26
|
-
prettier(): Config[];
|
|
35
|
+
prettier(config?: PluginConfig): Config[];
|
|
27
36
|
/** @see eslint-config-prettier */
|
|
28
|
-
prettierConfig(): Config[];
|
|
37
|
+
prettierConfig(config?: PluginConfig): Config[];
|
|
29
38
|
/** @see eslint-plugin-regexp */
|
|
30
|
-
regexp(): Config[];
|
|
39
|
+
regexp(config?: PluginConfig): Config[];
|
|
31
40
|
/** @see eslint-plugin-sonarjs */
|
|
32
|
-
sonar(): Config[];
|
|
41
|
+
sonar(config?: PluginConfig): Config[];
|
|
33
42
|
/** @see @stylistic/eslint-plugin */
|
|
34
|
-
stylistic(): Config[];
|
|
43
|
+
stylistic(config?: PluginConfig): Config[];
|
|
35
44
|
/** @see eslint-plugin-tailwindcss */
|
|
36
|
-
tailwindcss(
|
|
45
|
+
tailwindcss(config?: PluginConfig): Config[];
|
|
37
46
|
/** @see @tanstack/query */
|
|
38
|
-
tanstackQuery(): Config[];
|
|
47
|
+
tanstackQuery(config?: PluginConfig): Config[];
|
|
39
48
|
/** @see typescript-eslint */
|
|
40
|
-
typescript(): Config[];
|
|
49
|
+
typescript(config?: PluginConfig): Config[];
|
|
41
50
|
/** @see typescript-eslint */
|
|
42
|
-
typescriptTypeChecked(): Config[];
|
|
51
|
+
typescriptTypeChecked(config?: PluginConfig): Config[];
|
|
43
52
|
/** @see eslint-plugin-unicorn */
|
|
44
|
-
unicorn(): Config[];
|
|
53
|
+
unicorn(config?: PluginConfig): Config[];
|
|
45
54
|
/** @see @unocss/eslint-config */
|
|
46
|
-
unocss(): Config[];
|
|
55
|
+
unocss(config?: PluginConfig): Config[];
|
|
47
56
|
/** @see eslint-plugin-vitest */
|
|
48
|
-
vitest(): Config[];
|
|
57
|
+
vitest(config?: PluginConfig): Config[];
|
|
49
58
|
/** @see eslint-plugin-vue */
|
|
50
|
-
vue(): Config[];
|
|
59
|
+
vue(config?: PluginConfig): Config[];
|
|
51
60
|
/** @see eslint-plugin-vuejs-accessibility */
|
|
52
|
-
vueAccessibility(): Config[];
|
|
61
|
+
vueAccessibility(config?: PluginConfig): Config[];
|
|
53
62
|
/** @see eslint-plugin-vue-i18n */
|
|
54
|
-
vueI18n(): Config[];
|
|
63
|
+
vueI18n(config?: PluginConfig): Config[];
|
|
55
64
|
/** @see eslint-plugin-zod */
|
|
56
|
-
zod(): Config[];
|
|
65
|
+
zod(config?: PluginConfig): Config[];
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
/** Ограничение синтаксиса - сообщение об ошибке и селектор AST. */
|
|
@@ -62,13 +71,6 @@ export interface RestrictedSyntax {
|
|
|
62
71
|
selector: string;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
/** Настройки eslint-plugin-tailwindcss. */
|
|
66
|
-
export interface TailwindcssSettings {
|
|
67
|
-
[key: string]: unknown;
|
|
68
|
-
/** Путь к CSS-файлу с Tailwind-конфигурацией */
|
|
69
|
-
cssConfigPath?: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
74
|
/** Пространство имён фабрик плагинов. */
|
|
73
75
|
export declare const plugins: Plugins;
|
|
74
76
|
|
|
@@ -102,8 +104,8 @@ export declare const YAML_FILES: string[];
|
|
|
102
104
|
*
|
|
103
105
|
* export default defineConfig([
|
|
104
106
|
* ...plugins.javascript(),
|
|
105
|
-
* ...plugins.unicorn(),
|
|
106
|
-
* ...plugins.prettierConfig(),
|
|
107
|
+
* ...plugins.unicorn({ rules: { 'unicorn/no-null': 'off' } }),
|
|
108
|
+
* ...plugins.prettierConfig(), // последним
|
|
107
109
|
* { rules: { 'no-console': 'off' } },
|
|
108
110
|
* ]);
|
|
109
111
|
*
|
package/index.js
CHANGED
|
@@ -27,6 +27,9 @@ import { zod } from './plugins/zod.js';
|
|
|
27
27
|
/**
|
|
28
28
|
* Фабрики плагинов. Каждый вызов возвращает массив flat-конфигов, который нужно
|
|
29
29
|
* развернуть через spread: `...plugins.<name>()`.
|
|
30
|
+
*
|
|
31
|
+
* Любая фабрика принимает необязательный конфиг, который добавляется после
|
|
32
|
+
* предустановленных блоков и переопределяет их.
|
|
30
33
|
*/
|
|
31
34
|
export const plugins = {
|
|
32
35
|
deMorgan,
|
|
@@ -66,9 +69,9 @@ export const plugins = {
|
|
|
66
69
|
*
|
|
67
70
|
* export default defineConfig([
|
|
68
71
|
* ...plugins.javascript(),
|
|
69
|
-
* ...plugins.unicorn(),
|
|
70
|
-
* ...plugins.prettierConfig(), // последним
|
|
72
|
+
* ...plugins.unicorn({ rules: { 'unicorn/no-null': 'off' } }),
|
|
71
73
|
* { rules: { 'no-console': 'off' } },
|
|
74
|
+
* ...plugins.prettierConfig(), // последним
|
|
72
75
|
* ]);
|
|
73
76
|
*
|
|
74
77
|
* @param {import('eslint').Linter.Config[]} [configs] - Массив flat-конфигов
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "163.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "eslint config",
|
|
6
6
|
"keywords": [
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@vitest/eslint-plugin": "^1.6.28",
|
|
53
53
|
"eslint": "^10.13.0",
|
|
54
54
|
"eslint-config-prettier": "^10.1.8",
|
|
55
|
-
"eslint-plugin-de-morgan": "^2.
|
|
55
|
+
"eslint-plugin-de-morgan": "^2.3.0",
|
|
56
56
|
"eslint-plugin-import-x": "^4.17.1",
|
|
57
|
-
"eslint-plugin-jsdoc": "^65.4.
|
|
57
|
+
"eslint-plugin-jsdoc": "^65.4.2",
|
|
58
58
|
"eslint-plugin-perfectionist": "^5.13.0",
|
|
59
59
|
"eslint-plugin-pinia": "^0.4.2",
|
|
60
60
|
"eslint-plugin-prettier": "^5.5.7",
|
package/plugins/de-morgan.js
CHANGED
|
@@ -6,9 +6,11 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Упрощает логические выражения с помощью правила Де Моргана.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
|
|
12
14
|
*/
|
|
13
|
-
export const deMorgan = () =>
|
|
14
|
-
defineConfig([{ files: FILES, ...plugin.configs.recommended }]);
|
|
15
|
+
export const deMorgan = (config = []) =>
|
|
16
|
+
defineConfig([{ files: FILES, ...plugin.configs.recommended }, config]);
|
package/plugins/import-x.js
CHANGED
|
@@ -21,11 +21,13 @@ const EXTENSIONS = [
|
|
|
21
21
|
/**
|
|
22
22
|
* Правила для импортов и модулей.
|
|
23
23
|
*
|
|
24
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
25
|
+
*
|
|
24
26
|
* @returns {import('eslint').Linter.Config[]}
|
|
25
27
|
*
|
|
26
28
|
* @see [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
|
|
27
29
|
*/
|
|
28
|
-
export const importX = () =>
|
|
30
|
+
export const importX = (config = []) =>
|
|
29
31
|
defineConfig([
|
|
30
32
|
{ ...plugin.flatConfigs.recommended, files: FILES, ignores: DATA_FILES },
|
|
31
33
|
|
|
@@ -71,4 +73,6 @@ export const importX = () =>
|
|
|
71
73
|
'import-x/unambiguous': 'off',
|
|
72
74
|
},
|
|
73
75
|
},
|
|
76
|
+
|
|
77
|
+
config,
|
|
74
78
|
]);
|
package/plugins/javascript.js
CHANGED
|
@@ -8,11 +8,13 @@ import { STYLE_RULES } from '../rules/style.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Базовые правила JavaScript.
|
|
10
10
|
*
|
|
11
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
12
|
+
*
|
|
11
13
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
14
|
*
|
|
13
15
|
* @see [eslint](https://eslint.org)
|
|
14
16
|
*/
|
|
15
|
-
export const javascript = () =>
|
|
17
|
+
export const javascript = (config = []) =>
|
|
16
18
|
defineConfig([
|
|
17
19
|
{ files: FILES, ...plugin.configs.recommended },
|
|
18
20
|
{
|
|
@@ -102,4 +104,6 @@ export const javascript = () =>
|
|
|
102
104
|
files: TEST_FILES,
|
|
103
105
|
rules: { 'no-alert': 'off', 'no-console': 'off' },
|
|
104
106
|
},
|
|
107
|
+
|
|
108
|
+
config,
|
|
105
109
|
]);
|
package/plugins/jsdoc.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для JSDoc-комментариев.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc)
|
|
12
14
|
*/
|
|
13
|
-
export const jsdoc = () =>
|
|
15
|
+
export const jsdoc = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{ files: FILES, ...plugin.configs['flat/recommended'] },
|
|
16
18
|
{
|
|
@@ -27,4 +29,6 @@ export const jsdoc = () =>
|
|
|
27
29
|
'jsdoc/tag-lines': 'off',
|
|
28
30
|
},
|
|
29
31
|
},
|
|
32
|
+
|
|
33
|
+
config,
|
|
30
34
|
]);
|
package/plugins/json.js
CHANGED
|
@@ -7,11 +7,13 @@ import { YAML_FILES } from '../base.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Правила для JSON, JSONC, JSON5 и YAML-файлов.
|
|
9
9
|
*
|
|
10
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
11
|
+
*
|
|
10
12
|
* @returns {import('eslint').Linter.Config[]}
|
|
11
13
|
*
|
|
12
14
|
* @see [ESLint/JSON](https://github.com/eslint/json)
|
|
13
15
|
*/
|
|
14
|
-
export const json = () =>
|
|
16
|
+
export const json = (config = []) =>
|
|
15
17
|
defineConfig([
|
|
16
18
|
{
|
|
17
19
|
extends: ['json/recommended'],
|
|
@@ -37,4 +39,6 @@ export const json = () =>
|
|
|
37
39
|
},
|
|
38
40
|
|
|
39
41
|
{ files: YAML_FILES, languageOptions: { parser: yamlParser } },
|
|
42
|
+
|
|
43
|
+
config,
|
|
40
44
|
]);
|
package/plugins/perfectionist.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила сортировки импортов, объектов, интерфейсов и типов.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-perfectionist](https://perfectionist.dev)
|
|
12
14
|
*/
|
|
13
|
-
export const perfectionist = () =>
|
|
15
|
+
export const perfectionist = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{ ...plugin.configs['recommended-natural'], files: FILES },
|
|
16
18
|
{
|
|
@@ -119,4 +121,6 @@ export const perfectionist = () =>
|
|
|
119
121
|
],
|
|
120
122
|
},
|
|
121
123
|
},
|
|
124
|
+
|
|
125
|
+
config,
|
|
122
126
|
]);
|
package/plugins/pinia.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Pinia-хранилищ.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-pinia](https://github.com/lisilinhart/eslint-plugin-pinia)
|
|
12
14
|
*/
|
|
13
|
-
export const pinia = () =>
|
|
15
|
+
export const pinia = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
...plugin.configs['recommended-flat'],
|
|
@@ -20,4 +22,6 @@ export const pinia = () =>
|
|
|
20
22
|
'pinia/prefer-single-store-per-file': 'error',
|
|
21
23
|
},
|
|
22
24
|
},
|
|
25
|
+
|
|
26
|
+
config,
|
|
23
27
|
]);
|
package/plugins/prettier.js
CHANGED
|
@@ -20,25 +20,33 @@ const fixes = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Форматирование кода самим Prettier (ESLint запускает Prettier как правило).
|
|
22
22
|
*
|
|
23
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
24
|
+
*
|
|
23
25
|
* @returns {import('eslint').Linter.Config[]}
|
|
24
26
|
*
|
|
25
27
|
* @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
|
|
26
28
|
*/
|
|
27
|
-
export const prettier = () =>
|
|
29
|
+
export const prettier = (config = []) =>
|
|
28
30
|
defineConfig([
|
|
29
31
|
{ files: FILES, ...plugin, rules: { ...plugin.rules, ...STYLE_RULES } },
|
|
30
32
|
{ files: VUE_FILES, rules: { ...fixes } },
|
|
33
|
+
|
|
34
|
+
config,
|
|
31
35
|
]);
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* Отключение правил, конфликтующих с Prettier.
|
|
35
39
|
*
|
|
40
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [customConfig]
|
|
41
|
+
*
|
|
36
42
|
* @returns {import('eslint').Linter.Config[]}
|
|
37
43
|
*
|
|
38
44
|
* @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
|
|
39
45
|
*/
|
|
40
|
-
export const prettierConfig = () =>
|
|
46
|
+
export const prettierConfig = (customConfig = []) =>
|
|
41
47
|
defineConfig([
|
|
42
48
|
{ files: FILES, ...config, rules: { ...config.rules, ...STYLE_RULES } },
|
|
43
49
|
{ files: VUE_FILES, rules: { ...fixes } },
|
|
50
|
+
|
|
51
|
+
customConfig,
|
|
44
52
|
]);
|
package/plugins/regexp.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для регулярных выражений.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
|
|
12
14
|
*/
|
|
13
|
-
export const regexp = () =>
|
|
15
|
+
export const regexp = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
files: FILES,
|
|
@@ -19,4 +21,6 @@ export const regexp = () =>
|
|
|
19
21
|
regexp: { allowedCharacterRanges: ['alphanumeric', 'а-я', 'А-Я'] },
|
|
20
22
|
},
|
|
21
23
|
},
|
|
24
|
+
|
|
25
|
+
config,
|
|
22
26
|
]);
|
package/plugins/sonar.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила SonarJS.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
|
|
12
14
|
*/
|
|
13
|
-
export const sonar = () =>
|
|
15
|
+
export const sonar = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
files: FILES,
|
|
@@ -22,4 +24,6 @@ export const sonar = () =>
|
|
|
22
24
|
'sonarjs/unused-import': 'off', // @typescript-eslint/no-unused-vars
|
|
23
25
|
},
|
|
24
26
|
},
|
|
27
|
+
|
|
28
|
+
config,
|
|
25
29
|
]);
|
package/plugins/stylistic.js
CHANGED
|
@@ -6,11 +6,13 @@ import { DATA_FILES, FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила форматирования и стиля кода.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [@stylistic/eslint-plugin](https://eslint.style/)
|
|
12
14
|
*/
|
|
13
|
-
export const stylistic = () =>
|
|
15
|
+
export const stylistic = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
...plugin.configs.recommended,
|
|
@@ -110,4 +112,6 @@ export const stylistic = () =>
|
|
|
110
112
|
],
|
|
111
113
|
},
|
|
112
114
|
},
|
|
115
|
+
|
|
116
|
+
config,
|
|
113
117
|
]);
|
package/plugins/tailwindcss.js
CHANGED
|
@@ -10,25 +10,24 @@ const recommended = plugin.configs.recommended;
|
|
|
10
10
|
/**
|
|
11
11
|
* Правила для Tailwind CSS.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
* import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
13
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
14
|
+
* Например, чтобы переопределить путь к CSS-файлу Tailwind:
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
16
|
+
* ```js
|
|
17
|
+
* plugins.tailwindcss({
|
|
18
|
+
* settings: {
|
|
19
|
+
* tailwindcss: {
|
|
20
|
+
* cssConfigPath: path.resolve(import.meta.dirname, 'src/main.css'),
|
|
21
|
+
* },
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
26
25
|
*
|
|
27
26
|
* @returns {import('eslint').Linter.Config[]}
|
|
28
27
|
*
|
|
29
28
|
* @see [eslint-plugin-tailwindcss](https://github.com/francoismassart/eslint-plugin-tailwindcss)
|
|
30
29
|
*/
|
|
31
|
-
export const tailwindcss = (
|
|
30
|
+
export const tailwindcss = (config = []) =>
|
|
32
31
|
defineConfig([
|
|
33
32
|
{
|
|
34
33
|
...recommended,
|
|
@@ -40,12 +39,9 @@ export const tailwindcss = (settings = {}) =>
|
|
|
40
39
|
},
|
|
41
40
|
settings: {
|
|
42
41
|
...recommended.settings,
|
|
43
|
-
|
|
44
|
-
tailwindcss: {
|
|
45
|
-
...recommended.settings?.tailwindcss,
|
|
46
|
-
cssConfigPath: DEFAULT_CSS_CONFIG_PATH,
|
|
47
|
-
...settings,
|
|
48
|
-
},
|
|
42
|
+
tailwindcss: { cssConfigPath: DEFAULT_CSS_CONFIG_PATH },
|
|
49
43
|
},
|
|
50
44
|
},
|
|
45
|
+
|
|
46
|
+
config,
|
|
51
47
|
]);
|
|
@@ -6,11 +6,13 @@ import { DATA_FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для TanStack Query.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [@tanstack/query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
12
14
|
*/
|
|
13
|
-
export const tanstackQuery = () =>
|
|
15
|
+
export const tanstackQuery = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
// The shipped config has no `files` key, so it would also cover data files.
|
|
16
18
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
@@ -18,4 +20,6 @@ export const tanstackQuery = () =>
|
|
|
18
20
|
ignores: [...(config.ignores ?? []), ...DATA_FILES],
|
|
19
21
|
})),
|
|
20
22
|
{ rules: { '@tanstack/query/infinite-query-property-order': 'off' } },
|
|
23
|
+
|
|
24
|
+
config,
|
|
21
25
|
]);
|
|
@@ -11,11 +11,13 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
11
11
|
* which makes linting slower. Use it instead of `typescript`, not alongside
|
|
12
12
|
* it.
|
|
13
13
|
*
|
|
14
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
15
|
+
*
|
|
14
16
|
* @returns {import('eslint').Linter.Config[]}
|
|
15
17
|
*
|
|
16
18
|
* @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
17
19
|
*/
|
|
18
|
-
export const typescriptTypeChecked = () =>
|
|
20
|
+
export const typescriptTypeChecked = (config = []) =>
|
|
19
21
|
defineConfig([
|
|
20
22
|
// The parser is needed for every JS/TS/Vue file, not only for TypeScript ones,
|
|
21
23
|
// otherwise `.js` files fall back to the default parser and modern syntax
|
|
@@ -52,4 +54,6 @@ export const typescriptTypeChecked = () =>
|
|
|
52
54
|
files: TEST_FILES,
|
|
53
55
|
rules: { '@typescript-eslint/no-empty-function': 'off' },
|
|
54
56
|
},
|
|
57
|
+
|
|
58
|
+
config,
|
|
55
59
|
]);
|
package/plugins/typescript.js
CHANGED
|
@@ -7,11 +7,13 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Правила TypeScript без анализа типов.
|
|
9
9
|
*
|
|
10
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
11
|
+
*
|
|
10
12
|
* @returns {import('eslint').Linter.Config[]}
|
|
11
13
|
*
|
|
12
14
|
* @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
13
15
|
*/
|
|
14
|
-
export const typescript = () =>
|
|
16
|
+
export const typescript = (config = []) =>
|
|
15
17
|
defineConfig([
|
|
16
18
|
// `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
|
|
17
19
|
// so they would also land on data files that are not JavaScript at all.
|
|
@@ -27,4 +29,6 @@ export const typescript = () =>
|
|
|
27
29
|
files: TEST_FILES,
|
|
28
30
|
rules: { '@typescript-eslint/no-empty-function': 'off' },
|
|
29
31
|
},
|
|
32
|
+
|
|
33
|
+
config,
|
|
30
34
|
]);
|
package/plugins/unicorn.js
CHANGED
|
@@ -6,11 +6,13 @@ import { DTS_FILES, FILES, VUE_FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила unicorn.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
12
14
|
*/
|
|
13
|
-
export const unicorn = () =>
|
|
15
|
+
export const unicorn = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{ ...plugin.configs.recommended, files: FILES },
|
|
16
18
|
{
|
|
@@ -78,4 +80,6 @@ export const unicorn = () =>
|
|
|
78
80
|
files: ['**/temp/**/*.vue'],
|
|
79
81
|
rules: { 'unicorn/name-replacements': 'off' },
|
|
80
82
|
},
|
|
83
|
+
|
|
84
|
+
config,
|
|
81
85
|
]);
|
package/plugins/unocss.js
CHANGED
|
@@ -6,12 +6,16 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для UnoCSS.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint)
|
|
12
14
|
*/
|
|
13
|
-
export const unocss = () =>
|
|
15
|
+
export const unocss = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{ files: FILES, ...plugin },
|
|
16
18
|
{ files: FILES, rules: { 'unocss/order-attributify': 'off' } },
|
|
19
|
+
|
|
20
|
+
config,
|
|
17
21
|
]);
|
package/plugins/vitest.js
CHANGED
|
@@ -6,11 +6,13 @@ import { TEST_FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для тестов Vitest.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
|
|
12
14
|
*/
|
|
13
|
-
export const vitest = () =>
|
|
15
|
+
export const vitest = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
files: TEST_FILES,
|
|
@@ -24,4 +26,6 @@ export const vitest = () =>
|
|
|
24
26
|
'vitest/require-to-throw-message': 'off',
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
config,
|
|
27
31
|
]);
|
|
@@ -6,11 +6,13 @@ import { VUE_FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила доступности Vue.js-компонентов.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/)
|
|
12
14
|
*/
|
|
13
|
-
export const vueAccessibility = () =>
|
|
15
|
+
export const vueAccessibility = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
...plugin.configs['flat/recommended'],
|
|
16
18
|
|
|
@@ -24,4 +26,6 @@ export const vueAccessibility = () =>
|
|
|
24
26
|
'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
config,
|
|
27
31
|
]);
|
package/plugins/vue-i18n.js
CHANGED
|
@@ -6,11 +6,13 @@ import { DATA_FILES, VUE_FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Vue.js I18n.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/)
|
|
12
14
|
*/
|
|
13
|
-
export const vueI18n = () =>
|
|
15
|
+
export const vueI18n = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
...plugin.configs['flat/recommended'].map((config) =>
|
|
16
18
|
config.files
|
|
@@ -44,4 +46,6 @@ export const vueI18n = () =>
|
|
|
44
46
|
},
|
|
45
47
|
},
|
|
46
48
|
},
|
|
49
|
+
|
|
50
|
+
config,
|
|
47
51
|
]);
|
package/plugins/vue.js
CHANGED
|
@@ -8,11 +8,13 @@ import { NO_RESTRICTED_SYNTAX } from '../rules/restricted-syntax.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Правила для Vue.js.
|
|
10
10
|
*
|
|
11
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
12
|
+
*
|
|
11
13
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
14
|
*
|
|
13
15
|
* @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/)
|
|
14
16
|
*/
|
|
15
|
-
export const vue = () =>
|
|
17
|
+
export const vue = (config = []) =>
|
|
16
18
|
defineConfig([
|
|
17
19
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
18
20
|
...config,
|
|
@@ -268,4 +270,6 @@ export const vue = () =>
|
|
|
268
270
|
},
|
|
269
271
|
|
|
270
272
|
{ files: TEST_FILES, rules: { 'vue/one-component-per-file': 'off' } },
|
|
273
|
+
|
|
274
|
+
config,
|
|
271
275
|
]);
|
package/plugins/zod.js
CHANGED
|
@@ -6,11 +6,13 @@ import { FILES } from '../base.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Zod-схем.
|
|
8
8
|
*
|
|
9
|
+
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
|
+
*
|
|
9
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
12
|
*
|
|
11
13
|
* @see [eslint-plugin-zod](https://github.com/marcalexiei/eslint-zod/tree/main/plugins/eslint-plugin-zod)
|
|
12
14
|
*/
|
|
13
|
-
export const zod = () =>
|
|
15
|
+
export const zod = (config = []) =>
|
|
14
16
|
defineConfig([
|
|
15
17
|
{
|
|
16
18
|
...plugin.configs.recommended,
|
|
@@ -20,4 +22,6 @@ export const zod = () =>
|
|
|
20
22
|
'zod/consistent-import': ['error', { syntax: 'named' }],
|
|
21
23
|
},
|
|
22
24
|
},
|
|
25
|
+
|
|
26
|
+
config,
|
|
23
27
|
]);
|