@alexlit/config-eslint 167.6.1 → 167.7.1
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/package.json +3 -3
- package/plugins/jsdoc.js +50 -6
- package/plugins/perfectionist.js +80 -86
- package/plugins/sonar.js +70 -3
- package/plugins/tailwindcss.js +15 -0
- package/plugins/unicorn.js +25 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-eslint",
|
|
3
|
-
"version": "167.
|
|
3
|
+
"version": "167.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "eslint config",
|
|
6
6
|
"keywords": [
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"eslint-config-prettier": "^10.1.9",
|
|
56
56
|
"eslint-plugin-better-tailwindcss": "^4.11.0",
|
|
57
57
|
"eslint-plugin-de-morgan": "^2.3.0",
|
|
58
|
-
"eslint-plugin-import-x": "^4.
|
|
59
|
-
"eslint-plugin-jsdoc": "^65.
|
|
58
|
+
"eslint-plugin-import-x": "^4.19.0",
|
|
59
|
+
"eslint-plugin-jsdoc": "^65.7.0",
|
|
60
60
|
"eslint-plugin-perfectionist": "^5.14.0",
|
|
61
61
|
"eslint-plugin-pinia": "^0.4.2",
|
|
62
62
|
"eslint-plugin-regexp": "^3.3.3",
|
package/plugins/jsdoc.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
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 { FILES, TS_FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила для JSDoc-комментариев.
|
|
8
8
|
*
|
|
9
|
+
* Для `.js` и `.ts` используются готовые пресеты плагина:
|
|
10
|
+
* `flat/recommended-mixed` выбирает `recommended-typescript-flavor` для
|
|
11
|
+
* `js/jsx/cjs/mjs` и `recommended-typescript` для `ts/tsx/cts/mts`.
|
|
12
|
+
*
|
|
13
|
+
* `.vue` обрабатывается отдельно: скрипт в SFC может быть как JavaScript, так и
|
|
14
|
+
* TypeScript, поэтому тип-зависимые правила для него отключены.
|
|
15
|
+
*
|
|
9
16
|
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
17
|
*
|
|
11
18
|
* @returns {import('eslint').Linter.Config[]}
|
|
@@ -14,20 +21,57 @@ import { FILES } from '../base.js';
|
|
|
14
21
|
*/
|
|
15
22
|
export const jsdoc = (config = []) =>
|
|
16
23
|
defineConfig([
|
|
17
|
-
|
|
24
|
+
...plugin.configs['flat/recommended-mixed'],
|
|
25
|
+
|
|
18
26
|
{
|
|
19
|
-
files:
|
|
27
|
+
files: VUE_FILES,
|
|
28
|
+
...plugin.configs['flat/recommended'],
|
|
20
29
|
rules: {
|
|
21
|
-
'
|
|
30
|
+
...plugin.configs['flat/recommended'].rules,
|
|
31
|
+
|
|
32
|
+
// Скрипт в `.vue` может быть на JavaScript или TypeScript.
|
|
33
|
+
// Не требуем типы (иначе страдает TS) и не запрещаем их
|
|
34
|
+
// (иначе страдает JS).
|
|
35
|
+
'jsdoc/no-types': 'off',
|
|
22
36
|
'jsdoc/no-undefined-types': 'off',
|
|
37
|
+
'jsdoc/require-next-type': 'off',
|
|
38
|
+
'jsdoc/require-param-type': 'off',
|
|
39
|
+
'jsdoc/require-property-type': 'off',
|
|
40
|
+
'jsdoc/require-returns-type': 'off',
|
|
41
|
+
'jsdoc/require-throws-type': 'off',
|
|
42
|
+
'jsdoc/require-yields-type': 'off',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
files: FILES,
|
|
48
|
+
rules: {
|
|
49
|
+
// Осмысленность и корректность блоков.
|
|
50
|
+
'jsdoc/informative-docs': 'warn',
|
|
51
|
+
'jsdoc/no-bad-blocks': 'warn',
|
|
52
|
+
'jsdoc/require-description': 'warn',
|
|
53
|
+
// JSDoc не обязателен, проверяются только существующие блоки.
|
|
23
54
|
'jsdoc/require-jsdoc': 'off',
|
|
55
|
+
// Описания не обязательны, проверяются синтаксис и имена тегов.
|
|
24
56
|
'jsdoc/require-param-description': 'off',
|
|
25
|
-
'jsdoc/require-
|
|
57
|
+
'jsdoc/require-property-description': 'off',
|
|
26
58
|
'jsdoc/require-returns': 'off',
|
|
27
59
|
'jsdoc/require-returns-description': 'off',
|
|
28
|
-
|
|
60
|
+
// Форматирование JSDoc делает prettier-plugin-jsdoc
|
|
61
|
+
// (`jsdocSeparateTagGroups`, `jsdocSeparateReturnsFromParam`).
|
|
29
62
|
'jsdoc/tag-lines': 'off',
|
|
30
63
|
},
|
|
64
|
+
settings: { jsdoc: { mode: 'typescript' } },
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
{
|
|
68
|
+
files: [...TS_FILES, ...VUE_FILES],
|
|
69
|
+
rules: {
|
|
70
|
+
// В TS типы живут в коде, а не в JSDoc.
|
|
71
|
+
'jsdoc/require-next-type': 'off',
|
|
72
|
+
'jsdoc/require-throws-type': 'off',
|
|
73
|
+
'jsdoc/require-yields-type': 'off',
|
|
74
|
+
},
|
|
31
75
|
},
|
|
32
76
|
|
|
33
77
|
config,
|
package/plugins/perfectionist.js
CHANGED
|
@@ -3,9 +3,62 @@ import { defineConfig } from 'eslint/config';
|
|
|
3
3
|
|
|
4
4
|
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
+
/** Группы внутренних алиасов `@/...`, которые сортируются отдельно */
|
|
7
|
+
const UNIVERSAL_GROUPS = [
|
|
8
|
+
'api',
|
|
9
|
+
'assets',
|
|
10
|
+
'components',
|
|
11
|
+
'composables',
|
|
12
|
+
'constants',
|
|
13
|
+
'directives',
|
|
14
|
+
'layouts',
|
|
15
|
+
'pages',
|
|
16
|
+
'plugins',
|
|
17
|
+
'stores',
|
|
18
|
+
'utils',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/** Кастомные группы импортов: хеши и внутренние алиасы */
|
|
22
|
+
const CUSTOM_GROUPS = [
|
|
23
|
+
// Хеш (Nuxt и Node subpath imports)
|
|
24
|
+
{ elementNamePattern: ['^#'], groupName: 'hash' },
|
|
25
|
+
|
|
26
|
+
// @@/
|
|
27
|
+
{ elementNamePattern: ['^@@/'], groupName: 'double-at' },
|
|
28
|
+
|
|
29
|
+
// Универсальные
|
|
30
|
+
...UNIVERSAL_GROUPS.map((name) => ({
|
|
31
|
+
elementNamePattern: [`^@/${name}(?:/|$)`],
|
|
32
|
+
groupName: `universal-${name}`,
|
|
33
|
+
})),
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
/** Порядок групп импортов: дефолтный порядок плагина + Nuxt-алиасы */
|
|
37
|
+
const IMPORT_GROUPS = [
|
|
38
|
+
'type-import',
|
|
39
|
+
['value-builtin', 'value-external'],
|
|
40
|
+
'hash',
|
|
41
|
+
'double-at',
|
|
42
|
+
...UNIVERSAL_GROUPS.map((name) => `universal-${name}`),
|
|
43
|
+
'type-internal',
|
|
44
|
+
'value-internal',
|
|
45
|
+
['type-parent', 'type-sibling', 'type-index'],
|
|
46
|
+
['value-parent', 'value-sibling', 'value-index'],
|
|
47
|
+
'ts-equals-import',
|
|
48
|
+
'unknown',
|
|
49
|
+
];
|
|
50
|
+
|
|
6
51
|
/**
|
|
7
52
|
* Правила сортировки импортов, объектов, интерфейсов и типов.
|
|
8
53
|
*
|
|
54
|
+
* Сортировка импортов и объектных структур включена как `warn`: она полезна, но
|
|
55
|
+
* не должна блокировать CI. Остальные правила `recommended-natural` остаются
|
|
56
|
+
* `error`.
|
|
57
|
+
*
|
|
58
|
+
* Алиасы проекта, не перечисленные в `internalPattern`/`customGroups`, попадают
|
|
59
|
+
* в `value-internal`/`type-internal`. Свои шаблоны добавляйте через
|
|
60
|
+
* `plugins.perfectionist([...])`.
|
|
61
|
+
*
|
|
9
62
|
* @param {import('eslint').Linter.Config | import('eslint').Linter.Config[]} [config]
|
|
10
63
|
*
|
|
11
64
|
* @returns {import('eslint').Linter.Config[]}
|
|
@@ -21,103 +74,44 @@ export const perfectionist = (config = []) =>
|
|
|
21
74
|
'perfectionist/sort-imports': [
|
|
22
75
|
'warn',
|
|
23
76
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
elementNamePattern: ['^@/assets'],
|
|
35
|
-
groupName: 'universal-assets',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
elementNamePattern: ['^@/components'],
|
|
39
|
-
groupName: 'universal-components',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
elementNamePattern: ['^@/composables'],
|
|
43
|
-
groupName: 'universal-composables',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
elementNamePattern: ['^@/constants'],
|
|
47
|
-
groupName: 'universal-constants',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
elementNamePattern: ['^@/directives'],
|
|
51
|
-
groupName: 'universal-directives',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
elementNamePattern: ['^@/layouts'],
|
|
55
|
-
groupName: 'universal-layouts',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
elementNamePattern: ['^@/pages'],
|
|
59
|
-
groupName: 'universal-pages',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
elementNamePattern: ['^@/plugins'],
|
|
63
|
-
groupName: 'universal-plugins',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
elementNamePattern: ['^@/stores'],
|
|
67
|
-
groupName: 'universal-stores',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
elementNamePattern: ['^@/utils'],
|
|
71
|
-
groupName: 'universal-utils',
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
groups: [
|
|
75
|
-
'type-import',
|
|
76
|
-
['value-builtin', 'value-external'],
|
|
77
|
-
|
|
78
|
-
// Хеш (Nuxt)
|
|
79
|
-
'hash',
|
|
80
|
-
|
|
81
|
-
// @@/
|
|
82
|
-
'double-at',
|
|
83
|
-
|
|
84
|
-
// Универсальные
|
|
85
|
-
'universal-api',
|
|
86
|
-
'universal-assets',
|
|
87
|
-
'universal-components',
|
|
88
|
-
'universal-composables',
|
|
89
|
-
'universal-constants',
|
|
90
|
-
'universal-directives',
|
|
91
|
-
'universal-layouts',
|
|
92
|
-
'universal-pages',
|
|
93
|
-
'universal-plugins',
|
|
94
|
-
'universal-stores',
|
|
95
|
-
'universal-utils',
|
|
96
|
-
|
|
97
|
-
'type-internal',
|
|
98
|
-
'value-internal',
|
|
99
|
-
|
|
100
|
-
['type-parent', 'type-sibling', 'type-index'],
|
|
101
|
-
['value-parent', 'value-sibling', 'value-index'],
|
|
102
|
-
|
|
103
|
-
'ts-equals-import',
|
|
104
|
-
'unknown',
|
|
105
|
-
],
|
|
106
|
-
internalPattern: ['^@@/.*', '^@/.*'],
|
|
77
|
+
// Список групп повторяет дефолтный порядок плагина и дополнен
|
|
78
|
+
// Nuxt-алиасами. При обновлении плагина сверяйте его с
|
|
79
|
+
// `defaultOptions.groups` в `sort-imports`.
|
|
80
|
+
customGroups: CUSTOM_GROUPS,
|
|
81
|
+
groups: IMPORT_GROUPS,
|
|
82
|
+
// Алиасы, не попавшие в customGroups, считаются внутренними
|
|
83
|
+
// только при совпадении с internalPattern.
|
|
84
|
+
internalPattern: ['^~/.+', '^@/.+', '^@@/.+', '^#.+'],
|
|
85
|
+
order: 'asc',
|
|
107
86
|
type: 'natural',
|
|
108
87
|
},
|
|
109
88
|
],
|
|
110
89
|
'perfectionist/sort-interfaces': [
|
|
111
90
|
'warn',
|
|
112
|
-
{
|
|
91
|
+
{
|
|
92
|
+
newlinesBetween: 0,
|
|
93
|
+
order: 'asc',
|
|
94
|
+
partitionByComment: false,
|
|
95
|
+
type: 'natural',
|
|
96
|
+
},
|
|
113
97
|
],
|
|
114
98
|
'perfectionist/sort-object-types': [
|
|
115
99
|
'warn',
|
|
116
|
-
{
|
|
100
|
+
{
|
|
101
|
+
newlinesBetween: 0,
|
|
102
|
+
order: 'asc',
|
|
103
|
+
partitionByComment: false,
|
|
104
|
+
type: 'natural',
|
|
105
|
+
},
|
|
117
106
|
],
|
|
118
107
|
'perfectionist/sort-objects': [
|
|
119
108
|
'warn',
|
|
120
|
-
{
|
|
109
|
+
{
|
|
110
|
+
newlinesBetween: 0,
|
|
111
|
+
order: 'asc',
|
|
112
|
+
partitionByComment: false,
|
|
113
|
+
type: 'natural',
|
|
114
|
+
},
|
|
121
115
|
],
|
|
122
116
|
},
|
|
123
117
|
},
|
package/plugins/sonar.js
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-sonarjs';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { FILES } from '../base.js';
|
|
4
|
+
import { FILES, TEST_FILES } from '../base.js';
|
|
5
|
+
|
|
6
|
+
/** Тестовые правила SonarJS: вне тестов не должны срабатывать. */
|
|
7
|
+
const TEST_ONLY_RULES = [
|
|
8
|
+
'sonarjs/assertions-in-test-cases',
|
|
9
|
+
'sonarjs/async-test-assertions',
|
|
10
|
+
'sonarjs/chai-determinate-assertion',
|
|
11
|
+
'sonarjs/explicit-test-skip',
|
|
12
|
+
'sonarjs/hooks-before-test-cases',
|
|
13
|
+
'sonarjs/inverted-assertion-arguments',
|
|
14
|
+
'sonarjs/no-debug-commands-in-ui-tests',
|
|
15
|
+
'sonarjs/no-duplicate-parameterized-test-case',
|
|
16
|
+
'sonarjs/no-empty-parameterized-test-dataset',
|
|
17
|
+
'sonarjs/no-empty-test-title',
|
|
18
|
+
'sonarjs/no-fixed-wait-in-tests',
|
|
19
|
+
'sonarjs/no-forced-browser-interaction',
|
|
20
|
+
'sonarjs/no-incompatible-assertion-types',
|
|
21
|
+
'sonarjs/no-incomplete-assertions',
|
|
22
|
+
'sonarjs/no-interpolation-in-inline-snapshots',
|
|
23
|
+
'sonarjs/no-same-argument-assert',
|
|
24
|
+
'sonarjs/no-skipped-tests',
|
|
25
|
+
'sonarjs/no-trivial-assertions',
|
|
26
|
+
'sonarjs/parameterized-tests',
|
|
27
|
+
'sonarjs/prefer-cypress-should',
|
|
28
|
+
'sonarjs/prefer-specific-assertions',
|
|
29
|
+
'sonarjs/stable-tests',
|
|
30
|
+
'sonarjs/synchronous-exception-assertions',
|
|
31
|
+
'sonarjs/synchronous-suite-callback',
|
|
32
|
+
'sonarjs/test-check-exception',
|
|
33
|
+
'sonarjs/testing-library-prefer-query-by-disappearance',
|
|
34
|
+
'sonarjs/testing-library-query-assertion',
|
|
35
|
+
'sonarjs/vitest-mock-at-module-scope',
|
|
36
|
+
];
|
|
5
37
|
|
|
6
38
|
/**
|
|
7
39
|
* Правила SonarJS.
|
|
@@ -19,11 +51,46 @@ export const sonar = (config = []) =>
|
|
|
19
51
|
...plugin.configs.recommended,
|
|
20
52
|
rules: {
|
|
21
53
|
...plugin.configs.recommended.rules,
|
|
22
|
-
|
|
23
|
-
'sonarjs/
|
|
54
|
+
// Точные дубли core/TS/unicorn/regexp/vitest: оставляем профильные плагины.
|
|
55
|
+
'sonarjs/assertions-in-tests': 'off', // vitest/expect-expect
|
|
56
|
+
'sonarjs/class-name': 'off', // @typescript-eslint/naming-convention
|
|
57
|
+
'sonarjs/duplicates-in-character-class': 'off', // regexp/no-dupe-characters-character-class
|
|
58
|
+
'sonarjs/no-commented-code': 'warn', // шумное правило, оставляем предупреждением
|
|
59
|
+
'sonarjs/no-control-regex': 'off', // no-control-regex
|
|
60
|
+
'sonarjs/no-delete-var': 'off', // no-delete-var
|
|
61
|
+
'sonarjs/no-duplicate-test-title': 'off', // vitest/no-identical-title
|
|
62
|
+
'sonarjs/no-empty-character-class': 'off', // regexp/no-empty-character-class
|
|
63
|
+
'sonarjs/no-empty-group': 'off', // regexp/no-empty-group
|
|
64
|
+
'sonarjs/no-exclusive-tests': 'off', // vitest/no-focused-tests
|
|
65
|
+
'sonarjs/no-misleading-character-class': 'off', // no-misleading-character-class
|
|
66
|
+
'sonarjs/no-parameter-reassignment': 'off', // no-param-reassign
|
|
67
|
+
'sonarjs/no-primitive-wrappers': 'off', // unicorn/new-for-builtins
|
|
68
|
+
'sonarjs/no-regex-spaces': 'off', // no-regex-spaces
|
|
69
|
+
'sonarjs/no-unused-vars': 'off', // @typescript-eslint/no-unused-vars
|
|
70
|
+
'sonarjs/no-useless-catch': 'off', // no-useless-catch
|
|
71
|
+
'sonarjs/prefer-default-last': 'off', // default-case-last
|
|
72
|
+
'sonarjs/prefer-single-boolean-return': 'off', // unicorn/prefer-boolean-return
|
|
73
|
+
'sonarjs/slow-regex': 'off', // regexp/no-super-linear-backtracking
|
|
74
|
+
'sonarjs/todo-tag': 'off', // TODO разрешены, срочные маркеры остаются ошибкой
|
|
24
75
|
'sonarjs/unused-import': 'off', // @typescript-eslint/no-unused-vars
|
|
25
76
|
},
|
|
26
77
|
},
|
|
78
|
+
{
|
|
79
|
+
// Тестовые правила SonarJS не должны срабатывать в обычном коде.
|
|
80
|
+
files: FILES,
|
|
81
|
+
ignores: TEST_FILES,
|
|
82
|
+
rules: Object.fromEntries(TEST_ONLY_RULES.map((rule) => [rule, 'off'])),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
// Фейковые секреты, IP и HTTP-URL в тестах и фикстурах - норма.
|
|
86
|
+
files: [...TEST_FILES, '**/{fixtures,mocks}/**/*.{js,ts,vue}'],
|
|
87
|
+
rules: {
|
|
88
|
+
'sonarjs/no-clear-text-protocols': 'off',
|
|
89
|
+
'sonarjs/no-hardcoded-ip': 'off',
|
|
90
|
+
'sonarjs/no-hardcoded-passwords': 'off',
|
|
91
|
+
'sonarjs/no-hardcoded-secrets': 'off',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
27
94
|
|
|
28
95
|
config,
|
|
29
96
|
]);
|
package/plugins/tailwindcss.js
CHANGED
|
@@ -5,6 +5,9 @@ import { FILES, VUE_FILES } from '../base.js';
|
|
|
5
5
|
|
|
6
6
|
const DEFAULT_ENTRY_POINT = './styles/tailwind.css';
|
|
7
7
|
|
|
8
|
+
/** Пути Nuxt UI app config, в которых лежат Tailwind-классы. */
|
|
9
|
+
const NUXT_UI_CLASS_PATH = String.raw`^ui\..*\.(?:slots|variants|compoundSlots|compoundVariants|base|class|className)(?:\..*)?$`;
|
|
10
|
+
|
|
8
11
|
const rules = {
|
|
9
12
|
...plugin.configs.correctness.rules,
|
|
10
13
|
|
|
@@ -82,6 +85,18 @@ export const tailwindcss = (config = []) =>
|
|
|
82
85
|
match: [{ type: 'strings' }, { type: 'objectValues' }],
|
|
83
86
|
name: ':ui',
|
|
84
87
|
},
|
|
88
|
+
// Nuxt UI app config: классы лежат в объекте defineAppConfig.
|
|
89
|
+
{
|
|
90
|
+
kind: 'callee',
|
|
91
|
+
match: [{ path: NUXT_UI_CLASS_PATH, type: 'objectValues' }],
|
|
92
|
+
name: '^defineAppConfig$',
|
|
93
|
+
},
|
|
94
|
+
// Альтернативный экспорт темы отдельным объектом.
|
|
95
|
+
{
|
|
96
|
+
kind: 'variable',
|
|
97
|
+
match: [{ type: 'objectValues' }],
|
|
98
|
+
name: '^ui$',
|
|
99
|
+
},
|
|
85
100
|
],
|
|
86
101
|
},
|
|
87
102
|
},
|
package/plugins/unicorn.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-unicorn';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { DTS_FILES, FILES, VUE_FILES } from '../base.js';
|
|
4
|
+
import { DTS_FILES, FILES, TEST_FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Правила unicorn.
|
|
@@ -18,7 +18,8 @@ export const unicorn = (config = []) =>
|
|
|
18
18
|
{
|
|
19
19
|
files: FILES,
|
|
20
20
|
rules: {
|
|
21
|
-
'unicorn/comment-content':
|
|
21
|
+
'unicorn/comment-content': 'warn',
|
|
22
|
+
'unicorn/consistent-class-member-order': 'off', // perfectionist/sort-classes
|
|
22
23
|
'unicorn/consistent-function-scoping': [
|
|
23
24
|
'error',
|
|
24
25
|
{ checkArrowFunctions: false },
|
|
@@ -27,9 +28,6 @@ export const unicorn = (config = []) =>
|
|
|
27
28
|
'error',
|
|
28
29
|
{ default: 'arrow-function' },
|
|
29
30
|
],
|
|
30
|
-
// Явно: значение по умолчанию оказалось kebab case, но намерение
|
|
31
|
-
// стоит зафиксировать. Применяется и к `.vue`-компонентам, поэтому
|
|
32
|
-
// `vue/match-component-file-name` синхронизирован с этим в `vue.js`.
|
|
33
31
|
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
34
32
|
'unicorn/iteration-fallback-style': ['error', 'guard'],
|
|
35
33
|
'unicorn/name-replacements': 'off',
|
|
@@ -37,18 +35,19 @@ export const unicorn = (config = []) =>
|
|
|
37
35
|
'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
|
|
38
36
|
'unicorn/no-empty-file': 'off',
|
|
39
37
|
'unicorn/no-for-each': 'off',
|
|
40
|
-
'unicorn/no-this-outside-of-class': 'off', //
|
|
38
|
+
'unicorn/no-this-outside-of-class': 'off', // Vue.js Options API использует this в методах
|
|
41
39
|
'unicorn/no-top-level-side-effects': 'off', // специфика Vue.js
|
|
42
|
-
|
|
43
|
-
'unicorn/prefer-dom-node-html-methods':
|
|
40
|
+
// Проверяет только getHTML(): setHTML() в дефолте выключен из-за Safari.
|
|
41
|
+
'unicorn/prefer-dom-node-html-methods': [
|
|
42
|
+
'error',
|
|
43
|
+
{ checkGetHTML: true, checkSetHTML: false },
|
|
44
|
+
],
|
|
44
45
|
'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
|
|
45
|
-
'unicorn/prefer-https': '
|
|
46
|
+
'unicorn/prefer-https': 'error',
|
|
46
47
|
'unicorn/prefer-import-meta-properties': 'warn',
|
|
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
|
|
52
51
|
'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
|
|
53
52
|
'unicorn/prefer-uint8array-hex': 'warn',
|
|
54
53
|
'unicorn/relative-url-style': ['error', 'always'],
|
|
@@ -56,12 +55,22 @@ export const unicorn = (config = []) =>
|
|
|
56
55
|
},
|
|
57
56
|
},
|
|
58
57
|
{ files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
|
|
58
|
+
{
|
|
59
|
+
// В конфигах `null` часто является допустимым значением.
|
|
60
|
+
files: ['**/*.config.{js,cjs,mjs,ts,mts,cts}'],
|
|
61
|
+
rules: { 'unicorn/no-null': 'off' },
|
|
62
|
+
},
|
|
59
63
|
{ files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
|
|
60
64
|
{
|
|
61
|
-
// `null` - часть контракта типов в Vue.js
|
|
65
|
+
// `null` - часть контракта типов в Vue.js:
|
|
62
66
|
// `ref<Type | null>(null)` - идиоматичный способ объявить изначально
|
|
63
|
-
// пустое реактивное значение.
|
|
64
|
-
|
|
67
|
+
// пустое реактивное значение. Композаблы и сторы тоже пишутся на TS,
|
|
68
|
+
// поэтому исключение распространяется и на них.
|
|
69
|
+
files: [
|
|
70
|
+
...VUE_FILES,
|
|
71
|
+
'**/composables/**/*.{ts,tsx}',
|
|
72
|
+
'**/stores/**/*.{ts,tsx}',
|
|
73
|
+
],
|
|
65
74
|
rules: {
|
|
66
75
|
'unicorn/no-null': 'off',
|
|
67
76
|
'unicorn/no-useless-undefined': 'off',
|
|
@@ -69,20 +78,16 @@ export const unicorn = (config = []) =>
|
|
|
69
78
|
},
|
|
70
79
|
{
|
|
71
80
|
files: [
|
|
72
|
-
|
|
81
|
+
...TEST_FILES,
|
|
82
|
+
'**/*.{api,endpoints,fixtures,schemas,service}.{js,ts}',
|
|
73
83
|
],
|
|
74
84
|
rules: {
|
|
75
85
|
'unicorn/max-nested-calls': 'off',
|
|
76
|
-
'unicorn/no-keyword-prefix': 'off',
|
|
77
86
|
'unicorn/no-null': 'off',
|
|
78
87
|
'unicorn/no-object-as-default-parameter': 'off',
|
|
79
88
|
'unicorn/no-useless-undefined': 'off',
|
|
80
89
|
},
|
|
81
90
|
},
|
|
82
|
-
{
|
|
83
|
-
files: ['**/temp/**/*.vue'],
|
|
84
|
-
rules: { 'unicorn/name-replacements': 'off' },
|
|
85
|
-
},
|
|
86
91
|
|
|
87
92
|
config,
|
|
88
93
|
]);
|