@alexlit/lint-kit 203.0.0 → 203.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/lint-kit",
3
- "version": "203.0.0",
3
+ "version": "203.2.0",
4
4
  "private": false,
5
5
  "description": "Preset of configuration files and dependencies for linting web applications (designed for Vue.js with TypeScript)",
6
6
  "keywords": [
@@ -1,6 +1,39 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v154.1.0
5
+
6
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@154.0.1...v154.1.0)
7
+
8
+ ### 🏡 Chore
9
+
10
+ - **@alexlit/config-stylelint:** Bump version ([a138a873](https://github.com/alex-lit/lint-kit/commit/a138a873))
11
+ - **@alexlit/lint-kit:** Bump version ([e2db912e](https://github.com/alex-lit/lint-kit/commit/e2db912e))
12
+
13
+ ### ❤️ Contributors
14
+
15
+ - Alexey Litovchenko ([@alex-lit](https://github.com/alex-lit))
16
+
17
+ ## v154.0.1
18
+
19
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@154.0.0...v154.0.1)
20
+
21
+ ## v154.0.0
22
+
23
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.5.0...v154.0.0)
24
+
25
+ ## v153.5.0
26
+
27
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.4.0...v153.5.0)
28
+
29
+ ### 🏡 Chore
30
+
31
+ - **@alexlit/lint-kit:** Bump version ([361cb371](https://github.com/alex-lit/lint-kit/commit/361cb371))
32
+
33
+ ### ❤️ Contributors
34
+
35
+ - Alexey Litovchenko ([@alex-lit](https://github.com/alex-lit))
36
+
4
37
  ## v153.4.0
5
38
 
6
39
  [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.3.0...v153.4.0)
@@ -1,3 +1,4 @@
1
+ export { deMorgan } from './plugins/de-morgan.js';
1
2
  export { javascript } from './plugins/javascript.js';
2
3
  export { jsdoc } from './plugins/jsdoc.js';
3
4
  export { json } from './plugins/json.js';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-eslint",
3
- "version": "153.4.0",
3
+ "version": "154.1.0",
4
4
  "private": false,
5
5
  "description": "Sharable ESLint configuration",
6
6
  "keywords": [
@@ -45,10 +45,11 @@
45
45
  "@intlify/eslint-plugin-vue-i18n": "^4.5.1",
46
46
  "@stylistic/eslint-plugin": "^5.10.0",
47
47
  "@tanstack/eslint-plugin-query": "^5.101.4",
48
- "@unocss/eslint-config": "^66.7.5",
48
+ "@unocss/eslint-config": "^66.8.0",
49
49
  "@vitest/eslint-plugin": "^1.6.27",
50
50
  "eslint": "^10.8.1",
51
51
  "eslint-config-prettier": "^10.1.8",
52
+ "eslint-plugin-de-morgan": "^2.1.3",
52
53
  "eslint-plugin-jsdoc": "^64.2.1",
53
54
  "eslint-plugin-perfectionist": "^5.10.1",
54
55
  "eslint-plugin-pinia": "^0.4.2",
@@ -0,0 +1,5 @@
1
+ import plugin from 'eslint-plugin-de-morgan';
2
+ import { defineConfig } from 'eslint/config';
3
+
4
+ /** @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan) */
5
+ export const deMorgan = defineConfig([plugin.configs.recommended]);
@@ -20,20 +20,41 @@ export const javascript = defineConfig([
20
20
  'no-restricted-exports': [
21
21
  'error',
22
22
  {
23
- restrictedNamedExports: [
24
- 'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
25
- ],
23
+ restrictedNamedExports: ['then'],
24
+ restrictedNamedExportsPattern: '^_',
26
25
  },
27
26
  ],
28
27
  'no-restricted-imports': [
29
28
  'error',
30
29
  {
31
30
  patterns: [
31
+ // Алиасы
32
+ { group: ['~/', '~~/'], message: 'Используйте "@" вместо "~".' },
33
+ // Расширения
34
+ {
35
+ message: 'Не указывайте расширения .ts или .js в путях импорта.',
36
+ regex: String.raw`\.[jt]sx?$`,
37
+ },
38
+ // Относительные импорты
39
+ { group: ['..', '*/..'], message: 'Используйте абсолютный путь.' },
40
+ {
41
+ message: 'Не используйте индексный импорт.',
42
+ regex: String.raw`^\.$`,
43
+ },
44
+ {
45
+ group: ['**/index'],
46
+ message: 'Не используйте индексный импорт.',
47
+ },
48
+ // Внешние локальные ресурсы
49
+ {
50
+ group: ['@/**/_*', '@@/**/_*', '~/**/_*', '~~/**/_*'],
51
+ message: 'Этот локальный ресурс не преднаназначен для импорта.',
52
+ },
53
+ // Устаревший функционал
32
54
  {
33
- group: ['.', '..', '*/..'],
34
- message: 'Use absolute path instead',
55
+ message: 'Это функционал устарел.',
56
+ regex: '(_deprecated|_legacy)',
35
57
  },
36
- { group: ['@/', '@@/'], message: 'Use "~" instead of "@"' },
37
58
  ],
38
59
  },
39
60
  ],
@@ -12,7 +12,86 @@ export const perfectionist = defineConfig([
12
12
  'perfectionist/sort-imports': [
13
13
  'warn',
14
14
  {
15
- internalPattern: ['^#.*', '^~/.*', '^~~/.*', '^@/.*', '^@@/.*'],
15
+ customGroups: [
16
+ // nuxt
17
+ { elementNamePattern: ['^#app*'], groupName: 'app' },
18
+ { elementNamePattern: ['^#components*'], groupName: 'components' },
19
+ { elementNamePattern: ['^#imports*'], groupName: 'imports' },
20
+ { elementNamePattern: ['^#layers*'], groupName: 'layers' },
21
+ { elementNamePattern: ['^#server*'], groupName: 'server' },
22
+ { elementNamePattern: ['^#shared*'], groupName: 'shared' },
23
+
24
+ // universal
25
+ { elementNamePattern: ['^~/.*/api'], groupName: 'universal-api' },
26
+ {
27
+ elementNamePattern: ['^~/.*/assets'],
28
+ groupName: 'universal-assets',
29
+ },
30
+ {
31
+ elementNamePattern: ['^~/.*/components'],
32
+ groupName: 'universal-components',
33
+ },
34
+ {
35
+ elementNamePattern: ['^~/.*/composables'],
36
+ groupName: 'universal-composables',
37
+ },
38
+ {
39
+ elementNamePattern: ['^~/.*/constants'],
40
+ groupName: 'universal-constants',
41
+ },
42
+ {
43
+ elementNamePattern: ['^~/.*/directives'],
44
+ groupName: 'universal-directives',
45
+ },
46
+ {
47
+ elementNamePattern: ['^~/.*/pages'],
48
+ groupName: 'universal-pages',
49
+ },
50
+ {
51
+ elementNamePattern: ['^~/.*/plugins'],
52
+ groupName: 'universal-plugins',
53
+ },
54
+ {
55
+ elementNamePattern: ['^~/.*/stores'],
56
+ groupName: 'universal-stores',
57
+ },
58
+ {
59
+ elementNamePattern: ['^~/.*/utils'],
60
+ groupName: 'universal-utils',
61
+ },
62
+ ],
63
+ groups: [
64
+ 'type-import',
65
+ ['value-builtin', 'value-external'],
66
+
67
+ // nuxt
68
+ 'app',
69
+ 'components',
70
+ 'imports',
71
+ 'layers',
72
+ 'server',
73
+ 'shared',
74
+
75
+ // universal
76
+ 'universal-api',
77
+ 'universal-assets',
78
+ 'universal-components',
79
+ 'universal-composables',
80
+ 'universal-constants',
81
+ 'universal-directives',
82
+ 'universal-pages',
83
+ 'universal-plugins',
84
+ 'universal-stores',
85
+ 'universal-utils',
86
+
87
+ 'type-internal',
88
+ 'value-internal',
89
+ ['type-parent', 'type-sibling', 'type-index'],
90
+ ['value-parent', 'value-sibling', 'value-index'],
91
+ 'ts-equals-import',
92
+ 'unknown',
93
+ ],
94
+ internalPattern: ['^~/.*', '^~~/.*', '^@/.*', '^@@/.*'],
16
95
  type: 'natural',
17
96
  },
18
97
  ],
@@ -18,12 +18,12 @@ const fixes = {
18
18
 
19
19
  /** @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) */
20
20
  export const prettier = defineConfig([
21
- { files: FILES, ...plugin },
21
+ { files: FILES, ...plugin, rules: { ...plugin.rules, curly: 'error' } },
22
22
  { files: ['**/*.vue'], rules: { ...fixes } },
23
23
  ]);
24
24
 
25
25
  /** @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) */
26
26
  export const prettierConfig = defineConfig([
27
- { files: FILES, ...config },
27
+ { files: FILES, ...config, rules: { ...config.rules, curly: 'error' } },
28
28
  { files: ['**/*.vue'], rules: { ...fixes } },
29
29
  ]);
@@ -14,7 +14,6 @@ export const typescript = defineConfig([
14
14
  rules: {
15
15
  '@typescript-eslint/naming-convention': [
16
16
  'error',
17
-
18
17
  {
19
18
  format: ['strictCamelCase'],
20
19
  leadingUnderscore: 'allow',
@@ -42,15 +41,6 @@ export const typescript = defineConfig([
42
41
  '@typescript-eslint/no-explicit-any': 'warn',
43
42
  },
44
43
  },
45
- {
46
- files: ['**/*.vue'],
47
- rules: {
48
- '@typescript-eslint/no-empty-object-type': [
49
- 'error',
50
- { allowWithName: 'Props$' },
51
- ],
52
- },
53
- },
54
44
  {
55
45
  files: ['**/*.{fixtures,test,spec}.{js,ts}'],
56
46
  rules: { '@typescript-eslint/no-empty-function': 'off' },
@@ -18,8 +18,26 @@ export const vue = defineConfig([
18
18
  files: ['**/*.vue'],
19
19
  languageOptions: { parserOptions: { parser: typescript.parser } },
20
20
  rules: {
21
+ '@typescript-eslint/naming-convention': [
22
+ 'error',
23
+ {
24
+ custom: { match: true, regex: '^[A-Z][a-zA-Z0-9]+Props$' },
25
+ format: ['PascalCase'],
26
+ selector: 'interface',
27
+ },
28
+ ],
29
+ '@typescript-eslint/no-empty-object-type': [
30
+ 'error',
31
+ { allowWithName: 'Props$' },
32
+ ],
21
33
  'no-restricted-syntax': [
22
34
  'error',
35
+ {
36
+ message:
37
+ 'Запрещено использовать имя "Props". Используйте именованный формат, например: <ИмяКомпонента>Props.',
38
+ selector:
39
+ "TSInterfaceDeclaration[id.name='Props'], TSTypeAliasDeclaration[id.name='Props']",
40
+ },
23
41
  {
24
42
  message:
25
43
  'При вызове useRoute() переменная должна называться строго "$route" (const $route = useRoute()).',
@@ -1,5 +1,6 @@
1
1
  import { defineConfig } from 'eslint/config';
2
2
 
3
+ import { deMorgan } from '../plugins/de-morgan.js';
3
4
  import { javascript } from '../plugins/javascript.js';
4
5
  import { jsdoc } from '../plugins/jsdoc.js';
5
6
  import { json } from '../plugins/json.js';
@@ -19,6 +20,7 @@ export const defaultPreset = defineConfig([
19
20
  ...base, // must be first
20
21
 
21
22
  ...javascript,
23
+ ...deMorgan,
22
24
  ...jsdoc,
23
25
  ...json,
24
26
  ...perfectionist,
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+
4
+ ## v61.0.3
5
+
6
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@154.0.1...v61.0.3)
7
+
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-stylelint",
3
- "version": "61.0.2",
3
+ "version": "61.0.3",
4
4
  "private": false,
5
5
  "description": "Stylelint config",
6
6
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "up": "../../scripts/up.sh"
38
38
  },
39
39
  "dependencies": {
40
- "@double-great/stylelint-a11y": "^3.5.1",
40
+ "@double-great/stylelint-a11y": "^3.5.2",
41
41
  "@morev/stylelint-plugin": "^0.6.1",
42
42
  "postcss": "^8.5.26",
43
43
  "postcss-html": "^2.0.0",