@krivega/eslint-config 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ Это проект, в котором хранятся правила для eslint. Эти правила экспортируются и используются в других пакетах.
7
+ В директориях `exampleReact` и `example` располагаются примеры использования конфигурации проекта.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Krivega
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # Eslint config
2
+
3
+ ## Описание
4
+
5
+ `Eslint config` содержит модули, позволяющие применят правила `krivega` `eslint` для проектов, использующих `typescript`, `react` и тестовые фреймворки `jest` и `cypress`
6
+
7
+ - [`@krivega/eslint-config`](#@krivega/eslint-config)
8
+ - [`@krivega/eslint-config/react`](#@krivega/eslint-config/react)
9
+ - [`@krivega/eslint-config/jest`](#@krivega/eslint-config/jest)
10
+ - [`@krivega/eslint-config/cypress`](#@krivega/eslint-config/cypress)
11
+
12
+ ## Установка
13
+
14
+ Для установки модуля `@krivega/eslint-config` выполните следующую команду в директории вашего проекта:
15
+
16
+ `npm`
17
+
18
+ ```bash
19
+ npm install @krivega/eslint-config --save-dev
20
+ ```
21
+
22
+ `yarn`
23
+
24
+ ```bash
25
+ yarn add @krivega/eslint-config --dev
26
+ ```
27
+
28
+ ## Использование
29
+
30
+ #### <a name="@krivega/eslint-config"></a> `@krivega/eslint-config`
31
+
32
+ Необходимо расширить правила `@krivega/eslint-config` в корневом файле `.eslintrc.json`
33
+
34
+ ```json
35
+ {
36
+ "extends": ["@krivega/eslint-config"]
37
+ }
38
+ ```
39
+
40
+ #### <a name="@krivega/eslint-config/react"></a> `@krivega/eslint-config/react`
41
+
42
+ Необходимо расширить правила `@krivega/eslint-config/react` в корневом файле `.eslintrc.json`
43
+
44
+ ```json
45
+ {
46
+ "extends": ["@krivega/eslint-config/react"]
47
+ }
48
+ ```
49
+
50
+ #### <a name="@krivega/eslint-config/jest"></a> `@krivega/eslint-config/jest`
51
+
52
+ Необходимо расширить правила `@krivega/eslint-config/jest` в корневом файле `.eslintrc.json`. Пример для проекта на `react`
53
+
54
+ ```json
55
+ {
56
+ "extends": ["@krivega/eslint-config/jest", "@krivega/eslint-config/react"]
57
+ }
58
+ ```
59
+
60
+ #### <a name="@krivega/eslint-config/cypress"></a> `@krivega/eslint-config/cypress`
61
+
62
+ Необходимо расширить правила `@krivega/eslint-config/cypress` в корневом файле интеграционных тестов. Например: `cypress/.eslintrc.json`
63
+
64
+ ```json
65
+ {
66
+ "extends": ["@krivega/eslint-config/cypress"]
67
+ }
68
+ ```
69
+
70
+ ## Важно: TypeScript type-aware правила
71
+
72
+ Некоторые правила `@typescript-eslint/*` требуют типовой информации и будут работать корректно только при указании `parserOptions.project` (и при необходимости `tsconfigRootDir`).
73
+
74
+ - Рекомендуется добавить в вашу конфигурацию ESLint:
75
+
76
+ ```ts
77
+ // eslint.config.{js,ts} (Flat config)
78
+ import config from '@krivega/eslint-config';
79
+
80
+ export default [
81
+ ...config,
82
+ {
83
+ languageOptions: {
84
+ parserOptions: {
85
+ project: './tsconfig.json',
86
+ tsconfigRootDir:
87
+ import.meta && typeof import.meta.url === 'string' ? undefined : process.cwd(),
88
+ },
89
+ },
90
+ },
91
+ ];
92
+ ```
93
+
94
+ ```json
95
+ // .eslintrc.json (legacy формат)
96
+ {
97
+ "extends": ["@krivega/eslint-config"],
98
+ "parserOptions": {
99
+ "project": "./tsconfig.json"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Без этих настроек часть правил, зависящих от типов, может быть автоматически отключена или выдавать предупреждения о необходимости parserServices.
package/cypress.js ADDED
@@ -0,0 +1,7 @@
1
+ import pluginCypress from 'eslint-plugin-cypress';
2
+ import config from './index';
3
+ const cypressConfig = [
4
+ ...config,
5
+ pluginCypress.configs.recommended
6
+ ];
7
+ export default cypressConfig;
package/cypress.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { Linter } from 'eslint';
2
+ import pluginCypress from 'eslint-plugin-cypress';
3
+ import config from './index';
4
+
5
+ const cypressConfig: Linter.Config[] = [
6
+ ...config,
7
+ pluginCypress.configs.recommended
8
+ ];
9
+
10
+ export default cypressConfig;
@@ -0,0 +1,7 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ]
7
+ }
@@ -0,0 +1 @@
1
+ declare module 'eslint-plugin-cypress';