arui-presets-lint 9.4.0 → 9.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 9.5.0
2
+
3
+ ### Minor Changes
4
+
5
+ - [#118](https://github.com/core-ds/arui-presets-lint/pull/118) [`1057d60`](https://github.com/core-ds/arui-presets-lint/commit/1057d601f36fb1f06f70741f0f15b49aa1ed3c98) Thanks [@kiskv](https://github.com/kiskv)! - Библиотека перенесена в монорепозиторий, подняты зависимости. Конфиги prettier, stylelint и commitlint переведены на typescript
6
+
7
+ ### Patch Changes
8
+
9
+ - Updated dependencies [[`1057d60`](https://github.com/core-ds/arui-presets-lint/commit/1057d601f36fb1f06f70741f0f15b49aa1ed3c98)]:
10
+ - @alfalab/stylelint-core-vars@2.1.0
11
+
12
+ ## 9.4.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#116](https://github.com/core-ds/arui-presets-lint/pull/116) [`2ecbecb`](https://github.com/core-ds/arui-presets-lint/commit/2ecbecb0102403674642d7f39aa027ba99d65895) Thanks [@KalashnikovTV](https://github.com/KalashnikovTV)! - - Добавлены тесты для кастомного правила require-description
17
+
1
18
  ## 9.4.0
2
19
 
3
20
  ### Minor Changes
package/README.md CHANGED
@@ -234,29 +234,3 @@ npx --no-install commitlint --print-config > commitlintconfig.txt
234
234
  3. Включить Prettier
235
235
  - [Расширение для VS Code](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
236
236
  - [Инструкция для Webstorm](https://prettier.io/docs/en/webstorm.html)
237
-
238
- ## Лицензия
239
-
240
- ```
241
- The MIT License (MIT)
242
-
243
- Copyright (c) 2026 core-ds contributors
244
-
245
- Permission is hereby granted, free of charge, to any person obtaining a copy
246
- of this software and associated documentation files (the "Software"), to deal
247
- in the Software without restriction, including without limitation the rights
248
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
- copies of the Software, and to permit persons to whom the Software is
250
- furnished to do so, subject to the following conditions:
251
-
252
- The above copyright notice and this permission notice shall be included in
253
- all copies or substantial portions of the Software.
254
-
255
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
261
- THE SOFTWARE.
262
- ```
@@ -0,0 +1,87 @@
1
+ # Гид по миграции на arui-presets-lint@9
2
+
3
+ ## Введение
4
+
5
+ Несмотря на большое количество изменений в этом релизе, мигрировать довольно просто - все нюансы ваших проектов скорее всего уже учтены внутри конфига. Но кое-какие правки руками сделать придется, начнем по шагам:
6
+
7
+ 0. Собственно, обновить зависимость:
8
+
9
+ ```bash
10
+ yarn add arui-presets-lint@latest
11
+ ```
12
+
13
+ 1. Удалить свойство `eslintConfig` из package.json, и создать в корне проекта файл `eslint.config.mts` со следующим содержимым:
14
+
15
+ ```typescript
16
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
17
+ import { eslintConfig } from 'arui-presets-lint/eslint';
18
+
19
+ export default defineConfig(eslintConfig);
20
+ ```
21
+
22
+ Если нужно добавить конфиги на уровне проекта, можно это сделать подобным образом:
23
+
24
+ ```typescript
25
+ import pluginCypress from 'eslint-plugin-cypress';
26
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
27
+ import { eslintConfig } from 'arui-presets-lint/eslint';
28
+
29
+ export default defineConfig(eslintConfig, [
30
+ pluginCypress.configs.recommended,
31
+ {
32
+ rules: {
33
+ 'cypress/no-unnecessary-waiting': 'off',
34
+ },
35
+ },
36
+ // Тут лежат glob-паттерны файлов, которые нужно игнорировать в проекте. Возможно он вам не понадобится, так как глобальный игнор на основные файлы и папки уже настроен на уровне arui-presets-lint
37
+ ignores: []
38
+ ]);
39
+ ```
40
+
41
+ ^^ Тут мы добавляем eslint-plugin-cypress, и определяем кастомные правила на уровне проекта. Про новый формат конфига - подробности [тут](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects)
42
+
43
+ > если нужно использовать плагины и правила, которые не поддерживают eslint 9, можно использовать для их подключения утилиты из пакета [@eslint/compat](https://www.npmjs.com/package/@eslint/compat)
44
+
45
+ 1. `tsconfig.eslint.json` и правила игнорирования
46
+
47
+ Ранее мы использовали кастомный tsconfig.eslint.json, например для того чтобы включить eslint для файлов в корневой директории - с переходом на [typescript-eslint projectService](https://typescript-eslint.io/blog/project-service/#introducing-the-project-service) он больше не нужен. Используйте основной tsconfig.json, а те файлы которые туда нельзя добавить, добавьте с помощью опции languageOptions.parserOptions.projectService.allowDefaultProject. Учтите что папки добавлять нельзя, так как это аффектит на производительность. Пример такого конфига:
48
+
49
+ ```typescript
50
+ import { eslintConfig } from 'arui-presets-lint/eslint';
51
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
52
+
53
+ export default defineConfig(eslintConfig, [
54
+ {
55
+ languageOptions: {
56
+ parserOptions: {
57
+ projectService: {
58
+ // Это позволит eslint линтить файлы, даже если они не указаны в tsconfig.json
59
+ // Обратите внимание, что включить '**' тут нельзя, влияет на производительность!
60
+ // https://typescript-eslint.io/packages/parser/#allowdefaultproject
61
+ // Конретно тут - разрешаем линтить все файлы с расширениями .ts, .mts и .cts в корневой директории проекта
62
+ allowDefaultProject: ['*.ts', '*.mts', '*.cts'],
63
+ },
64
+ },
65
+ },
66
+ files: ['**/*.{ts,tsx,mts,cts,mtsx,ctsx}'],
67
+ },
68
+ ]);
69
+ ```
70
+
71
+ Так же можно исключить этот файл через globalIgnores (не рекомендуется), подробнее в README.md
72
+
73
+ 3. import >> import-x
74
+
75
+ Нужно пробежаться по проекту и заменить подобные комментарии:
76
+ // eslint-disable-next-line import/no-default-export на
77
+ // eslint-disable-next-line import-x/no-default-export
78
+
79
+ Так же все правила в конфиге которые начинаються на `import/` нужно заменить на `import-x/`. Других изменений делать не нужно, новый плагин полностью совместим со старым.
80
+
81
+ 4. Набор правил eslint изменился - но многие правятся с помощью автофикса. Сделаем это!
82
+
83
+ ```bash
84
+ yarn lint:fix
85
+ ```
86
+
87
+ Если вы заметили что откровенно "вредное" правило попало в набор, приходите сразу с пулл реквестом в https://github.com/core-ds/arui-presets-lint . Ваш вклад поможет сделать библиотеку лучше!
@@ -1,9 +1,8 @@
1
- declare namespace _default {
2
- let _extends: string;
3
- export { _extends as extends };
4
- export let rules: {
5
- 'scope-empty': (string | number)[];
6
- 'body-max-line-length': (string | number)[];
1
+ declare const _default: {
2
+ extends: string;
3
+ rules: {
4
+ 'scope-empty': [2, "never"];
5
+ 'body-max-line-length': [2, "always", number];
7
6
  };
8
- }
7
+ };
9
8
  export default _default;
@@ -1,3 +1,4 @@
1
+ import {} from '@commitlint/types';
1
2
  export default {
2
3
  extends: '@commitlint/config-conventional',
3
4
  rules: {
package/eslint/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type Linter } from 'eslint';
2
2
  export declare const eslintConfig: Linter.Config;
3
+ export { defineConfig, globalIgnores, globals } from './config.js';
3
4
  export { type Linter } from 'eslint';
4
5
  export { type TSESLint } from '@typescript-eslint/utils';
package/eslint/index.js CHANGED
@@ -62,5 +62,6 @@ export const eslintConfig = [
62
62
  processor: 'check-file/eslint-processor-check-file',
63
63
  },
64
64
  ];
65
+ export { defineConfig, globalIgnores, globals } from './config.js';
65
66
  export {} from 'eslint';
66
67
  export {} from '@typescript-eslint/utils';
@@ -1,8 +1,8 @@
1
1
  import { type TSESTree } from '@typescript-eslint/utils';
2
2
  import { type DirectiveData, type DirectiveKind } from '../types/index.js';
3
3
  export declare class CommentValidator {
4
- private ignoredDirectives;
5
- private allComments;
4
+ private readonly ignoredDirectives;
5
+ private readonly allComments;
6
6
  constructor(ignoredDirectives: DirectiveKind[], allComments: TSESTree.Comment[]);
7
7
  private getMeaningfulAboveComment;
8
8
  validate(comment: TSESTree.Comment): {
@@ -1,3 +1,5 @@
1
1
  import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
2
+ export declare function fixSingleLineComment(fixer: TSESLint.RuleFixer, comment: TSESTree.Comment, description: string): TSESLint.RuleFix;
3
+ export declare function fixBlockComment(fixer: TSESLint.RuleFixer, comment: TSESTree.Comment, description: string): TSESLint.RuleFix | null;
2
4
  export declare function createSuggestionFix(comment: TSESTree.Comment, description: string): (fixer: TSESLint.RuleFixer) => TSESLint.RuleFix | null;
3
5
  export declare function createAboveCommentFix(comment: TSESTree.Comment, description: string): (fixer: TSESLint.RuleFixer) => TSESLint.RuleFix | null;
@@ -5,11 +5,11 @@ function formatCommentWithDescription(comment, description) {
5
5
  const baseText = commentValue.replace(DESCRIPTION_REPLACEMENT, '').trim();
6
6
  return `${baseText} -- ${description}`;
7
7
  }
8
- function fixSingleLineComment(fixer, comment, description) {
8
+ export function fixSingleLineComment(fixer, comment, description) {
9
9
  const newCommentText = formatCommentWithDescription(comment, description);
10
10
  return fixer.replaceText(comment, `// ${newCommentText}`);
11
11
  }
12
- function fixBlockComment(fixer, comment, description) {
12
+ export function fixBlockComment(fixer, comment, description) {
13
13
  const commentText = comment.value;
14
14
  const lines = commentText?.split('\n');
15
15
  if (lines.length === 1) {
@@ -1,4 +1,4 @@
1
1
  export { parseDirectiveComment, getPreviousComment, isAdjacentComment, isValidDescription, validateAboveComment, } from './comment-parser.js';
2
- export { createSuggestionFix, createAboveCommentFix } from './fixers.js';
2
+ export { createSuggestionFix, createAboveCommentFix, fixSingleLineComment, fixBlockComment, } from './fixers.js';
3
3
  export { CommentValidator } from './comment-validator.js';
4
4
  export { buildSuggestions } from './build-suggestions.js';
@@ -1,4 +1,4 @@
1
1
  export { parseDirectiveComment, getPreviousComment, isAdjacentComment, isValidDescription, validateAboveComment, } from './comment-parser.js';
2
- export { createSuggestionFix, createAboveCommentFix } from './fixers.js';
2
+ export { createSuggestionFix, createAboveCommentFix, fixSingleLineComment, fixBlockComment, } from './fixers.js';
3
3
  export { CommentValidator } from './comment-validator.js';
4
4
  export { buildSuggestions } from './build-suggestions.js';
@@ -1,4 +1,4 @@
1
- # Refer for explanation to following link:
1
+ # Описание параметров тут:
2
2
  # https://lefthook.dev/configuration/
3
3
 
4
4
  pre-commit:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-presets-lint",
3
- "version": "9.4.0",
3
+ "version": "9.5.0",
4
4
  "description": "Config files for arui-apps",
5
5
  "author": "core-ds contributors",
6
6
  "license": "MIT",
@@ -11,12 +11,12 @@
11
11
  "url": "git+https://github.com/core-ds/arui-presets-lint.git"
12
12
  },
13
13
  "dependencies": {
14
- "@alfalab/stylelint-core-vars": "2.0.0",
15
- "@commitlint/cli": "20.5.0",
16
- "@commitlint/config-conventional": "20.5.0",
14
+ "@alfalab/stylelint-core-vars": "workspace:*",
15
+ "@commitlint/cli": "20.5.3",
16
+ "@commitlint/config-conventional": "20.5.3",
17
17
  "@eslint/js": "9.39.4",
18
18
  "@types/eslint-plugin-jsx-a11y": "6.10.1",
19
- "@typescript-eslint/utils": "8.58.2",
19
+ "@typescript-eslint/utils": "8.59.1",
20
20
  "eslint": "9.39.4",
21
21
  "eslint-config-flat-gitignore": "2.3.0",
22
22
  "eslint-import-resolver-typescript": "4.4.4",
@@ -26,51 +26,47 @@
26
26
  "eslint-plugin-jsx-a11y": "6.10.2",
27
27
  "eslint-plugin-n": "17.24.0",
28
28
  "eslint-plugin-react": "7.37.5",
29
- "eslint-plugin-react-hooks": "7.0.1",
29
+ "eslint-plugin-react-hooks": "7.1.1",
30
30
  "eslint-plugin-simple-import-sort": "13.0.0",
31
31
  "eslint-plugin-unicorn": "64.0.0",
32
32
  "execa": "^9.6.1",
33
33
  "globals": "^17.0.0",
34
34
  "jiti": "^2.6.1",
35
- "lefthook": "2.1.5",
36
- "prettier": "3.8.2",
35
+ "lefthook": "2.1.6",
36
+ "prettier": "3.8.3",
37
37
  "stylelint": "16.26.1",
38
- "typescript-eslint": "8.58.2"
38
+ "typescript-eslint": "8.59.1"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=18.18.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@alfalab/core-components": "50.10.0",
45
- "@changesets/changelog-github": "0.6.0",
46
- "@changesets/cli": "2.30.0",
44
+ "@alfalab/core-components": "50.12.1",
45
+ "@changesets/cli": "2.31.0",
46
+ "@commitlint/types": "20.5.0",
47
47
  "@types/node": "24.12.2",
48
48
  "@types/react": "19.2.14",
49
+ "@vitest/coverage-istanbul": "4.1.5",
49
50
  "copyfiles": "2.4.1",
50
- "es-toolkit": "1.45.1",
51
+ "es-toolkit": "1.46.1",
51
52
  "eslint-config-prettier": "10.1.8",
53
+ "eslint-vitest-rule-tester": "3.1.0",
52
54
  "react": "19.2.5",
53
55
  "rimraf": "6.1.3",
54
56
  "tsx": "4.21.0",
55
- "typescript": "6.0.2"
57
+ "typescript": "6.0.3",
58
+ "vitest": "4.1.5"
56
59
  },
57
60
  "scripts": {
58
- "build": "rimraf dist && tsc -p tsconfig.build.json && copyfiles 'README.md' 'CHANGELOG.md' 'lefthook/*.yml' 'eslint/**/*.md' dist",
59
- "test": "tsc --noEmit && eslint-config-prettier ./eslint/index.ts && tsx ./cli/duplicates-checker.ts && yarn lint",
61
+ "build": "rimraf dist && tsc -p tsconfig.build.json && copyfiles 'lefthook/*.yml' '**/*.md' dist && tsx cli/build-dist-package.ts",
62
+ "test": "tsc --noEmit && eslint-config-prettier ./eslint/index.ts && tsx ./cli/duplicates-checker.ts && yarn lint && yarn test:unit",
63
+ "test:unit": "vitest --run --coverage",
60
64
  "lint": "yarn lint:styles && yarn lint:scripts && yarn format:check",
61
65
  "lint:fix": "yarn lint:styles --fix && yarn lint:scripts --fix && yarn format",
62
66
  "lint:styles": "tsx ./cli/index.mts styles",
63
67
  "lint:scripts": "tsx ./cli/index.mts scripts",
64
68
  "format": "tsx ./cli/index.mts format",
65
- "format:check": "tsx ./cli/index.mts format:check",
66
- "release": "changeset publish",
67
- "release:snapshot": "changeset publish --tag snapshot --no-git-tag",
68
- "version-package": "changeset version",
69
- "version-package:snapshot": "changeset version --snapshot snapshot"
70
- },
71
- "prettier": "./prettier",
72
- "stylelint": {
73
- "extends": "./stylelint"
69
+ "format:check": "tsx ./cli/index.mts format:check"
74
70
  },
75
71
  "exports": {
76
72
  "./eslint": {
@@ -85,20 +81,32 @@
85
81
  "types": "./eslint/rules/index.d.ts",
86
82
  "import": "./eslint/rules/index.js"
87
83
  },
88
- "./prettier": "./prettier/index.js",
89
- "./commitlint": "./commitlint/index.js",
90
- "./stylelint": "./stylelint/index.js",
91
84
  "./eslint/plugins": {
92
85
  "types": "./eslint/plugins/index.d.ts",
93
86
  "import": "./eslint/plugins/index.js"
87
+ },
88
+ "./prettier": {
89
+ "types": "./prettier/index.d.ts",
90
+ "import": "./prettier/index.js"
91
+ },
92
+ "./commitlint": {
93
+ "types": "./commitlint/index.d.ts",
94
+ "import": "./commitlint/index.js"
95
+ },
96
+ "./stylelint": {
97
+ "types": "./stylelint/index.d.ts",
98
+ "import": "./stylelint/index.js"
94
99
  }
95
100
  },
96
- "commitlint": {
97
- "extends": "./commitlint"
98
- },
99
- "packageManager": "yarn@4.13.0",
100
101
  "publishConfig": {
101
102
  "directory": "dist",
102
103
  "access": "public"
103
- }
104
+ },
105
+ "commitlint": {
106
+ "extends": "./commitlint/index.ts"
107
+ },
108
+ "stylelint": {
109
+ "extends": "./stylelint/index.ts"
110
+ },
111
+ "prettier": "./prettier/index.ts"
104
112
  }
@@ -1,9 +1,9 @@
1
- declare namespace _default {
2
- let printWidth: number;
3
- let singleQuote: boolean;
4
- let jsxSingleQuote: boolean;
5
- let tabWidth: number;
6
- let trailingComma: string;
7
- let endOfLine: string;
8
- }
1
+ declare const _default: {
2
+ printWidth: number;
3
+ singleQuote: true;
4
+ jsxSingleQuote: true;
5
+ tabWidth: number;
6
+ trailingComma: "all";
7
+ endOfLine: "auto";
8
+ };
9
9
  export default _default;
package/prettier/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import {} from 'prettier';
1
2
  export default {
2
3
  printWidth: 100,
3
4
  singleQuote: true,
@@ -1,5 +1,5 @@
1
- declare namespace _default {
2
- let rules: {
1
+ declare const _default: {
2
+ rules: {
3
3
  'block-no-empty': boolean;
4
4
  'color-hex-length': string;
5
5
  'color-no-invalid-hex': boolean;
@@ -52,8 +52,8 @@ declare namespace _default {
52
52
  ignore: string[];
53
53
  })[];
54
54
  };
55
- let plugins: string[];
56
- let overrides: {
55
+ plugins: string[];
56
+ overrides: {
57
57
  files: string[];
58
58
  rules: {
59
59
  'selector-class-pattern': (string | {
@@ -63,5 +63,5 @@ declare namespace _default {
63
63
  })[];
64
64
  };
65
65
  }[];
66
- }
66
+ };
67
67
  export default _default;
@@ -1,3 +1,4 @@
1
+ import {} from 'stylelint';
1
2
  export default {
2
3
  rules: {
3
4
  // Запрещает пустые блоки