@alexlit/config-eslint 162.0.0 → 162.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 +63 -109
- package/base.js +1 -20
- package/index.d.ts +42 -41
- package/index.js +11 -13
- package/package.json +5 -5
- package/plugins/de-morgan.js +3 -6
- package/plugins/import-x.js +3 -6
- package/plugins/javascript.js +3 -6
- package/plugins/jsdoc.js +3 -6
- package/plugins/json.js +3 -6
- package/plugins/perfectionist.js +3 -6
- package/plugins/pinia.js +3 -6
- package/plugins/prettier.js +5 -11
- package/plugins/regexp.js +3 -6
- package/plugins/sonar.js +3 -6
- package/plugins/stylistic.js +3 -6
- package/plugins/tailwindcss.js +12 -19
- package/plugins/tanstack-query.js +3 -6
- package/plugins/typescript-type-checked.js +3 -12
- package/plugins/typescript.js +3 -6
- package/plugins/unicorn.js +3 -6
- package/plugins/unocss.js +3 -6
- package/plugins/vitest.js +3 -6
- package/plugins/vue-accessibility.js +3 -6
- package/plugins/vue-i18n.js +3 -6
- package/plugins/vue.js +3 -6
- package/plugins/zod.js +3 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Prettier и не только - всё, что обычно приходится
|
|
|
15
15
|
|
|
16
16
|
## Установка
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```bash
|
|
19
19
|
npm i @alexlit/config-eslint -D
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -26,24 +26,23 @@ npm i @alexlit/config-eslint -D
|
|
|
26
26
|
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
27
27
|
|
|
28
28
|
export default defineConfig([
|
|
29
|
-
plugins.javascript(),
|
|
30
|
-
plugins.typescript(),
|
|
31
|
-
plugins.unicorn(),
|
|
32
|
-
plugins.prettierConfig(),
|
|
29
|
+
...plugins.javascript(),
|
|
30
|
+
...plugins.typescript(),
|
|
31
|
+
...plugins.unicorn(),
|
|
32
|
+
...plugins.prettierConfig(),
|
|
33
33
|
]);
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
Каждый
|
|
37
|
-
|
|
36
|
+
Каждый плагин возвращает массив блоков конфигурации, поэтому его нужно
|
|
37
|
+
развернуть оператором spread (`...`). Добавьте только то, что нужно проекту;
|
|
38
|
+
полный список - в разделе [Плагины](#плагины).
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`plugins.prettierConfig()` должен быть последним - он отключает правила,
|
|
44
|
-
конфликтующие с Prettier.
|
|
40
|
+
> [!NOTE]
|
|
41
|
+
>
|
|
42
|
+
> `plugins.prettierConfig()` должен быть последним - он отключает правила,
|
|
43
|
+
> конфликтующие с Prettier.
|
|
45
44
|
|
|
46
|
-
Больше плагинов - просто допишите их в
|
|
45
|
+
Больше плагинов - просто допишите их в массив. Пример:
|
|
47
46
|
|
|
48
47
|
```js
|
|
49
48
|
// eslint.config.js
|
|
@@ -51,80 +50,33 @@ import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
|
51
50
|
|
|
52
51
|
export default defineConfig([
|
|
53
52
|
// базовые
|
|
54
|
-
plugins.
|
|
55
|
-
plugins.
|
|
56
|
-
plugins.
|
|
57
|
-
plugins.jsdoc(),
|
|
58
|
-
plugins.json(),
|
|
59
|
-
plugins.perfectionist(),
|
|
60
|
-
plugins.regexp(),
|
|
61
|
-
plugins.sonar(),
|
|
62
|
-
plugins.stylistic(),
|
|
63
|
-
plugins.typescript(),
|
|
64
|
-
plugins.unicorn(),
|
|
53
|
+
...plugins.deMorgan(),
|
|
54
|
+
...plugins.importX(),
|
|
55
|
+
...plugins.javascript(),
|
|
56
|
+
...plugins.jsdoc(),
|
|
57
|
+
...plugins.json(),
|
|
58
|
+
...plugins.perfectionist(),
|
|
59
|
+
...plugins.regexp(),
|
|
60
|
+
...plugins.sonar(),
|
|
61
|
+
...plugins.stylistic(),
|
|
62
|
+
...plugins.typescript(),
|
|
63
|
+
...plugins.unicorn(),
|
|
65
64
|
|
|
66
65
|
// проектные
|
|
67
|
-
plugins.pinia(),
|
|
68
|
-
plugins.tanstackQuery(),
|
|
69
|
-
plugins.unocss(),
|
|
70
|
-
plugins.vitest(),
|
|
71
|
-
plugins.vue(),
|
|
72
|
-
plugins.vueAccessibility(),
|
|
73
|
-
plugins.vueI18n(),
|
|
74
|
-
plugins.zod(),
|
|
66
|
+
...plugins.pinia(),
|
|
67
|
+
...plugins.tanstackQuery(),
|
|
68
|
+
...plugins.unocss(),
|
|
69
|
+
...plugins.vitest(),
|
|
70
|
+
...plugins.vue(),
|
|
71
|
+
...plugins.vueAccessibility(),
|
|
72
|
+
...plugins.vueI18n(),
|
|
73
|
+
...plugins.zod(),
|
|
74
|
+
|
|
75
|
+
// дополнительные правила
|
|
76
|
+
{ ignores: ['fixtures/**'], rules: { 'no-console': 'off' } },
|
|
75
77
|
|
|
76
78
|
// стилистика
|
|
77
|
-
plugins.prettierConfig(),
|
|
78
|
-
]);
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Настройка
|
|
82
|
-
|
|
83
|
-
### Правила конкретного плагина
|
|
84
|
-
|
|
85
|
-
Чтобы переопределить правила одного плагина, передайте объект в его вызов. Опции
|
|
86
|
-
добавляются последним блоком и перекрывают правила плагина:
|
|
87
|
-
|
|
88
|
-
```js
|
|
89
|
-
// eslint.config.js
|
|
90
|
-
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
91
|
-
|
|
92
|
-
export default defineConfig([
|
|
93
|
-
plugins.javascript({ rules: { 'no-console': 'off' } }),
|
|
94
|
-
plugins.perfectionist({ rules: { 'perfectionist/sort-imports': 'off' } }),
|
|
95
|
-
]);
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Общие настройки
|
|
99
|
-
|
|
100
|
-
Второй аргумент `defineConfig` - общие flat-опции ESLint: собственные правила,
|
|
101
|
-
файлы для игнора, настройки и т.д. Он перебивает настройки всех плагинов:
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
// eslint.config.js
|
|
105
|
-
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
106
|
-
|
|
107
|
-
export default defineConfig([plugins.javascript()], {
|
|
108
|
-
ignores: ['fixtures/**'],
|
|
109
|
-
rules: { 'no-console': 'off' },
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Особые опции
|
|
114
|
-
|
|
115
|
-
У `plugins.tailwindcss()` есть собственная опция `cssConfigPath` - путь к
|
|
116
|
-
CSS-файлу с конфигурацией Tailwind CSS:
|
|
117
|
-
|
|
118
|
-
```js
|
|
119
|
-
// eslint.config.js
|
|
120
|
-
import path from 'node:path';
|
|
121
|
-
|
|
122
|
-
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
123
|
-
|
|
124
|
-
export default defineConfig([
|
|
125
|
-
plugins.tailwindcss({
|
|
126
|
-
cssConfigPath: path.resolve(import.meta.dirname, 'src/main.css'),
|
|
127
|
-
}),
|
|
79
|
+
...plugins.prettierConfig(),
|
|
128
80
|
]);
|
|
129
81
|
```
|
|
130
82
|
|
|
@@ -156,6 +108,26 @@ export default defineConfig([
|
|
|
156
108
|
| `plugins.vueI18n()` | Проверяет Vue.js I18n | `@intlify/eslint-plugin-vue-i18n` |
|
|
157
109
|
| `plugins.zod()` | Проверяет Zod-схемы | `eslint-plugin-zod` |
|
|
158
110
|
|
|
111
|
+
## Настройки Tailwind CSS
|
|
112
|
+
|
|
113
|
+
У `plugins.tailwindcss()` есть собственные настройки плагина - путь к CSS-файлу
|
|
114
|
+
с конфигурацией Tailwind CSS (`cssConfigPath`):
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
// eslint.config.js
|
|
118
|
+
import path from 'node:path';
|
|
119
|
+
|
|
120
|
+
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
121
|
+
|
|
122
|
+
export default defineConfig([
|
|
123
|
+
...plugins.tailwindcss({
|
|
124
|
+
cssConfigPath: path.resolve(import.meta.dirname, 'src/main.css'),
|
|
125
|
+
}),
|
|
126
|
+
]);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
По умолчанию используется путь `./styles/tailwind.css`.
|
|
130
|
+
|
|
159
131
|
## Type-aware правила
|
|
160
132
|
|
|
161
133
|
Type-aware правила (`no-floating-promises`, `no-misused-promises`,
|
|
@@ -171,9 +143,9 @@ Type-aware правила (`no-floating-promises`, `no-misused-promises`,
|
|
|
171
143
|
import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
172
144
|
|
|
173
145
|
export default defineConfig([
|
|
174
|
-
plugins.javascript(),
|
|
175
|
-
plugins.typescriptTypeChecked(), // вместо plugins.typescript()
|
|
176
|
-
plugins.prettierConfig(),
|
|
146
|
+
...plugins.javascript(),
|
|
147
|
+
...plugins.typescriptTypeChecked(), // вместо plugins.typescript()
|
|
148
|
+
...plugins.prettierConfig(),
|
|
177
149
|
]);
|
|
178
150
|
```
|
|
179
151
|
|
|
@@ -198,31 +170,13 @@ export default defineConfig([
|
|
|
198
170
|
хотите, чтобы ESLint сам сообщал о форматировании и исправлял его за один
|
|
199
171
|
проход - это медленнее и дублирует форматтер.
|
|
200
172
|
|
|
201
|
-
## Миграция с v161
|
|
202
|
-
|
|
203
|
-
v162 - breaking-релиз: плагины по умолчанию больше нет, всё подключается явно, а
|
|
204
|
-
каждый плагин стал фабрикой.
|
|
205
|
-
|
|
206
|
-
| v161 | v162 |
|
|
207
|
-
| ----------------------------- | -------------------------------------------------- |
|
|
208
|
-
| `import { base } from ...` | `import { defineConfig, plugins } from ...` |
|
|
209
|
-
| `[...base, ...javascript]` | `defineConfig([plugins.javascript()])` |
|
|
210
|
-
| `...javascript` | `plugins.javascript()` |
|
|
211
|
-
| `...prettierConfig` | `plugins.prettierConfig()` (последним) |
|
|
212
|
-
| `...tailwindcss({ ... })` | `plugins.tailwindcss({ ... })` |
|
|
213
|
-
| `{ files: [...], rules: {} }` | `defineConfig([...], { files: [...], rules: {} })` |
|
|
214
|
-
|
|
215
|
-
Плоские экспорты плагинов (`javascript`, `unicorn`, `vue` и другие) удалены -
|
|
216
|
-
используйте `plugins.<name>()`. Базовые настройки (`base`) добавляются
|
|
217
|
-
автоматически, разворачивать их вручную больше не нужно.
|
|
218
|
-
|
|
219
173
|
## Разработка
|
|
220
174
|
|
|
221
|
-
|
|
175
|
+
Просмотр итоговой конфигурации:
|
|
222
176
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
177
|
+
```bash
|
|
178
|
+
npm run inspect
|
|
179
|
+
```
|
|
226
180
|
|
|
227
181
|
## Полезные ссылки
|
|
228
182
|
|
package/base.js
CHANGED
|
@@ -37,6 +37,7 @@ export const IGNORES = [
|
|
|
37
37
|
'**/.*',
|
|
38
38
|
'**/.*/**',
|
|
39
39
|
'**/_deprecated/**',
|
|
40
|
+
'**/_legacy/**',
|
|
40
41
|
'**/build/**',
|
|
41
42
|
'**/dist/**',
|
|
42
43
|
'**/docs/**',
|
|
@@ -67,23 +68,3 @@ export const base = defineConfig([
|
|
|
67
68
|
|
|
68
69
|
{ ignores: IGNORES },
|
|
69
70
|
]);
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Создать фабрику плагина.
|
|
73
|
-
*
|
|
74
|
-
* Фабрика возвращает набор flat-конфигов плагина. Переданные опции добавляются
|
|
75
|
-
* последним блоком и перекрывают правила плагина.
|
|
76
|
-
*
|
|
77
|
-
* @param {() => import('eslint').Linter.Config[]} build Конфиги плагина
|
|
78
|
-
*
|
|
79
|
-
* @returns {(
|
|
80
|
-
* options?: import('eslint').Linter.Config,
|
|
81
|
-
* ) => import('eslint').Linter.Config[]}
|
|
82
|
-
*/
|
|
83
|
-
export const createPlugin =
|
|
84
|
-
(build) =>
|
|
85
|
-
(options = {}) => {
|
|
86
|
-
const configs = build();
|
|
87
|
-
|
|
88
|
-
return Object.keys(options).length > 0 ? [...configs, options] : configs;
|
|
89
|
-
};
|
package/index.d.ts
CHANGED
|
@@ -4,62 +4,56 @@ import type { Linter } from 'eslint';
|
|
|
4
4
|
export type Config = Linter.Config;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export type Options = Linter.Config;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Фабрики плагинов. Каждый плагин подключается явно: передайте
|
|
14
|
-
* `plugins.<name>()` в `defineConfig`.
|
|
7
|
+
* Фабрики плагинов. Каждый вызов возвращает массив flat-конфигов, который нужно
|
|
8
|
+
* развернуть через spread-оператор: `...plugins.<name>()`.
|
|
15
9
|
*/
|
|
16
10
|
export interface Plugins {
|
|
17
11
|
/** @see eslint-plugin-de-morgan */
|
|
18
|
-
deMorgan(
|
|
12
|
+
deMorgan(): Config[];
|
|
19
13
|
/** @see eslint-plugin-import-x */
|
|
20
|
-
importX(
|
|
14
|
+
importX(): Config[];
|
|
21
15
|
/** @see eslint */
|
|
22
|
-
javascript(
|
|
16
|
+
javascript(): Config[];
|
|
23
17
|
/** @see eslint-plugin-jsdoc */
|
|
24
|
-
jsdoc(
|
|
18
|
+
jsdoc(): Config[];
|
|
25
19
|
/** @see ESLint/JSON */
|
|
26
|
-
json(
|
|
20
|
+
json(): Config[];
|
|
27
21
|
/** @see eslint-plugin-perfectionist */
|
|
28
|
-
perfectionist(
|
|
22
|
+
perfectionist(): Config[];
|
|
29
23
|
/** @see eslint-plugin-pinia */
|
|
30
|
-
pinia(
|
|
24
|
+
pinia(): Config[];
|
|
31
25
|
/** @see eslint-plugin-prettier */
|
|
32
|
-
prettier(
|
|
26
|
+
prettier(): Config[];
|
|
33
27
|
/** @see eslint-config-prettier */
|
|
34
|
-
prettierConfig(
|
|
28
|
+
prettierConfig(): Config[];
|
|
35
29
|
/** @see eslint-plugin-regexp */
|
|
36
|
-
regexp(
|
|
30
|
+
regexp(): Config[];
|
|
37
31
|
/** @see eslint-plugin-sonarjs */
|
|
38
|
-
sonar(
|
|
32
|
+
sonar(): Config[];
|
|
39
33
|
/** @see @stylistic/eslint-plugin */
|
|
40
|
-
stylistic(
|
|
34
|
+
stylistic(): Config[];
|
|
41
35
|
/** @see eslint-plugin-tailwindcss */
|
|
42
|
-
tailwindcss(
|
|
36
|
+
tailwindcss(settings?: TailwindcssSettings): Config[];
|
|
43
37
|
/** @see @tanstack/query */
|
|
44
|
-
tanstackQuery(
|
|
38
|
+
tanstackQuery(): Config[];
|
|
45
39
|
/** @see typescript-eslint */
|
|
46
|
-
typescript(
|
|
40
|
+
typescript(): Config[];
|
|
47
41
|
/** @see typescript-eslint */
|
|
48
|
-
typescriptTypeChecked(
|
|
42
|
+
typescriptTypeChecked(): Config[];
|
|
49
43
|
/** @see eslint-plugin-unicorn */
|
|
50
|
-
unicorn(
|
|
44
|
+
unicorn(): Config[];
|
|
51
45
|
/** @see @unocss/eslint-config */
|
|
52
|
-
unocss(
|
|
46
|
+
unocss(): Config[];
|
|
53
47
|
/** @see eslint-plugin-vitest */
|
|
54
|
-
vitest(
|
|
48
|
+
vitest(): Config[];
|
|
55
49
|
/** @see eslint-plugin-vue */
|
|
56
|
-
vue(
|
|
50
|
+
vue(): Config[];
|
|
57
51
|
/** @see eslint-plugin-vuejs-accessibility */
|
|
58
|
-
vueAccessibility(
|
|
52
|
+
vueAccessibility(): Config[];
|
|
59
53
|
/** @see eslint-plugin-vue-i18n */
|
|
60
|
-
vueI18n(
|
|
54
|
+
vueI18n(): Config[];
|
|
61
55
|
/** @see eslint-plugin-zod */
|
|
62
|
-
zod(
|
|
56
|
+
zod(): Config[];
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
/** Ограничение синтаксиса - сообщение об ошибке и селектор AST. */
|
|
@@ -68,8 +62,9 @@ export interface RestrictedSyntax {
|
|
|
68
62
|
selector: string;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
/**
|
|
72
|
-
export interface
|
|
65
|
+
/** Настройки eslint-plugin-tailwindcss. */
|
|
66
|
+
export interface TailwindcssSettings {
|
|
67
|
+
[key: string]: unknown;
|
|
73
68
|
/** Путь к CSS-файлу с Tailwind-конфигурацией */
|
|
74
69
|
cssConfigPath?: string;
|
|
75
70
|
}
|
|
@@ -99,13 +94,19 @@ export declare const YAML_FILES: string[];
|
|
|
99
94
|
* Создать конфигурацию ESLint.
|
|
100
95
|
*
|
|
101
96
|
* Базовые настройки (`base`) добавляются автоматически и всегда идут первыми.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
97
|
+
* Разворачивайте вызовы плагинов через spread-оператор, а переопределения
|
|
98
|
+
* добавляйте прямо в массив.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
102
|
+
*
|
|
103
|
+
* export default defineConfig([
|
|
104
|
+
* ...plugins.javascript(),
|
|
105
|
+
* ...plugins.unicorn(),
|
|
106
|
+
* ...plugins.prettierConfig(),
|
|
107
|
+
* { rules: { 'no-console': 'off' } },
|
|
108
|
+
* ]);
|
|
104
109
|
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param options - Общие flat-опции, наивысший приоритет
|
|
110
|
+
* @param configs - Массив flat-конфигов
|
|
107
111
|
*/
|
|
108
|
-
export declare function defineConfig(
|
|
109
|
-
pluginConfigs?: Config[][],
|
|
110
|
-
options?: Options,
|
|
111
|
-
): Config[];
|
|
112
|
+
export declare function defineConfig(configs?: Config[]): Config[];
|
package/index.js
CHANGED
|
@@ -25,8 +25,8 @@ import { vue } from './plugins/vue.js';
|
|
|
25
25
|
import { zod } from './plugins/zod.js';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Фабрики плагинов. Каждый
|
|
29
|
-
*
|
|
28
|
+
* Фабрики плагинов. Каждый вызов возвращает массив flat-конфигов, который нужно
|
|
29
|
+
* развернуть через spread: `...plugins.<name>()`.
|
|
30
30
|
*/
|
|
31
31
|
export const plugins = {
|
|
32
32
|
deMorgan,
|
|
@@ -58,26 +58,24 @@ export const plugins = {
|
|
|
58
58
|
* Создать конфигурацию ESLint
|
|
59
59
|
*
|
|
60
60
|
* Базовые настройки (`base`) добавляются автоматически и всегда идут первыми.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* Разворачивайте вызовы плагинов через spread-оператор, а переопределения
|
|
62
|
+
* добавляйте прямо в массив.
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
66
66
|
*
|
|
67
|
-
* export default defineConfig(
|
|
68
|
-
*
|
|
67
|
+
* export default defineConfig([
|
|
68
|
+
* ...plugins.javascript(),
|
|
69
|
+
* ...plugins.unicorn(),
|
|
70
|
+
* ...plugins.prettierConfig(), // последним
|
|
69
71
|
* { rules: { 'no-console': 'off' } },
|
|
70
|
-
* );
|
|
72
|
+
* ]);
|
|
71
73
|
*
|
|
72
|
-
* @param {import('eslint').Linter.Config[]
|
|
73
|
-
* плагинов, напр. `[plugins.javascript()]`
|
|
74
|
-
* @param {import('eslint').Linter.Config} [options] - Общие flat-опции,
|
|
75
|
-
* наивысший приоритет
|
|
74
|
+
* @param {import('eslint').Linter.Config[]} [configs] - Массив flat-конфигов
|
|
76
75
|
*
|
|
77
76
|
* @returns {import('eslint').Linter.Config[]}
|
|
78
77
|
*/
|
|
79
|
-
export const defineConfig = (
|
|
80
|
-
defineFlatConfig([base, pluginConfigs, options]);
|
|
78
|
+
export const defineConfig = (configs = []) => defineFlatConfig([base, configs]);
|
|
81
79
|
|
|
82
80
|
export {
|
|
83
81
|
base,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-eslint",
|
|
3
|
-
"version": "162.
|
|
3
|
+
"version": "162.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "eslint config",
|
|
6
6
|
"keywords": [
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"eslint-config-prettier": "^10.1.8",
|
|
55
55
|
"eslint-plugin-de-morgan": "^2.2.1",
|
|
56
56
|
"eslint-plugin-import-x": "^4.17.1",
|
|
57
|
-
"eslint-plugin-jsdoc": "^65.
|
|
58
|
-
"eslint-plugin-perfectionist": "^5.
|
|
57
|
+
"eslint-plugin-jsdoc": "^65.4.0",
|
|
58
|
+
"eslint-plugin-perfectionist": "^5.13.0",
|
|
59
59
|
"eslint-plugin-pinia": "^0.4.2",
|
|
60
60
|
"eslint-plugin-prettier": "^5.5.7",
|
|
61
61
|
"eslint-plugin-regexp": "^3.3.1",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
64
64
|
"eslint-plugin-unicorn": "^78.0.0",
|
|
65
65
|
"eslint-plugin-vue": "^10.11.1",
|
|
66
|
-
"eslint-plugin-vuejs-accessibility": "^2.6.
|
|
67
|
-
"eslint-plugin-zod": "^5.2.
|
|
66
|
+
"eslint-plugin-vuejs-accessibility": "^2.6.3",
|
|
67
|
+
"eslint-plugin-zod": "^5.2.1",
|
|
68
68
|
"globals": "^17.13.0",
|
|
69
69
|
"jsonc-eslint-parser": "^3.3.0",
|
|
70
70
|
"typescript": "^6.0.3",
|
package/plugins/de-morgan.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-de-morgan';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Упрощает логические выражения с помощью правила Де Моргана.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
|
|
14
12
|
*/
|
|
15
|
-
export const deMorgan =
|
|
16
|
-
defineConfig([{ files: FILES, ...plugin.configs.recommended }])
|
|
17
|
-
);
|
|
13
|
+
export const deMorgan = () =>
|
|
14
|
+
defineConfig([{ files: FILES, ...plugin.configs.recommended }]);
|
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 {
|
|
6
|
+
import { DATA_FILES, FILES, VUE_FILES } from '../base.js';
|
|
7
7
|
|
|
8
8
|
const EXTENSIONS = [
|
|
9
9
|
'.ts',
|
|
@@ -21,13 +21,11 @@ const EXTENSIONS = [
|
|
|
21
21
|
/**
|
|
22
22
|
* Правила для импортов и модулей.
|
|
23
23
|
*
|
|
24
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
25
|
-
*
|
|
26
24
|
* @returns {import('eslint').Linter.Config[]}
|
|
27
25
|
*
|
|
28
26
|
* @see [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
|
|
29
27
|
*/
|
|
30
|
-
export const importX =
|
|
28
|
+
export const importX = () =>
|
|
31
29
|
defineConfig([
|
|
32
30
|
{ ...plugin.flatConfigs.recommended, files: FILES, ignores: DATA_FILES },
|
|
33
31
|
|
|
@@ -73,5 +71,4 @@ export const importX = createPlugin(() =>
|
|
|
73
71
|
'import-x/unambiguous': 'off',
|
|
74
72
|
},
|
|
75
73
|
},
|
|
76
|
-
])
|
|
77
|
-
);
|
|
74
|
+
]);
|
package/plugins/javascript.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import plugin from '@eslint/js';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
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
8
|
/**
|
|
9
9
|
* Базовые правила JavaScript.
|
|
10
10
|
*
|
|
11
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
12
|
-
*
|
|
13
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
14
12
|
*
|
|
15
13
|
* @see [eslint](https://eslint.org)
|
|
16
14
|
*/
|
|
17
|
-
export const javascript =
|
|
15
|
+
export const javascript = () =>
|
|
18
16
|
defineConfig([
|
|
19
17
|
{ files: FILES, ...plugin.configs.recommended },
|
|
20
18
|
{
|
|
@@ -104,5 +102,4 @@ export const javascript = createPlugin(() =>
|
|
|
104
102
|
files: TEST_FILES,
|
|
105
103
|
rules: { 'no-alert': 'off', 'no-console': 'off' },
|
|
106
104
|
},
|
|
107
|
-
])
|
|
108
|
-
);
|
|
105
|
+
]);
|
package/plugins/jsdoc.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-jsdoc';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для JSDoc-комментариев.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc)
|
|
14
12
|
*/
|
|
15
|
-
export const jsdoc =
|
|
13
|
+
export const jsdoc = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{ files: FILES, ...plugin.configs['flat/recommended'] },
|
|
18
16
|
{
|
|
@@ -29,5 +27,4 @@ export const jsdoc = createPlugin(() =>
|
|
|
29
27
|
'jsdoc/tag-lines': 'off',
|
|
30
28
|
},
|
|
31
29
|
},
|
|
32
|
-
])
|
|
33
|
-
);
|
|
30
|
+
]);
|
package/plugins/json.js
CHANGED
|
@@ -2,18 +2,16 @@ 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 {
|
|
5
|
+
import { YAML_FILES } from '../base.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Правила для JSON, JSONC, JSON5 и YAML-файлов.
|
|
9
9
|
*
|
|
10
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
11
|
-
*
|
|
12
10
|
* @returns {import('eslint').Linter.Config[]}
|
|
13
11
|
*
|
|
14
12
|
* @see [ESLint/JSON](https://github.com/eslint/json)
|
|
15
13
|
*/
|
|
16
|
-
export const json =
|
|
14
|
+
export const json = () =>
|
|
17
15
|
defineConfig([
|
|
18
16
|
{
|
|
19
17
|
extends: ['json/recommended'],
|
|
@@ -39,5 +37,4 @@ export const json = createPlugin(() =>
|
|
|
39
37
|
},
|
|
40
38
|
|
|
41
39
|
{ files: YAML_FILES, languageOptions: { parser: yamlParser } },
|
|
42
|
-
])
|
|
43
|
-
);
|
|
40
|
+
]);
|
package/plugins/perfectionist.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-perfectionist';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила сортировки импортов, объектов, интерфейсов и типов.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-perfectionist](https://perfectionist.dev)
|
|
14
12
|
*/
|
|
15
|
-
export const perfectionist =
|
|
13
|
+
export const perfectionist = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{ ...plugin.configs['recommended-natural'], files: FILES },
|
|
18
16
|
{
|
|
@@ -121,5 +119,4 @@ export const perfectionist = createPlugin(() =>
|
|
|
121
119
|
],
|
|
122
120
|
},
|
|
123
121
|
},
|
|
124
|
-
])
|
|
125
|
-
);
|
|
122
|
+
]);
|
package/plugins/pinia.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-pinia';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Pinia-хранилищ.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-pinia](https://github.com/lisilinhart/eslint-plugin-pinia)
|
|
14
12
|
*/
|
|
15
|
-
export const pinia =
|
|
13
|
+
export const pinia = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
...plugin.configs['recommended-flat'],
|
|
@@ -22,5 +20,4 @@ export const pinia = createPlugin(() =>
|
|
|
22
20
|
'pinia/prefer-single-store-per-file': 'error',
|
|
23
21
|
},
|
|
24
22
|
},
|
|
25
|
-
])
|
|
26
|
-
);
|
|
23
|
+
]);
|
package/plugins/prettier.js
CHANGED
|
@@ -2,7 +2,7 @@ import config from 'eslint-config-prettier';
|
|
|
2
2
|
import plugin from 'eslint-plugin-prettier/recommended';
|
|
3
3
|
import { defineConfig } from 'eslint/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { FILES, VUE_FILES } from '../base.js';
|
|
6
6
|
import { STYLE_RULES } from '../rules/style.js';
|
|
7
7
|
|
|
8
8
|
const fixes = {
|
|
@@ -20,31 +20,25 @@ const fixes = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Форматирование кода самим Prettier (ESLint запускает Prettier как правило).
|
|
22
22
|
*
|
|
23
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
24
|
-
*
|
|
25
23
|
* @returns {import('eslint').Linter.Config[]}
|
|
26
24
|
*
|
|
27
25
|
* @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
|
|
28
26
|
*/
|
|
29
|
-
export const prettier =
|
|
27
|
+
export const prettier = () =>
|
|
30
28
|
defineConfig([
|
|
31
29
|
{ files: FILES, ...plugin, rules: { ...plugin.rules, ...STYLE_RULES } },
|
|
32
30
|
{ files: VUE_FILES, rules: { ...fixes } },
|
|
33
|
-
])
|
|
34
|
-
);
|
|
31
|
+
]);
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
34
|
* Отключение правил, конфликтующих с Prettier.
|
|
38
35
|
*
|
|
39
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
40
|
-
*
|
|
41
36
|
* @returns {import('eslint').Linter.Config[]}
|
|
42
37
|
*
|
|
43
38
|
* @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
|
|
44
39
|
*/
|
|
45
|
-
export const prettierConfig =
|
|
40
|
+
export const prettierConfig = () =>
|
|
46
41
|
defineConfig([
|
|
47
42
|
{ files: FILES, ...config, rules: { ...config.rules, ...STYLE_RULES } },
|
|
48
43
|
{ files: VUE_FILES, rules: { ...fixes } },
|
|
49
|
-
])
|
|
50
|
-
);
|
|
44
|
+
]);
|
package/plugins/regexp.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-regexp';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для регулярных выражений.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
|
|
14
12
|
*/
|
|
15
|
-
export const regexp =
|
|
13
|
+
export const regexp = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
files: FILES,
|
|
@@ -21,5 +19,4 @@ export const regexp = createPlugin(() =>
|
|
|
21
19
|
regexp: { allowedCharacterRanges: ['alphanumeric', 'а-я', 'А-Я'] },
|
|
22
20
|
},
|
|
23
21
|
},
|
|
24
|
-
])
|
|
25
|
-
);
|
|
22
|
+
]);
|
package/plugins/sonar.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-sonarjs';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила SonarJS.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
|
|
14
12
|
*/
|
|
15
|
-
export const sonar =
|
|
13
|
+
export const sonar = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
files: FILES,
|
|
@@ -24,5 +22,4 @@ export const sonar = createPlugin(() =>
|
|
|
24
22
|
'sonarjs/unused-import': 'off', // @typescript-eslint/no-unused-vars
|
|
25
23
|
},
|
|
26
24
|
},
|
|
27
|
-
])
|
|
28
|
-
);
|
|
25
|
+
]);
|
package/plugins/stylistic.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from '@stylistic/eslint-plugin';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DATA_FILES, FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила форматирования и стиля кода.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [@stylistic/eslint-plugin](https://eslint.style/)
|
|
14
12
|
*/
|
|
15
|
-
export const stylistic =
|
|
13
|
+
export const stylistic = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
...plugin.configs.recommended,
|
|
@@ -112,5 +110,4 @@ export const stylistic = createPlugin(() =>
|
|
|
112
110
|
],
|
|
113
111
|
},
|
|
114
112
|
},
|
|
115
|
-
])
|
|
116
|
-
);
|
|
113
|
+
]);
|
package/plugins/tailwindcss.js
CHANGED
|
@@ -8,27 +8,26 @@ const DEFAULT_CSS_CONFIG_PATH = './styles/tailwind.css';
|
|
|
8
8
|
/**
|
|
9
9
|
* Правила для Tailwind CSS.
|
|
10
10
|
*
|
|
11
|
-
* Опция `cssConfigPath` - путь к CSS-файлу с Tailwind-конфигурацией. Остальные
|
|
12
|
-
* опции - произвольные flat-опции ESLint, они добавляются отдельным блоком.
|
|
13
|
-
*
|
|
14
11
|
* @example
|
|
15
12
|
* import path from 'node:path';
|
|
13
|
+
* import { defineConfig, plugins } from '@alexlit/config-eslint';
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* export default defineConfig([
|
|
16
|
+
* plugins.tailwindcss({
|
|
17
|
+
* cssConfigPath: path.resolve(import.meta.dirname, 'src/styles.css'),
|
|
18
|
+
* }),
|
|
19
|
+
* ]);
|
|
20
20
|
*
|
|
21
|
-
* @param {import('eslint').
|
|
22
|
-
*
|
|
21
|
+
* @param {import('eslint-plugin-tailwindcss').PluginSettings} [settings] -
|
|
22
|
+
* Настройки плагина `tailwindcss`. По умолчанию `cssConfigPath` равен
|
|
23
|
+
* `./styles/tailwind.css`.
|
|
23
24
|
*
|
|
24
25
|
* @returns {import('eslint').Linter.Config[]}
|
|
25
26
|
*
|
|
26
27
|
* @see [eslint-plugin-tailwindcss](https://github.com/francoismassart/eslint-plugin-tailwindcss)
|
|
27
28
|
*/
|
|
28
|
-
export const tailwindcss = (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return defineConfig([
|
|
29
|
+
export const tailwindcss = (settings = {}) =>
|
|
30
|
+
defineConfig([
|
|
32
31
|
{
|
|
33
32
|
files: FILES,
|
|
34
33
|
plugins: { tailwindcss: plugin },
|
|
@@ -39,13 +38,7 @@ export const tailwindcss = (options = {}) => {
|
|
|
39
38
|
},
|
|
40
39
|
settings: {
|
|
41
40
|
/** @type {import('eslint-plugin-tailwindcss').PluginSettings} */
|
|
42
|
-
tailwindcss: {
|
|
43
|
-
cssConfigPath: DEFAULT_CSS_CONFIG_PATH,
|
|
44
|
-
...(cssConfigPath !== undefined && { cssConfigPath }),
|
|
45
|
-
},
|
|
41
|
+
tailwindcss: { cssConfigPath: DEFAULT_CSS_CONFIG_PATH, ...settings },
|
|
46
42
|
},
|
|
47
43
|
},
|
|
48
|
-
|
|
49
|
-
...(Object.keys(flat).length > 0 ? [flat] : []),
|
|
50
44
|
]);
|
|
51
|
-
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from '@tanstack/eslint-plugin-query';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DATA_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для TanStack Query.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [@tanstack/query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
14
12
|
*/
|
|
15
|
-
export const tanstackQuery =
|
|
13
|
+
export const tanstackQuery = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
// The shipped config has no `files` key, so it would also cover data files.
|
|
18
16
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
@@ -20,5 +18,4 @@ export const tanstackQuery = createPlugin(() =>
|
|
|
20
18
|
ignores: [...(config.ignores ?? []), ...DATA_FILES],
|
|
21
19
|
})),
|
|
22
20
|
{ rules: { '@tanstack/query/infinite-query-property-order': 'off' } },
|
|
23
|
-
])
|
|
24
|
-
);
|
|
21
|
+
]);
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'eslint/config';
|
|
2
2
|
import plugin from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
createPlugin,
|
|
6
|
-
DATA_FILES,
|
|
7
|
-
FILES,
|
|
8
|
-
TEST_FILES,
|
|
9
|
-
TS_FILES,
|
|
10
|
-
} from '../base.js';
|
|
4
|
+
import { DATA_FILES, FILES, TEST_FILES, TS_FILES } from '../base.js';
|
|
11
5
|
import { TS_RULES } from '../rules/typescript.js';
|
|
12
6
|
|
|
13
7
|
/**
|
|
@@ -17,13 +11,11 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
17
11
|
* which makes linting slower. Use it instead of `typescript`, not alongside
|
|
18
12
|
* it.
|
|
19
13
|
*
|
|
20
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
21
|
-
*
|
|
22
14
|
* @returns {import('eslint').Linter.Config[]}
|
|
23
15
|
*
|
|
24
16
|
* @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
25
17
|
*/
|
|
26
|
-
export const typescriptTypeChecked =
|
|
18
|
+
export const typescriptTypeChecked = () =>
|
|
27
19
|
defineConfig([
|
|
28
20
|
// The parser is needed for every JS/TS/Vue file, not only for TypeScript ones,
|
|
29
21
|
// otherwise `.js` files fall back to the default parser and modern syntax
|
|
@@ -60,5 +52,4 @@ export const typescriptTypeChecked = createPlugin(() =>
|
|
|
60
52
|
files: TEST_FILES,
|
|
61
53
|
rules: { '@typescript-eslint/no-empty-function': 'off' },
|
|
62
54
|
},
|
|
63
|
-
])
|
|
64
|
-
);
|
|
55
|
+
]);
|
package/plugins/typescript.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { defineConfig } from 'eslint/config';
|
|
2
2
|
import plugin from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DATA_FILES, FILES, TEST_FILES } from '../base.js';
|
|
5
5
|
import { TS_RULES } from '../rules/typescript.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Правила TypeScript без анализа типов.
|
|
9
9
|
*
|
|
10
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
11
|
-
*
|
|
12
10
|
* @returns {import('eslint').Linter.Config[]}
|
|
13
11
|
*
|
|
14
12
|
* @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
15
13
|
*/
|
|
16
|
-
export const typescript =
|
|
14
|
+
export const typescript = () =>
|
|
17
15
|
defineConfig([
|
|
18
16
|
// `plugin.configs.strict`/`stylistic` contain blocks without a `files` key,
|
|
19
17
|
// so they would also land on data files that are not JavaScript at all.
|
|
@@ -29,5 +27,4 @@ export const typescript = createPlugin(() =>
|
|
|
29
27
|
files: TEST_FILES,
|
|
30
28
|
rules: { '@typescript-eslint/no-empty-function': 'off' },
|
|
31
29
|
},
|
|
32
|
-
])
|
|
33
|
-
);
|
|
30
|
+
]);
|
package/plugins/unicorn.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-unicorn';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DTS_FILES, FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила unicorn.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
14
12
|
*/
|
|
15
|
-
export const unicorn =
|
|
13
|
+
export const unicorn = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{ ...plugin.configs.recommended, files: FILES },
|
|
18
16
|
{
|
|
@@ -80,5 +78,4 @@ export const unicorn = createPlugin(() =>
|
|
|
80
78
|
files: ['**/temp/**/*.vue'],
|
|
81
79
|
rules: { 'unicorn/name-replacements': 'off' },
|
|
82
80
|
},
|
|
83
|
-
])
|
|
84
|
-
);
|
|
81
|
+
]);
|
package/plugins/unocss.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import plugin from '@unocss/eslint-config/flat';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для UnoCSS.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint)
|
|
14
12
|
*/
|
|
15
|
-
export const unocss =
|
|
13
|
+
export const unocss = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{ files: FILES, ...plugin },
|
|
18
16
|
{ files: FILES, rules: { 'unocss/order-attributify': 'off' } },
|
|
19
|
-
])
|
|
20
|
-
);
|
|
17
|
+
]);
|
package/plugins/vitest.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from '@vitest/eslint-plugin';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { TEST_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для тестов Vitest.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
|
|
14
12
|
*/
|
|
15
|
-
export const vitest =
|
|
13
|
+
export const vitest = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
files: TEST_FILES,
|
|
@@ -26,5 +24,4 @@ export const vitest = createPlugin(() =>
|
|
|
26
24
|
'vitest/require-to-throw-message': 'off',
|
|
27
25
|
},
|
|
28
26
|
},
|
|
29
|
-
])
|
|
30
|
-
);
|
|
27
|
+
]);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-vuejs-accessibility';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила доступности Vue.js-компонентов.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/)
|
|
14
12
|
*/
|
|
15
|
-
export const vueAccessibility =
|
|
13
|
+
export const vueAccessibility = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
...plugin.configs['flat/recommended'],
|
|
18
16
|
|
|
@@ -26,5 +24,4 @@ export const vueAccessibility = createPlugin(() =>
|
|
|
26
24
|
'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
|
|
27
25
|
},
|
|
28
26
|
},
|
|
29
|
-
])
|
|
30
|
-
);
|
|
27
|
+
]);
|
package/plugins/vue-i18n.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from '@intlify/eslint-plugin-vue-i18n';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DATA_FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Vue.js I18n.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/)
|
|
14
12
|
*/
|
|
15
|
-
export const vueI18n =
|
|
13
|
+
export const vueI18n = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
18
16
|
...config,
|
|
@@ -45,5 +43,4 @@ export const vueI18n = createPlugin(() =>
|
|
|
45
43
|
},
|
|
46
44
|
},
|
|
47
45
|
},
|
|
48
|
-
])
|
|
49
|
-
);
|
|
46
|
+
]);
|
package/plugins/vue.js
CHANGED
|
@@ -2,19 +2,17 @@ import plugin from 'eslint-plugin-vue';
|
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
import typescript from 'typescript-eslint';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { DATA_FILES, TEST_FILES, VUE_FILES } from '../base.js';
|
|
6
6
|
import { NO_RESTRICTED_SYNTAX } from '../rules/restricted-syntax.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Правила для Vue.js.
|
|
10
10
|
*
|
|
11
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
12
|
-
*
|
|
13
11
|
* @returns {import('eslint').Linter.Config[]}
|
|
14
12
|
*
|
|
15
13
|
* @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/)
|
|
16
14
|
*/
|
|
17
|
-
export const vue =
|
|
15
|
+
export const vue = () =>
|
|
18
16
|
defineConfig([
|
|
19
17
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
20
18
|
...config,
|
|
@@ -270,5 +268,4 @@ export const vue = createPlugin(() =>
|
|
|
270
268
|
},
|
|
271
269
|
|
|
272
270
|
{ files: TEST_FILES, rules: { 'vue/one-component-per-file': 'off' } },
|
|
273
|
-
])
|
|
274
|
-
);
|
|
271
|
+
]);
|
package/plugins/zod.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-zod';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для Zod-схем.
|
|
8
8
|
*
|
|
9
|
-
* @param {import('eslint').Linter.Config} [options] - Дополнительные flat-опции
|
|
10
|
-
*
|
|
11
9
|
* @returns {import('eslint').Linter.Config[]}
|
|
12
10
|
*
|
|
13
11
|
* @see [eslint-plugin-zod](https://github.com/marcalexiei/eslint-zod/tree/main/plugins/eslint-plugin-zod)
|
|
14
12
|
*/
|
|
15
|
-
export const zod =
|
|
13
|
+
export const zod = () =>
|
|
16
14
|
defineConfig([
|
|
17
15
|
{
|
|
18
16
|
...plugin.configs.recommended,
|
|
@@ -22,5 +20,4 @@ export const zod = createPlugin(() =>
|
|
|
22
20
|
'zod/consistent-import': ['error', { syntax: 'named' }],
|
|
23
21
|
},
|
|
24
22
|
},
|
|
25
|
-
])
|
|
26
|
-
);
|
|
23
|
+
]);
|