@alexlit/lint-kit 202.0.0 → 203.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/lint-kit",
3
- "version": "202.0.0",
3
+ "version": "203.1.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.0.1
5
+
6
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@154.0.0...v154.0.1)
7
+
8
+ ## v154.0.0
9
+
10
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.5.0...v154.0.0)
11
+
12
+ ## v153.5.0
13
+
14
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.4.0...v153.5.0)
15
+
16
+ ### 🏡 Chore
17
+
18
+ - **@alexlit/lint-kit:** Bump version ([361cb371](https://github.com/alex-lit/lint-kit/commit/361cb371))
19
+
20
+ ### ❤️ Contributors
21
+
22
+ - Alexey Litovchenko ([@alex-lit](https://github.com/alex-lit))
23
+
24
+ ## v153.4.0
25
+
26
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.3.0...v153.4.0)
27
+
28
+ ### 🏡 Chore
29
+
30
+ - **@alexlit/lint-kit:** Bump version ([85b0b3a2](https://github.com/alex-lit/lint-kit/commit/85b0b3a2))
31
+ - **@alexlit/config-hooks:** Bump version ([d1e01056](https://github.com/alex-lit/lint-kit/commit/d1e01056))
32
+
33
+ ### ❤️ Contributors
34
+
35
+ - Alexey Litovchenko ([@alex-lit](https://github.com/alex-lit))
36
+
4
37
  ## v153.3.0
5
38
 
6
39
  [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/config-eslint@153.2.1...v153.3.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.3.0",
3
+ "version": "154.0.1",
4
4
  "private": false,
5
5
  "description": "Sharable ESLint configuration",
6
6
  "keywords": [
@@ -45,17 +45,18 @@
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-jsdoc": "^64.2.0",
52
+ "eslint-plugin-de-morgan": "^2.1.3",
53
+ "eslint-plugin-jsdoc": "^64.2.1",
53
54
  "eslint-plugin-perfectionist": "^5.10.1",
54
55
  "eslint-plugin-pinia": "^0.4.2",
55
56
  "eslint-plugin-prettier": "^5.5.6",
56
57
  "eslint-plugin-regexp": "^3.2.0",
57
58
  "eslint-plugin-sonarjs": "^4.2.0",
58
- "eslint-plugin-tailwindcss": "^4.2.0",
59
+ "eslint-plugin-tailwindcss": "^4.3.0",
59
60
  "eslint-plugin-unicorn": "^73.0.0",
60
61
  "eslint-plugin-vue": "^10.10.0",
61
62
  "eslint-plugin-vuejs-accessibility": "^2.6.0",
@@ -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]);
@@ -5,14 +5,93 @@ import { FILES } from '../presets/base.js';
5
5
 
6
6
  /** @see [eslint-plugin-perfectionist](https://perfectionist.dev) */
7
7
  export const perfectionist = defineConfig([
8
- { files: FILES, ...plugin.configs['recommended-natural'] },
8
+ { ...plugin.configs['recommended-natural'], files: FILES },
9
9
  {
10
10
  files: FILES,
11
11
  rules: {
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
+ ## v7.0.0
5
+
6
+ [compare changes](https://github.com/alex-lit/lint-kit/compare/@alexlit/lint-kit@202.0.0...v7.0.0)
7
+
@@ -16,9 +16,7 @@ npm i @alexlit/config-hooks -D
16
16
 
17
17
  export default createLintStagedConfig(
18
18
  // optional plugins list
19
- {
20
- stylelint: false,
21
- },
19
+ { stylelint: false },
22
20
 
23
21
  // optional config
24
22
  {
@@ -28,11 +26,57 @@ npm i @alexlit/config-hooks -D
28
26
  );
29
27
  ```
30
28
 
29
+ # Runner examples
30
+
31
+ - simple-git-hooks
32
+
33
+ ```json
34
+ // package.json
35
+ {
36
+ "scripts": { "prepare": "simple-git-hooks" },
37
+ "simple-git-hooks": {
38
+ "commit-msg": "npx commitlint --edit",
39
+ "pre-commit": "npx lint-staged"
40
+ }
41
+ }
42
+ ```
43
+
44
+ ```sh
45
+ npx simple-git-hooks
46
+ ```
47
+
31
48
  - husky
32
49
 
50
+ ```json
51
+ // package.json
52
+ { "scripts": { "prepare": "husky" } }
53
+ ```
54
+
33
55
  ```sh
34
56
  npx husky init
35
57
 
36
58
  echo 'npx --no -- commitlint --edit "$1"' > .husky/commit-msg
37
59
  echo 'npx --no lint-staged' > .husky/pre-commit
38
60
  ```
61
+
62
+ - git (native)
63
+
64
+ ```json
65
+ { "scripts": { "prepare": "git config core.hooksPath .githooks" } }
66
+ ```
67
+
68
+ ```sh
69
+ # 1. Создаем нативную папку и привязываем её к Git
70
+ mkdir -p .githooks && git config core.hooksPath .githooks
71
+
72
+ # 2. Создаем хук pre-commit
73
+ echo '#!/bin/sh' > .githooks/pre-commit
74
+ echo 'npx --no -- lint-staged' >> .githooks/pre-commit
75
+
76
+ # 3. Создаем хук commit-msg
77
+ echo '#!/bin/sh' > .githooks/commit-msg
78
+ echo 'npx --no -- commitlint --edit "$1"' >> .githooks/commit-msg
79
+
80
+ # 4. Делаем файлы исполняемыми
81
+ chmod +x .githooks/pre-commit .githooks/commit-msg
82
+ ```
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-hooks",
3
- "version": "6.3.0",
3
+ "version": "7.0.0",
4
4
  "private": false,
5
5
  "description": "Hooks config",
6
6
  "keywords": [
@@ -37,7 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "husky": "^9.1.7",
40
- "lint-staged": "^17.3.0"
40
+ "lint-staged": "^17.3.0",
41
+ "simple-git-hooks": "^2.13.1"
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public",
@@ -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",