@alexlit/config-eslint 164.3.2 → 165.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/base.js +1 -1
- package/package.json +14 -14
- package/plugins/javascript.js +3 -3
- package/plugins/perfectionist.js +4 -4
- package/plugins/prettier.js +1 -1
- package/plugins/stylistic.js +3 -0
- package/plugins/tanstack-query.js +2 -1
- package/plugins/typescript-type-checked.js +11 -11
- package/plugins/typescript.js +2 -2
- package/plugins/unicorn.js +13 -13
- package/plugins/vue.js +7 -7
package/base.js
CHANGED
|
@@ -64,7 +64,7 @@ export const IGNORES = [
|
|
|
64
64
|
export const base = defineConfig([
|
|
65
65
|
{ files: FILES, languageOptions: { globals: globals.browser } },
|
|
66
66
|
|
|
67
|
-
// Node.js
|
|
67
|
+
// Глобальные объекты Node.js для commonjs/esm-файлов
|
|
68
68
|
{ files: ['**/*.{cjs,mjs}'], languageOptions: { globals: globals.node } },
|
|
69
69
|
|
|
70
70
|
{ linterOptions: { reportUnusedDisableDirectives: 'error' } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "165.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "eslint config",
|
|
6
6
|
"keywords": [
|
|
@@ -47,34 +47,34 @@
|
|
|
47
47
|
"@eslint/js": "^10.0.1",
|
|
48
48
|
"@eslint/json": "^2.1.1",
|
|
49
49
|
"@intlify/eslint-plugin-vue-i18n": "^4.5.1",
|
|
50
|
-
"@stylistic/eslint-plugin": "^
|
|
51
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
52
|
-
"@unocss/eslint-config": "^66.
|
|
50
|
+
"@stylistic/eslint-plugin": "^6.0.1",
|
|
51
|
+
"@tanstack/eslint-plugin-query": "^5.107.1",
|
|
52
|
+
"@unocss/eslint-config": "^66.13.0",
|
|
53
53
|
"@vitest/eslint-plugin": "^1.6.28",
|
|
54
|
-
"eslint": "^10.
|
|
54
|
+
"eslint": "^10.15.0",
|
|
55
55
|
"eslint-config-prettier": "^10.1.8",
|
|
56
56
|
"eslint-plugin-de-morgan": "^2.3.0",
|
|
57
|
-
"eslint-plugin-import-x": "^4.
|
|
58
|
-
"eslint-plugin-jsdoc": "^65.4.
|
|
59
|
-
"eslint-plugin-perfectionist": "^5.
|
|
57
|
+
"eslint-plugin-import-x": "^4.18.1",
|
|
58
|
+
"eslint-plugin-jsdoc": "^65.4.8",
|
|
59
|
+
"eslint-plugin-perfectionist": "^5.14.0",
|
|
60
60
|
"eslint-plugin-pinia": "^0.4.2",
|
|
61
61
|
"eslint-plugin-prettier": "^5.5.7",
|
|
62
62
|
"eslint-plugin-regexp": "^3.3.3",
|
|
63
63
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
64
64
|
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
65
|
-
"eslint-plugin-unicorn": "^
|
|
66
|
-
"eslint-plugin-vue": "^10.12.
|
|
65
|
+
"eslint-plugin-unicorn": "^80.0.0",
|
|
66
|
+
"eslint-plugin-vue": "^10.12.1",
|
|
67
67
|
"eslint-plugin-vuejs-accessibility": "^2.6.3",
|
|
68
|
-
"eslint-plugin-zod": "^5.
|
|
68
|
+
"eslint-plugin-zod": "^5.3.0",
|
|
69
69
|
"globals": "^17.14.0",
|
|
70
70
|
"jsonc-eslint-parser": "^3.3.0",
|
|
71
71
|
"typescript": "^6.0.3",
|
|
72
|
-
"typescript-eslint": "^8.72.
|
|
73
|
-
"vue-eslint-parser": "^10.4.
|
|
72
|
+
"typescript-eslint": "^8.72.2",
|
|
73
|
+
"vue-eslint-parser": "^10.4.2",
|
|
74
74
|
"yaml-eslint-parser": "^2.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"tailwindcss": "^4.3.
|
|
77
|
+
"tailwindcss": "^4.3.5"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public",
|
package/plugins/javascript.js
CHANGED
|
@@ -43,8 +43,8 @@ export const javascript = (config = []) =>
|
|
|
43
43
|
],
|
|
44
44
|
'no-restricted-globals': [
|
|
45
45
|
'error',
|
|
46
|
-
// `event`, `top`
|
|
47
|
-
//
|
|
46
|
+
// `event`, `top` и `parent` - глобальные свойства браузера.
|
|
47
|
+
// Используйте `window.event` / `window.top` / `window.parent`.
|
|
48
48
|
{ message: 'Use `window.event` instead.', name: 'event' },
|
|
49
49
|
{ message: 'Use `window.parent` instead.', name: 'parent' },
|
|
50
50
|
{ message: 'Use `window.top` instead.', name: 'top' },
|
|
@@ -100,7 +100,7 @@ export const javascript = (config = []) =>
|
|
|
100
100
|
},
|
|
101
101
|
|
|
102
102
|
{
|
|
103
|
-
//
|
|
103
|
+
// В тестах разрешено использовать console и alert
|
|
104
104
|
files: TEST_FILES,
|
|
105
105
|
rules: { 'no-alert': 'off', 'no-console': 'off' },
|
|
106
106
|
},
|
package/plugins/perfectionist.js
CHANGED
|
@@ -22,13 +22,13 @@ export const perfectionist = (config = []) =>
|
|
|
22
22
|
'warn',
|
|
23
23
|
{
|
|
24
24
|
customGroups: [
|
|
25
|
-
//
|
|
25
|
+
// Хеш (Nuxt)
|
|
26
26
|
{ elementNamePattern: ['^#'], groupName: 'hash' },
|
|
27
27
|
|
|
28
28
|
// @@/
|
|
29
29
|
{ elementNamePattern: ['^@@/'], groupName: 'double-at' },
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// Универсальные
|
|
32
32
|
{ elementNamePattern: ['^@/api'], groupName: 'universal-api' },
|
|
33
33
|
{
|
|
34
34
|
elementNamePattern: ['^@/assets'],
|
|
@@ -75,13 +75,13 @@ export const perfectionist = (config = []) =>
|
|
|
75
75
|
'type-import',
|
|
76
76
|
['value-builtin', 'value-external'],
|
|
77
77
|
|
|
78
|
-
//
|
|
78
|
+
// Хеш (Nuxt)
|
|
79
79
|
'hash',
|
|
80
80
|
|
|
81
81
|
// @@/
|
|
82
82
|
'double-at',
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
// Универсальные
|
|
85
85
|
'universal-api',
|
|
86
86
|
'universal-assets',
|
|
87
87
|
'universal-components',
|
package/plugins/prettier.js
CHANGED
package/plugins/stylistic.js
CHANGED
|
@@ -49,6 +49,9 @@ export const stylistic = (config = []) =>
|
|
|
49
49
|
beforeLineComment: false,
|
|
50
50
|
},
|
|
51
51
|
],
|
|
52
|
+
// Новое в @stylistic 6 правило конфликтует с Prettier:
|
|
53
|
+
// eslint-config-prettier 10.1.8 его ещё не отключает
|
|
54
|
+
'@stylistic/list-style': 'off',
|
|
52
55
|
'@stylistic/padding-line-between-statements': [
|
|
53
56
|
'warn',
|
|
54
57
|
// always
|
|
@@ -14,7 +14,8 @@ import { DATA_FILES } from '../base.js';
|
|
|
14
14
|
*/
|
|
15
15
|
export const tanstackQuery = (config = []) =>
|
|
16
16
|
defineConfig([
|
|
17
|
-
//
|
|
17
|
+
// В поставляемой конфигурации нет ключа `files`, поэтому она также
|
|
18
|
+
// затрагивала бы data-файлы.
|
|
18
19
|
...plugin.configs['flat/recommended'].map((config) => ({
|
|
19
20
|
...config,
|
|
20
21
|
ignores: [...(config.ignores ?? []), ...DATA_FILES],
|
|
@@ -7,9 +7,9 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Type-aware правила TypeScript.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Включается вручную: требует `tsconfig.json` в проекте и информацию о типах,
|
|
11
|
+
* из-за чего линтинг работает медленнее. Используйте его вместо `typescript`, а
|
|
12
|
+
* не вместе с ним.
|
|
13
13
|
*
|
|
14
14
|
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
15
15
|
*
|
|
@@ -19,15 +19,15 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export const typescriptTypeChecked = (config = []) =>
|
|
21
21
|
defineConfig([
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// (`import.meta`, top-level await)
|
|
22
|
+
// Парсер нужен для каждого JS/TS/Vue-файла, а не только для TypeScript,
|
|
23
|
+
// иначе `.js`-файлы вернутся к парсеру по умолчанию, и современный синтаксис
|
|
24
|
+
// (`import.meta`, top-level await) сломается.
|
|
25
25
|
{ ...plugin.configs.base, files: FILES },
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
// `plugin.configs.strict`/`stylistic`
|
|
30
|
-
//
|
|
27
|
+
// Правила без анализа типов - та же область, что и у обычного плагина `typescript`,
|
|
28
|
+
// поэтому `.js`/`.vue`-файлы сохраняют TypeScript-версии правил.
|
|
29
|
+
// `plugin.configs.strict`/`stylistic` содержат блоки без ключа `files`,
|
|
30
|
+
// поэтому они также применялись бы к data-файлам, которые вообще не JavaScript.
|
|
31
31
|
...[...plugin.configs.strict, ...plugin.configs.stylistic].map(
|
|
32
32
|
(config) => ({
|
|
33
33
|
...config,
|
|
@@ -35,7 +35,7 @@ export const typescriptTypeChecked = (config = []) =>
|
|
|
35
35
|
}),
|
|
36
36
|
),
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// Правила с анализом типов имеют смысл только там, где доступна информация о типах.
|
|
39
39
|
...plugin.configs.strictTypeChecked.map((config) => ({
|
|
40
40
|
...config,
|
|
41
41
|
files: TS_FILES,
|
package/plugins/typescript.js
CHANGED
|
@@ -15,8 +15,8 @@ import { TS_RULES } from '../rules/typescript.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export const typescript = (config = []) =>
|
|
17
17
|
defineConfig([
|
|
18
|
-
// `plugin.configs.strict`/`stylistic`
|
|
19
|
-
//
|
|
18
|
+
// `plugin.configs.strict`/`stylistic` содержат блоки без ключа `files`,
|
|
19
|
+
// поэтому они также применялись бы к data-файлам, которые вообще не JavaScript.
|
|
20
20
|
...[...plugin.configs.strict, ...plugin.configs.stylistic].map(
|
|
21
21
|
(config) => ({
|
|
22
22
|
...config,
|
package/plugins/unicorn.js
CHANGED
|
@@ -27,9 +27,9 @@ export const unicorn = (config = []) =>
|
|
|
27
27
|
'error',
|
|
28
28
|
{ default: 'arrow-function' },
|
|
29
29
|
],
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// `vue/match-component-file-name`
|
|
30
|
+
// Явно: значение по умолчанию оказалось kebab case, но намерение
|
|
31
|
+
// стоит зафиксировать. Применяется и к `.vue`-компонентам, поэтому
|
|
32
|
+
// `vue/match-component-file-name` синхронизирован с этим в `vue.js`.
|
|
33
33
|
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
34
34
|
'unicorn/iteration-fallback-style': ['error', 'guard'],
|
|
35
35
|
'unicorn/name-replacements': 'off',
|
|
@@ -37,18 +37,18 @@ export const unicorn = (config = []) =>
|
|
|
37
37
|
'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
|
|
38
38
|
'unicorn/no-empty-file': 'off',
|
|
39
39
|
'unicorn/no-for-each': 'off',
|
|
40
|
-
'unicorn/no-this-outside-of-class': 'off', //
|
|
41
|
-
'unicorn/no-top-level-side-effects': 'off', // Vue.js
|
|
42
|
-
'unicorn/no-unused-properties': 'off', //
|
|
43
|
-
'unicorn/prefer-dom-node-html-methods': 'off', // Safari
|
|
40
|
+
'unicorn/no-this-outside-of-class': 'off', // используется в сеттерах/геттерах
|
|
41
|
+
'unicorn/no-top-level-side-effects': 'off', // специфика Vue.js
|
|
42
|
+
'unicorn/no-unused-properties': 'off', // не учитывает локальные ключи
|
|
43
|
+
'unicorn/prefer-dom-node-html-methods': 'off', // Safari не поддерживает setHTML()
|
|
44
44
|
'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
|
|
45
|
-
'unicorn/prefer-https': 'off', // SVG
|
|
45
|
+
'unicorn/prefer-https': 'off', // для SVG нужен HTTP
|
|
46
46
|
'unicorn/prefer-import-meta-properties': 'warn',
|
|
47
|
-
'unicorn/prefer-iterator-concat': 'off', // ES2026
|
|
47
|
+
'unicorn/prefer-iterator-concat': 'off', // только ES2026
|
|
48
48
|
'unicorn/prefer-json-import': 'warn',
|
|
49
49
|
'unicorn/prefer-module': 'warn',
|
|
50
50
|
'unicorn/prefer-node-protocol': 'warn',
|
|
51
|
-
'unicorn/prefer-temporal': 'off', // ES2026
|
|
51
|
+
'unicorn/prefer-temporal': 'off', // только ES2026
|
|
52
52
|
'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
|
|
53
53
|
'unicorn/prefer-uint8array-hex': 'warn',
|
|
54
54
|
'unicorn/relative-url-style': ['error', 'always'],
|
|
@@ -58,9 +58,9 @@ export const unicorn = (config = []) =>
|
|
|
58
58
|
{ files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
|
|
59
59
|
{ files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
|
|
60
60
|
{
|
|
61
|
-
// `null`
|
|
62
|
-
// `ref<Type | null>(null)`
|
|
63
|
-
//
|
|
61
|
+
// `null` - часть контракта типов в Vue.js SFC:
|
|
62
|
+
// `ref<Type | null>(null)` - идиоматичный способ объявить изначально
|
|
63
|
+
// пустое реактивное значение. Везде ещё `null` остаётся ошибкой.
|
|
64
64
|
files: VUE_FILES,
|
|
65
65
|
rules: {
|
|
66
66
|
'unicorn/no-null': 'off',
|
package/plugins/vue.js
CHANGED
|
@@ -31,7 +31,7 @@ export const vue = (config = []) =>
|
|
|
31
31
|
],
|
|
32
32
|
'no-restricted-syntax': [
|
|
33
33
|
'error',
|
|
34
|
-
//
|
|
34
|
+
// Объединяем общий список, а не заменяем его
|
|
35
35
|
...NO_RESTRICTED_SYNTAX,
|
|
36
36
|
{
|
|
37
37
|
message:
|
|
@@ -87,12 +87,12 @@ export const vue = (config = []) =>
|
|
|
87
87
|
'defineOptions',
|
|
88
88
|
'defineSlots',
|
|
89
89
|
|
|
90
|
-
//
|
|
90
|
+
// Nuxt (могут использоваться props)
|
|
91
91
|
'createUseAsyncData',
|
|
92
92
|
'createUseFetch',
|
|
93
93
|
|
|
94
94
|
'onPrehydrate',
|
|
95
|
-
// /
|
|
95
|
+
// /Nuxt (могут использоваться props)
|
|
96
96
|
|
|
97
97
|
// nuxi-ui
|
|
98
98
|
'defineLocale',
|
|
@@ -124,10 +124,10 @@ export const vue = (config = []) =>
|
|
|
124
124
|
svg: 'always',
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
// PascalCase
|
|
127
|
+
// Синхронизировано с `unicorn/filename-case` в `unicorn.js`:
|
|
128
|
+
// компоненты лежат в kebab-case-файлах, поэтому имя компонента
|
|
129
|
+
// выводится из имени kebab-case-файла, а не требуется
|
|
130
|
+
// PascalCase в самом имени файла.
|
|
131
131
|
'vue/match-component-file-name': [
|
|
132
132
|
'error',
|
|
133
133
|
{ extensions: ['vue'], shouldMatchCase: false },
|