@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.
@@ -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
- /** @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) */
7
- export const unicorn = defineConfig([
8
- { ...plugin.configs.recommended, files: FILES },
9
- {
10
- files: FILES,
11
- rules: {
12
- 'unicorn/comment-content': ['warn'],
13
- 'unicorn/consistent-function-scoping': [
14
- 'error',
15
- { checkArrowFunctions: false },
16
- ],
17
- 'unicorn/consistent-function-style': [
18
- 'error',
19
- { default: 'arrow-function' },
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
- // Explicit: the default happens to be kebab case, but the intent is
22
- // worth pinning down. Applies to `.vue` components too, which is why
23
- // `vue/match-component-file-name` is kept in sync with it in `vue.js`.
24
- 'unicorn/filename-case': ['error', { case: 'kebabCase' }],
25
- 'unicorn/iteration-fallback-style': ['error', 'guard'],
26
- 'unicorn/name-replacements': 'off',
27
- 'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
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
- { files: ['**/.*'], rules: { 'unicorn/no-null': 'off' } },
50
- { files: DTS_FILES, rules: { 'unicorn/prefer-export-from': 'off' } },
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
- /** @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint) */
7
- export const unocss = defineConfig([
8
- { files: FILES, ...plugin },
9
- { files: FILES, rules: { 'unocss/order-attributify': 'off' } },
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
- /** @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) */
7
- export const vitest = defineConfig([
8
- {
9
- files: TEST_FILES,
10
- plugins: { vitest: plugin },
11
- rules: {
12
- ...plugin.configs.recommended.rules,
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
- 'vitest/no-conditional-in-test': 'off',
15
- 'vitest/no-conditional-tests': 'off',
16
- 'vitest/no-hooks': 'off',
17
- 'vitest/require-to-throw-message': 'off',
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
- /** @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/) */
5
- export const vueAccessibility = defineConfig([
6
- ...plugin.configs['flat/recommended'],
4
+ import { VUE_FILES } from '../base.js';
7
5
 
8
- {
9
- files: ['**/*.vue'],
10
- rules: {
11
- 'vuejs-accessibility/label-has-for': [
12
- 'warn',
13
- { allowChildren: true, required: { some: ['nesting', 'id'] } },
14
- ],
15
- 'vuejs-accessibility/no-autofocus': ['warn', { ignoreNonDOM: true }],
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
+ ]);
@@ -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
- /** @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/) */
7
- export const vueI18n = defineConfig([
8
- ...plugin.configs['flat/recommended'].map((config) => ({
9
- ...config,
10
- ignores: [...(config.ignores ?? []), ...DATA_FILES],
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
- files: ['**/*.vue'],
15
- rules: {
16
- '@intlify/vue-i18n/key-format-style': [
17
- 'error',
18
- 'snake_case',
19
- { allowArray: false },
20
- ],
21
- '@intlify/vue-i18n/no-duplicate-keys-in-locale': [
22
- 'error',
23
- { ignoreI18nBlock: false },
24
- ],
25
- '@intlify/vue-i18n/no-dynamic-keys': 'warn',
26
- '@intlify/vue-i18n/no-raw-text': 'off',
27
- '@intlify/vue-i18n/no-unused-keys': 'warn',
28
- '@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
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
- settings: {
33
- 'vue-i18n': {
34
- localeDir: './**/locales/*.{json,json5,yaml,yml}',
35
- messageSyntaxVersion: '^9.0.0',
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
+ ]);