@alexlit/config-eslint 161.4.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 +156 -106
- package/base.js +5 -3
- package/index.d.ts +112 -0
- package/index.js +79 -23
- package/package.json +19 -16
- package/plugins/de-morgan.js +9 -4
- package/plugins/import-x.js +50 -37
- package/plugins/javascript.js +96 -85
- package/plugins/jsdoc.js +24 -17
- package/plugins/json.js +31 -24
- package/plugins/perfectionist.js +108 -95
- package/plugins/pinia.js +17 -10
- package/plugins/prettier.js +24 -10
- package/plugins/regexp.js +16 -9
- package/plugins/sonar.js +19 -12
- package/plugins/stylistic.js +107 -100
- package/plugins/tailwindcss.js +17 -6
- package/plugins/tanstack-query.js +16 -9
- package/plugins/typescript-type-checked.js +38 -33
- package/plugins/typescript.js +23 -14
- package/plugins/unicorn.js +73 -64
- package/plugins/unocss.js +12 -5
- package/plugins/vitest.js +20 -13
- package/plugins/vue-accessibility.js +22 -13
- package/plugins/vue-i18n.js +38 -31
- package/plugins/vue.js +255 -242
- package/plugins/zod.js +17 -10
- package/rules/typescript.js +1 -1
package/plugins/unicorn.js
CHANGED
|
@@ -3,70 +3,79 @@ import { defineConfig } from 'eslint/config';
|
|
|
3
3
|
|
|
4
4
|
import { DTS_FILES, FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила unicorn.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
12
|
+
*/
|
|
13
|
+
export const unicorn = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
{ ...plugin.configs.recommended, files: FILES },
|
|
16
|
+
{
|
|
17
|
+
files: FILES,
|
|
18
|
+
rules: {
|
|
19
|
+
'unicorn/comment-content': ['warn'],
|
|
20
|
+
'unicorn/consistent-function-scoping': [
|
|
21
|
+
'error',
|
|
22
|
+
{ checkArrowFunctions: false },
|
|
23
|
+
],
|
|
24
|
+
'unicorn/consistent-function-style': [
|
|
25
|
+
'error',
|
|
26
|
+
{ default: 'arrow-function' },
|
|
27
|
+
],
|
|
28
|
+
// Explicit: the default happens to be kebab case, but the intent is
|
|
29
|
+
// worth pinning down. Applies to `.vue` components too, which is why
|
|
30
|
+
// `vue/match-component-file-name` is kept in sync with it in `vue.js`.
|
|
31
|
+
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
32
|
+
'unicorn/iteration-fallback-style': ['error', 'guard'],
|
|
33
|
+
'unicorn/name-replacements': 'off',
|
|
34
|
+
'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
|
|
35
|
+
'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
|
|
36
|
+
'unicorn/no-empty-file': 'off',
|
|
37
|
+
'unicorn/no-for-each': 'off',
|
|
38
|
+
'unicorn/no-this-outside-of-class': 'off', // used in setters/getters
|
|
39
|
+
'unicorn/no-top-level-side-effects': 'off', // Vue.js specific
|
|
40
|
+
'unicorn/no-unused-properties': 'off', // don't respect local keys
|
|
41
|
+
'unicorn/prefer-dom-node-html-methods': 'off', // Safari not supports setHTML()
|
|
42
|
+
'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
|
|
43
|
+
'unicorn/prefer-https': 'off', // SVG need HTTP
|
|
44
|
+
'unicorn/prefer-import-meta-properties': 'warn',
|
|
45
|
+
'unicorn/prefer-iterator-concat': 'off', // ES2026 only
|
|
46
|
+
'unicorn/prefer-json-import': 'warn',
|
|
47
|
+
'unicorn/prefer-module': 'warn',
|
|
48
|
+
'unicorn/prefer-node-protocol': 'warn',
|
|
49
|
+
'unicorn/prefer-temporal': 'off', // ES2026 only
|
|
50
|
+
'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
|
|
51
|
+
'unicorn/prefer-uint8array-hex': 'warn',
|
|
52
|
+
'unicorn/relative-url-style': ['error', 'always'],
|
|
53
|
+
'unicorn/single-line-block-comment-style': 'off',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{ files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
|
|
57
|
+
{ files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
|
|
58
|
+
{
|
|
59
|
+
// `null` is part of the type contract in Vue.js SFC:
|
|
60
|
+
// `ref<Type | null>(null)` is the idiomatic way to declare an initially
|
|
61
|
+
// empty reactive value. Everywhere else `null` remains an error.
|
|
62
|
+
files: VUE_FILES,
|
|
63
|
+
rules: { 'unicorn/no-null': 'off' },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
files: [
|
|
67
|
+
'**/*.{api,endpoints,fixtures,schemas,service,spec,test}.{js,ts}',
|
|
20
68
|
],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
|
|
29
|
-
'unicorn/no-empty-file': 'off',
|
|
30
|
-
'unicorn/no-for-each': 'off',
|
|
31
|
-
'unicorn/no-this-outside-of-class': 'off', // used in setters/getters
|
|
32
|
-
'unicorn/no-top-level-side-effects': 'off', // Vue.js specific
|
|
33
|
-
'unicorn/no-unused-properties': 'off', // don't respect local keys
|
|
34
|
-
'unicorn/prefer-dom-node-html-methods': 'off', // Safari not supports setHTML()
|
|
35
|
-
'unicorn/prefer-export-from': ['error', { checkUsedVariables: true }],
|
|
36
|
-
'unicorn/prefer-https': 'off', // SVG need HTTP
|
|
37
|
-
'unicorn/prefer-import-meta-properties': 'warn',
|
|
38
|
-
'unicorn/prefer-iterator-concat': 'off', // ES2026 only
|
|
39
|
-
'unicorn/prefer-json-import': 'warn',
|
|
40
|
-
'unicorn/prefer-module': 'warn',
|
|
41
|
-
'unicorn/prefer-node-protocol': 'warn',
|
|
42
|
-
'unicorn/prefer-temporal': 'off', // ES2026 only
|
|
43
|
-
'unicorn/prefer-type-literal-last': 'off', // perfectionist/sort-intersection-types
|
|
44
|
-
'unicorn/prefer-uint8array-hex': 'warn',
|
|
45
|
-
'unicorn/relative-url-style': ['error', 'always'],
|
|
46
|
-
'unicorn/single-line-block-comment-style': 'off',
|
|
69
|
+
rules: {
|
|
70
|
+
'unicorn/max-nested-calls': 'off',
|
|
71
|
+
'unicorn/no-keyword-prefix': 'off',
|
|
72
|
+
'unicorn/no-null': 'off',
|
|
73
|
+
'unicorn/no-object-as-default-parameter': 'off',
|
|
74
|
+
'unicorn/no-useless-undefined': 'off',
|
|
75
|
+
},
|
|
47
76
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
// `null` is part of the type contract in Vue.js SFC:
|
|
53
|
-
// `ref<Type | null>(null)` is the idiomatic way to declare an initially
|
|
54
|
-
// empty reactive value. Everywhere else `null` remains an error.
|
|
55
|
-
files: VUE_FILES,
|
|
56
|
-
rules: { 'unicorn/no-null': 'off' },
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
files: ['**/*.{api,endpoints,fixtures,schemas,service,spec,test}.{js,ts}'],
|
|
60
|
-
rules: {
|
|
61
|
-
'unicorn/max-nested-calls': 'off',
|
|
62
|
-
'unicorn/no-keyword-prefix': 'off',
|
|
63
|
-
'unicorn/no-null': 'off',
|
|
64
|
-
'unicorn/no-object-as-default-parameter': 'off',
|
|
65
|
-
'unicorn/no-useless-undefined': 'off',
|
|
77
|
+
{
|
|
78
|
+
files: ['**/temp/**/*.vue'],
|
|
79
|
+
rules: { 'unicorn/name-replacements': 'off' },
|
|
66
80
|
},
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
files: ['**/temp/**/*.vue'],
|
|
70
|
-
rules: { 'unicorn/name-replacements': 'off' },
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
81
|
+
]);
|
package/plugins/unocss.js
CHANGED
|
@@ -3,8 +3,15 @@ import { defineConfig } from 'eslint/config';
|
|
|
3
3
|
|
|
4
4
|
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила для UnoCSS.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint)
|
|
12
|
+
*/
|
|
13
|
+
export const unocss = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
{ files: FILES, ...plugin },
|
|
16
|
+
{ files: FILES, rules: { 'unocss/order-attributify': 'off' } },
|
|
17
|
+
]);
|
package/plugins/vitest.js
CHANGED
|
@@ -3,18 +3,25 @@ import { defineConfig } from 'eslint/config';
|
|
|
3
3
|
|
|
4
4
|
import { TEST_FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила для тестов Vitest.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
|
|
12
|
+
*/
|
|
13
|
+
export const vitest = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
{
|
|
16
|
+
files: TEST_FILES,
|
|
17
|
+
plugins: { vitest: plugin },
|
|
18
|
+
rules: {
|
|
19
|
+
...plugin.configs.recommended.rules,
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
'vitest/no-conditional-in-test': 'off',
|
|
22
|
+
'vitest/no-conditional-tests': 'off',
|
|
23
|
+
'vitest/no-hooks': 'off',
|
|
24
|
+
'vitest/require-to-throw-message': 'off',
|
|
25
|
+
},
|
|
18
26
|
},
|
|
19
|
-
|
|
20
|
-
]);
|
|
27
|
+
]);
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import plugin from 'eslint-plugin-vuejs-accessibility';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const vueAccessibility = defineConfig([
|
|
6
|
-
...plugin.configs['flat/recommended'],
|
|
4
|
+
import { VUE_FILES } from '../base.js';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила доступности Vue.js-компонентов.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/)
|
|
12
|
+
*/
|
|
13
|
+
export const vueAccessibility = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
...plugin.configs['flat/recommended'],
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
files: VUE_FILES,
|
|
19
|
+
rules: {
|
|
20
|
+
'vuejs-accessibility/label-has-for': [
|
|
21
|
+
'warn',
|
|
22
|
+
{ allowChildren: true, required: { some: ['nesting', 'id'] } },
|
|
23
|
+
],
|
|
24
|
+
'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
|
|
25
|
+
},
|
|
16
26
|
},
|
|
17
|
-
|
|
18
|
-
]);
|
|
27
|
+
]);
|
package/plugins/vue-i18n.js
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
import plugin from '@intlify/eslint-plugin-vue-i18n';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
|
-
import { DATA_FILES } from '../base.js';
|
|
4
|
+
import { DATA_FILES, VUE_FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила для Vue.js I18n.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/)
|
|
12
|
+
*/
|
|
13
|
+
export const vueI18n = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
...plugin.configs['flat/recommended'].map((config) => ({
|
|
16
|
+
...config,
|
|
17
|
+
ignores: [...(config.ignores ?? []), ...DATA_FILES],
|
|
18
|
+
})),
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
{
|
|
21
|
+
files: VUE_FILES,
|
|
22
|
+
rules: {
|
|
23
|
+
'@intlify/vue-i18n/key-format-style': [
|
|
24
|
+
'error',
|
|
25
|
+
'snake_case',
|
|
26
|
+
{ allowArray: false },
|
|
27
|
+
],
|
|
28
|
+
'@intlify/vue-i18n/no-duplicate-keys-in-locale': [
|
|
29
|
+
'error',
|
|
30
|
+
{ ignoreI18nBlock: false },
|
|
31
|
+
],
|
|
32
|
+
'@intlify/vue-i18n/no-dynamic-keys': 'warn',
|
|
33
|
+
'@intlify/vue-i18n/no-raw-text': 'off',
|
|
34
|
+
'@intlify/vue-i18n/no-unused-keys': 'warn',
|
|
35
|
+
'@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
|
|
36
|
+
},
|
|
29
37
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
{
|
|
39
|
+
settings: {
|
|
40
|
+
'vue-i18n': {
|
|
41
|
+
localeDir: './**/locales/*.{json,json5,yaml,yml}',
|
|
42
|
+
messageSyntaxVersion: '^9.0.0',
|
|
43
|
+
},
|
|
36
44
|
},
|
|
37
45
|
},
|
|
38
|
-
|
|
39
|
-
]);
|
|
46
|
+
]);
|