@bpa-dev/eslint-config 1.2.0 → 1.2.1
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/README.md +133 -129
- package/index.js +106 -106
- package/package.json +78 -78
- package/prettier.config.js +18 -18
- package/react.js +59 -59
- package/stylelint.config.js +25 -24
package/README.md
CHANGED
|
@@ -1,129 +1,133 @@
|
|
|
1
|
-
# @bpa-dev/eslint-config
|
|
2
|
-
|
|
3
|
-
Универсальная конфигурация ESLint, Prettier и Stylelint для проектов BPA. Поддерживает JavaScript, TypeScript и React.
|
|
4
|
-
|
|
5
|
-
## 🚀 Особенности
|
|
6
|
-
|
|
7
|
-
- ✅ Современный **ESLint 9+ Flat Config**
|
|
8
|
-
- ✅ Поддержка **JavaScript (ES2022)** и **TypeScript**
|
|
9
|
-
- ✅ Конфигурация для **React** с хуками и доступностью
|
|
10
|
-
- ✅ Единый стиль кода с **Prettier**
|
|
11
|
-
- ✅ Правила для импортов и сортировки
|
|
12
|
-
- ✅ Готово к использованию из коробки
|
|
13
|
-
|
|
14
|
-
## 📦 Установка
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install --save-dev @bpa-dev/eslint-config eslint prettier typescript stylelint
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## ⚙️ Использование
|
|
21
|
-
|
|
22
|
-
### ESLint
|
|
23
|
-
|
|
24
|
-
#### Для обычных JS/TS проектов
|
|
25
|
-
|
|
26
|
-
Создайте файл `eslint.config.js` в корне проекта:
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
export { default } from '@bpa-dev/eslint-config'
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
#### Для React проектов
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
export { default } from '@bpa-dev/eslint-config/react'
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
#### Расширение конфигурации
|
|
39
|
-
|
|
40
|
-
Вы можете добавить свои правила:
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
import bpaConfig from '@bpa-dev/eslint-config'
|
|
44
|
-
|
|
45
|
-
export default [
|
|
46
|
-
...bpaConfig,
|
|
47
|
-
{
|
|
48
|
-
rules: {
|
|
49
|
-
// Ваши дополнительные правила
|
|
50
|
-
'no-console': 'off'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Prettier
|
|
57
|
-
|
|
58
|
-
Создайте файл `prettier.config.js` в корне проекта:
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
export { default } from '@bpa-dev/eslint-config/prettier'
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Или расширьте конфигурацию:
|
|
65
|
-
|
|
66
|
-
```javascript
|
|
67
|
-
import bpaPrettierConfig from '@bpa-dev/eslint-config/prettier'
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
...bpaPrettierConfig,
|
|
71
|
-
printWidth: 120 // переопределение настроек
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Stylelint
|
|
76
|
-
|
|
77
|
-
Создайте файл `stylelint.config.js` в корне проекта:
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
export { default } from '@bpa-dev/eslint-config/stylelint'
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Или расширьте конфигурацию:
|
|
84
|
-
|
|
85
|
-
```javascript
|
|
86
|
-
import bpaStylelintConfig from '@bpa-dev/eslint-config/stylelint'
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
# @bpa-dev/eslint-config
|
|
2
|
+
|
|
3
|
+
Универсальная конфигурация ESLint, Prettier и Stylelint для проектов BPA. Поддерживает JavaScript, TypeScript и React.
|
|
4
|
+
|
|
5
|
+
## 🚀 Особенности
|
|
6
|
+
|
|
7
|
+
- ✅ Современный **ESLint 9+ Flat Config**
|
|
8
|
+
- ✅ Поддержка **JavaScript (ES2022)** и **TypeScript**
|
|
9
|
+
- ✅ Конфигурация для **React** с хуками и доступностью
|
|
10
|
+
- ✅ Единый стиль кода с **Prettier**
|
|
11
|
+
- ✅ Правила для импортов и сортировки
|
|
12
|
+
- ✅ Готово к использованию из коробки
|
|
13
|
+
|
|
14
|
+
## 📦 Установка
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install --save-dev @bpa-dev/eslint-config eslint prettier typescript stylelint
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## ⚙️ Использование
|
|
21
|
+
|
|
22
|
+
### ESLint
|
|
23
|
+
|
|
24
|
+
#### Для обычных JS/TS проектов
|
|
25
|
+
|
|
26
|
+
Создайте файл `eslint.config.js` в корне проекта:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
export { default } from '@bpa-dev/eslint-config'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Для React проектов
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
export { default } from '@bpa-dev/eslint-config/react'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Расширение конфигурации
|
|
39
|
+
|
|
40
|
+
Вы можете добавить свои правила:
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
import bpaConfig from '@bpa-dev/eslint-config'
|
|
44
|
+
|
|
45
|
+
export default [
|
|
46
|
+
...bpaConfig,
|
|
47
|
+
{
|
|
48
|
+
rules: {
|
|
49
|
+
// Ваши дополнительные правила
|
|
50
|
+
'no-console': 'off'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Prettier
|
|
57
|
+
|
|
58
|
+
Создайте файл `prettier.config.js` в корне проекта:
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
export { default } from '@bpa-dev/eslint-config/prettier'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Или расширьте конфигурацию:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
import bpaPrettierConfig from '@bpa-dev/eslint-config/prettier'
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
...bpaPrettierConfig,
|
|
71
|
+
printWidth: 120 // переопределение настроек
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Stylelint
|
|
76
|
+
|
|
77
|
+
Создайте файл `stylelint.config.js` в корне проекта:
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
export { default } from '@bpa-dev/eslint-config/stylelint'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Или расширьте конфигурацию:
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
import bpaStylelintConfig from '@bpa-dev/eslint-config/stylelint'
|
|
87
|
+
|
|
88
|
+
/** @type {import('stylelint').Config} */
|
|
89
|
+
export default {
|
|
90
|
+
...bpaStylelintConfig,
|
|
91
|
+
rules: {
|
|
92
|
+
...bpaStylelintConfig.rules,
|
|
93
|
+
'media-feature-range-notation': 'context'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### package.json скрипты
|
|
99
|
+
|
|
100
|
+
Добавьте в `package.json`:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"scripts": {
|
|
105
|
+
"lint": "eslint .",
|
|
106
|
+
"lint:fix": "eslint . --fix",
|
|
107
|
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
108
|
+
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\""
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 🎯 VS Code интеграция
|
|
114
|
+
|
|
115
|
+
Установите расширения:
|
|
116
|
+
|
|
117
|
+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
118
|
+
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
119
|
+
- [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
|
|
120
|
+
|
|
121
|
+
Создайте `.vscode/settings.json`:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"editor.formatOnSave": true,
|
|
126
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
127
|
+
"editor.codeActionsOnSave": {
|
|
128
|
+
"source.fixAll.eslint": "explicit"
|
|
129
|
+
},
|
|
130
|
+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
|
131
|
+
"stylelint.validate": ["css"]
|
|
132
|
+
}
|
|
133
|
+
```
|
package/index.js
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Базовый ESLint конфиг для JavaScript и TypeScript проектов BPA
|
|
3
|
-
* Используется ESLint 9+ Flat Config
|
|
4
|
-
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
5
|
-
*/
|
|
6
|
-
import js from '@eslint/js'
|
|
7
|
-
import importPlugin from 'eslint-plugin-import'
|
|
8
|
-
import perfectionistPlugin from 'eslint-plugin-perfectionist'
|
|
9
|
-
import prettierPlugin from 'eslint-plugin-prettier/recommended'
|
|
10
|
-
// @ts-expect-error - no types available
|
|
11
|
-
import promisePlugin from 'eslint-plugin-promise'
|
|
12
|
-
// @ts-expect-error - no types available
|
|
13
|
-
import securityPlugin from 'eslint-plugin-security'
|
|
14
|
-
import unicornPlugin from 'eslint-plugin-unicorn'
|
|
15
|
-
import { defineConfig } from 'eslint/config'
|
|
16
|
-
import { configs as tseslintPlugin } from 'typescript-eslint'
|
|
17
|
-
|
|
18
|
-
export default defineConfig([
|
|
19
|
-
{
|
|
20
|
-
ignores: [
|
|
21
|
-
'**/node_modules/**',
|
|
22
|
-
'**/dist/**',
|
|
23
|
-
'**/build/**',
|
|
24
|
-
'**/.next/**',
|
|
25
|
-
'**/out/**',
|
|
26
|
-
'**/coverage/**',
|
|
27
|
-
'**/.turbo/**',
|
|
28
|
-
'**/.cache/**',
|
|
29
|
-
'**/*.min.js'
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
{ files: ['**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}'] },
|
|
33
|
-
js.configs.recommended,
|
|
34
|
-
tseslintPlugin.all,
|
|
35
|
-
perfectionistPlugin.configs['recommended-natural'],
|
|
36
|
-
importPlugin.flatConfigs.recommended,
|
|
37
|
-
importPlugin.flatConfigs.typescript,
|
|
38
|
-
prettierPlugin,
|
|
39
|
-
unicornPlugin.configs.all,
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
41
|
-
securityPlugin.configs.recommended,
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
43
|
-
promisePlugin.configs['flat/recommended'],
|
|
44
|
-
{
|
|
45
|
-
rules: {
|
|
46
|
-
'@typescript-eslint/consistent-return': 'off',
|
|
47
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
48
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
49
|
-
'@typescript-eslint/naming-convention': 'off',
|
|
50
|
-
'@typescript-eslint/no-magic-numbers': 'off',
|
|
51
|
-
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
52
|
-
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
53
|
-
'@typescript-eslint/no-unsafe-type-assertion': 'warn',
|
|
54
|
-
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
55
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
|
|
56
|
-
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
|
|
57
|
-
'@typescript-eslint/strict-boolean-expressions': 'warn',
|
|
58
|
-
'import/extensions': [
|
|
59
|
-
'error',
|
|
60
|
-
'ignorePackages',
|
|
61
|
-
{
|
|
62
|
-
ts: 'never',
|
|
63
|
-
tsx: 'never'
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
'import/no-duplicates': 'error',
|
|
67
|
-
'import/no-named-as-default': 'error',
|
|
68
|
-
'import/no-unresolved': 'error',
|
|
69
|
-
'no-console': 'error',
|
|
70
|
-
'perfectionist/sort-classes': 'off',
|
|
71
|
-
'perfectionist/sort-imports': [
|
|
72
|
-
'error',
|
|
73
|
-
{
|
|
74
|
-
groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'side-effect', 'type'],
|
|
75
|
-
newlinesBetween: 1,
|
|
76
|
-
order: 'asc',
|
|
77
|
-
type: 'natural'
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
'unicorn/filename-case': 'off',
|
|
81
|
-
'unicorn/no-array-callback-reference': 'off',
|
|
82
|
-
'unicorn/no-keyword-prefix': 'off',
|
|
83
|
-
'unicorn/no-nested-ternary': 'off',
|
|
84
|
-
'unicorn/no-null': 'off',
|
|
85
|
-
'unicorn/no-useless-undefined': 'off',
|
|
86
|
-
'unicorn/prefer-at': ['error', { checkAllIndexAccess: true }],
|
|
87
|
-
'unicorn/prefer-ternary': 'off',
|
|
88
|
-
'unicorn/prevent-abbreviations': 'off'
|
|
89
|
-
},
|
|
90
|
-
settings: {
|
|
91
|
-
'import/resolver': {
|
|
92
|
-
typescript: {
|
|
93
|
-
alwaysTryTypes: true,
|
|
94
|
-
project: './tsconfig.json'
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
languageOptions: {
|
|
101
|
-
parserOptions: {
|
|
102
|
-
projectService: true
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
])
|
|
1
|
+
/**
|
|
2
|
+
* Базовый ESLint конфиг для JavaScript и TypeScript проектов BPA
|
|
3
|
+
* Используется ESLint 9+ Flat Config
|
|
4
|
+
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
5
|
+
*/
|
|
6
|
+
import js from '@eslint/js'
|
|
7
|
+
import importPlugin from 'eslint-plugin-import'
|
|
8
|
+
import perfectionistPlugin from 'eslint-plugin-perfectionist'
|
|
9
|
+
import prettierPlugin from 'eslint-plugin-prettier/recommended'
|
|
10
|
+
// @ts-expect-error - no types available
|
|
11
|
+
import promisePlugin from 'eslint-plugin-promise'
|
|
12
|
+
// @ts-expect-error - no types available
|
|
13
|
+
import securityPlugin from 'eslint-plugin-security'
|
|
14
|
+
import unicornPlugin from 'eslint-plugin-unicorn'
|
|
15
|
+
import { defineConfig } from 'eslint/config'
|
|
16
|
+
import { configs as tseslintPlugin } from 'typescript-eslint'
|
|
17
|
+
|
|
18
|
+
export default defineConfig([
|
|
19
|
+
{
|
|
20
|
+
ignores: [
|
|
21
|
+
'**/node_modules/**',
|
|
22
|
+
'**/dist/**',
|
|
23
|
+
'**/build/**',
|
|
24
|
+
'**/.next/**',
|
|
25
|
+
'**/out/**',
|
|
26
|
+
'**/coverage/**',
|
|
27
|
+
'**/.turbo/**',
|
|
28
|
+
'**/.cache/**',
|
|
29
|
+
'**/*.min.js'
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{ files: ['**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}'] },
|
|
33
|
+
js.configs.recommended,
|
|
34
|
+
tseslintPlugin.all,
|
|
35
|
+
perfectionistPlugin.configs['recommended-natural'],
|
|
36
|
+
importPlugin.flatConfigs.recommended,
|
|
37
|
+
importPlugin.flatConfigs.typescript,
|
|
38
|
+
prettierPlugin,
|
|
39
|
+
unicornPlugin.configs.all,
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
41
|
+
securityPlugin.configs.recommended,
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
43
|
+
promisePlugin.configs['flat/recommended'],
|
|
44
|
+
{
|
|
45
|
+
rules: {
|
|
46
|
+
'@typescript-eslint/consistent-return': 'off',
|
|
47
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
48
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
49
|
+
'@typescript-eslint/naming-convention': 'off',
|
|
50
|
+
'@typescript-eslint/no-magic-numbers': 'off',
|
|
51
|
+
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
52
|
+
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
53
|
+
'@typescript-eslint/no-unsafe-type-assertion': 'warn',
|
|
54
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
55
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
|
|
56
|
+
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
|
|
57
|
+
'@typescript-eslint/strict-boolean-expressions': 'warn',
|
|
58
|
+
'import/extensions': [
|
|
59
|
+
'error',
|
|
60
|
+
'ignorePackages',
|
|
61
|
+
{
|
|
62
|
+
ts: 'never',
|
|
63
|
+
tsx: 'never'
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
'import/no-duplicates': 'error',
|
|
67
|
+
'import/no-named-as-default': 'error',
|
|
68
|
+
'import/no-unresolved': 'error',
|
|
69
|
+
'no-console': 'error',
|
|
70
|
+
'perfectionist/sort-classes': 'off',
|
|
71
|
+
'perfectionist/sort-imports': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'side-effect', 'type'],
|
|
75
|
+
newlinesBetween: 1,
|
|
76
|
+
order: 'asc',
|
|
77
|
+
type: 'natural'
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
'unicorn/filename-case': 'off',
|
|
81
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
82
|
+
'unicorn/no-keyword-prefix': 'off',
|
|
83
|
+
'unicorn/no-nested-ternary': 'off',
|
|
84
|
+
'unicorn/no-null': 'off',
|
|
85
|
+
'unicorn/no-useless-undefined': 'off',
|
|
86
|
+
'unicorn/prefer-at': ['error', { checkAllIndexAccess: true }],
|
|
87
|
+
'unicorn/prefer-ternary': 'off',
|
|
88
|
+
'unicorn/prevent-abbreviations': 'off'
|
|
89
|
+
},
|
|
90
|
+
settings: {
|
|
91
|
+
'import/resolver': {
|
|
92
|
+
typescript: {
|
|
93
|
+
alwaysTryTypes: true,
|
|
94
|
+
project: './tsconfig.json'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
languageOptions: {
|
|
101
|
+
parserOptions: {
|
|
102
|
+
projectService: true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
])
|
package/package.json
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bpa-dev/eslint-config",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Набор конфигураций для ESLint, Prettier и Stylelint для проектов BPA",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./index.js",
|
|
9
|
-
"./prettier": "./prettier.config.js",
|
|
10
|
-
"./stylelint": "./stylelint.config.js",
|
|
11
|
-
"./react": "./react.js"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"index.js",
|
|
15
|
-
"react.js",
|
|
16
|
-
"prettier.config.js",
|
|
17
|
-
"stylelint.config.js"
|
|
18
|
-
],
|
|
19
|
-
"keywords": [
|
|
20
|
-
"eslint",
|
|
21
|
-
"eslintconfig",
|
|
22
|
-
"prettier",
|
|
23
|
-
"config",
|
|
24
|
-
"javascript",
|
|
25
|
-
"typescript",
|
|
26
|
-
"react",
|
|
27
|
-
"stylelint"
|
|
28
|
-
],
|
|
29
|
-
"author": "BPA",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"scripts": {
|
|
32
|
-
"eslint:fix": "eslint . --fix -c index.js",
|
|
33
|
-
"prettier:write": "prettier . --write",
|
|
34
|
-
"format": "npm run eslint:fix && npm run prettier:write"
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"eslint": "^9.0.0",
|
|
38
|
-
"prettier": "^3.0.0",
|
|
39
|
-
"stylelint": "^17.0.0",
|
|
40
|
-
"typescript": "^5.0.0"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@eslint/js": "^9.39.2",
|
|
44
|
-
"@stylistic/stylelint-plugin": "^5.0.1",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
46
|
-
"@typescript-eslint/parser": "^8.53.1",
|
|
47
|
-
"eslint-config-prettier": "^10.1.8",
|
|
48
|
-
"eslint-import-resolver-typescript": "^4.4.4",
|
|
49
|
-
"eslint-plugin-import": "^2.32.0",
|
|
50
|
-
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
51
|
-
"eslint-plugin-perfectionist": "^5.4.0",
|
|
52
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
53
|
-
"eslint-plugin-promise": "^7.2.1",
|
|
54
|
-
"eslint-plugin-react": "^7.37.5",
|
|
55
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
56
|
-
"eslint-plugin-security": "^3.0.1",
|
|
57
|
-
"eslint-plugin-unicorn": "^62.0.0",
|
|
58
|
-
"stylelint-config-recess-order": "^7.6.0",
|
|
59
|
-
"stylelint-config-recommended": "^18.0.0",
|
|
60
|
-
"stylelint-high-performance-animation": "^2.0.0",
|
|
61
|
-
"stylelint-order": "^7.0.1",
|
|
62
|
-
"stylelint-plugin-logical-css": "^1.2.3",
|
|
63
|
-
"stylelint-plugin-use-baseline": "^1.2.
|
|
64
|
-
"stylelint-use-nesting": "^6.0.1",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"eslint": "^9.39.2",
|
|
69
|
-
"prettier": "^3.8.1",
|
|
70
|
-
"stylelint": "^17.0.0",
|
|
71
|
-
"typescript": "^5.9.3"
|
|
72
|
-
},
|
|
73
|
-
"overrides": {
|
|
74
|
-
"stylelint-plugin-logical-css": {
|
|
75
|
-
"stylelint": "^17.0.0"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bpa-dev/eslint-config",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Набор конфигураций для ESLint, Prettier и Stylelint для проектов BPA",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./prettier": "./prettier.config.js",
|
|
10
|
+
"./stylelint": "./stylelint.config.js",
|
|
11
|
+
"./react": "./react.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"react.js",
|
|
16
|
+
"prettier.config.js",
|
|
17
|
+
"stylelint.config.js"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"eslint",
|
|
21
|
+
"eslintconfig",
|
|
22
|
+
"prettier",
|
|
23
|
+
"config",
|
|
24
|
+
"javascript",
|
|
25
|
+
"typescript",
|
|
26
|
+
"react",
|
|
27
|
+
"stylelint"
|
|
28
|
+
],
|
|
29
|
+
"author": "BPA",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"eslint:fix": "eslint . --fix -c index.js",
|
|
33
|
+
"prettier:write": "prettier . --write",
|
|
34
|
+
"format": "npm run eslint:fix && npm run prettier:write"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"eslint": "^9.0.0",
|
|
38
|
+
"prettier": "^3.0.0",
|
|
39
|
+
"stylelint": "^17.0.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@eslint/js": "^9.39.2",
|
|
44
|
+
"@stylistic/stylelint-plugin": "^5.0.1",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
46
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
49
|
+
"eslint-plugin-import": "^2.32.0",
|
|
50
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
51
|
+
"eslint-plugin-perfectionist": "^5.4.0",
|
|
52
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
53
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
54
|
+
"eslint-plugin-react": "^7.37.5",
|
|
55
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
56
|
+
"eslint-plugin-security": "^3.0.1",
|
|
57
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
58
|
+
"stylelint-config-recess-order": "^7.6.0",
|
|
59
|
+
"stylelint-config-recommended": "^18.0.0",
|
|
60
|
+
"stylelint-high-performance-animation": "^2.0.0",
|
|
61
|
+
"stylelint-order": "^7.0.1",
|
|
62
|
+
"stylelint-plugin-logical-css": "^1.2.3",
|
|
63
|
+
"stylelint-plugin-use-baseline": "^1.2.1",
|
|
64
|
+
"stylelint-use-nesting": "^6.0.1",
|
|
65
|
+
"typescript-eslint": "^8.54.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"eslint": "^9.39.2",
|
|
69
|
+
"prettier": "^3.8.1",
|
|
70
|
+
"stylelint": "^17.0.0",
|
|
71
|
+
"typescript": "^5.9.3"
|
|
72
|
+
},
|
|
73
|
+
"overrides": {
|
|
74
|
+
"stylelint-plugin-logical-css": {
|
|
75
|
+
"stylelint": "^17.0.0"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
package/prettier.config.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prettier конфигурация для проектов BPA
|
|
3
|
-
* @see https://prettier.io/docs/configuration
|
|
4
|
-
* @type {import("prettier").Config}
|
|
5
|
-
*/
|
|
6
|
-
const config = {
|
|
7
|
-
arrowParens: 'always',
|
|
8
|
-
bracketSpacing: true,
|
|
9
|
-
endOfLine: 'auto',
|
|
10
|
-
jsxSingleQuote: true,
|
|
11
|
-
printWidth: 120,
|
|
12
|
-
semi: false,
|
|
13
|
-
singleQuote: true,
|
|
14
|
-
tabWidth: 2,
|
|
15
|
-
trailingComma: 'none'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default config
|
|
1
|
+
/**
|
|
2
|
+
* Prettier конфигурация для проектов BPA
|
|
3
|
+
* @see https://prettier.io/docs/configuration
|
|
4
|
+
* @type {import("prettier").Config}
|
|
5
|
+
*/
|
|
6
|
+
const config = {
|
|
7
|
+
arrowParens: 'always',
|
|
8
|
+
bracketSpacing: true,
|
|
9
|
+
endOfLine: 'auto',
|
|
10
|
+
jsxSingleQuote: true,
|
|
11
|
+
printWidth: 120,
|
|
12
|
+
semi: false,
|
|
13
|
+
singleQuote: true,
|
|
14
|
+
tabWidth: 2,
|
|
15
|
+
trailingComma: 'none'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default config
|
package/react.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import a11yPlugin from 'eslint-plugin-jsx-a11y'
|
|
2
|
-
import reactPlugin from 'eslint-plugin-react'
|
|
3
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
4
|
-
import { defineConfig } from 'eslint/config'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* ESLint конфиг для React проектов BPA
|
|
8
|
-
* Расширяет базовый конфиг с поддержкой React и JSX
|
|
9
|
-
*/
|
|
10
|
-
import baseConfig from './index.js'
|
|
11
|
-
|
|
12
|
-
export default defineConfig([
|
|
13
|
-
...baseConfig,
|
|
14
|
-
{
|
|
15
|
-
files: ['**/*.{jsx,tsx}'],
|
|
16
|
-
plugins: {
|
|
17
|
-
'jsx-a11y': a11yPlugin,
|
|
18
|
-
react: reactPlugin,
|
|
19
|
-
'react-hooks': reactHooksPlugin
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
// React основные правила
|
|
23
|
-
...reactPlugin.configs.recommended.rules,
|
|
24
|
-
'react/jsx-boolean-value': ['error', 'never'],
|
|
25
|
-
'react/jsx-curly-brace-presence': ['error', { children: 'never', props: 'never' }],
|
|
26
|
-
'react/jsx-fragments': ['error', 'syntax'],
|
|
27
|
-
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
|
|
28
|
-
'react/jsx-no-target-blank': 'error',
|
|
29
|
-
'react/jsx-pascal-case': 'error',
|
|
30
|
-
'react/no-array-index-key': 'warn',
|
|
31
|
-
'react/no-unstable-nested-components': 'error',
|
|
32
|
-
'react/prop-types': 'off',
|
|
33
|
-
'react/react-in-jsx-scope': 'off',
|
|
34
|
-
'react/self-closing-comp': 'error',
|
|
35
|
-
|
|
36
|
-
// React Hooks правила
|
|
37
|
-
...reactHooksPlugin.configs.recommended.rules,
|
|
38
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
39
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
40
|
-
|
|
41
|
-
// Доступность
|
|
42
|
-
...a11yPlugin.configs.recommended.rules,
|
|
43
|
-
'jsx-a11y/anchor-is-valid': [
|
|
44
|
-
'error',
|
|
45
|
-
{
|
|
46
|
-
components: ['Link'],
|
|
47
|
-
specialLink: ['to']
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
'jsx-a11y/click-events-have-key-events': 'warn',
|
|
51
|
-
'jsx-a11y/no-static-element-interactions': 'warn'
|
|
52
|
-
},
|
|
53
|
-
settings: {
|
|
54
|
-
react: {
|
|
55
|
-
version: 'detect'
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
])
|
|
1
|
+
import a11yPlugin from 'eslint-plugin-jsx-a11y'
|
|
2
|
+
import reactPlugin from 'eslint-plugin-react'
|
|
3
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
4
|
+
import { defineConfig } from 'eslint/config'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ESLint конфиг для React проектов BPA
|
|
8
|
+
* Расширяет базовый конфиг с поддержкой React и JSX
|
|
9
|
+
*/
|
|
10
|
+
import baseConfig from './index.js'
|
|
11
|
+
|
|
12
|
+
export default defineConfig([
|
|
13
|
+
...baseConfig,
|
|
14
|
+
{
|
|
15
|
+
files: ['**/*.{jsx,tsx}'],
|
|
16
|
+
plugins: {
|
|
17
|
+
'jsx-a11y': a11yPlugin,
|
|
18
|
+
react: reactPlugin,
|
|
19
|
+
'react-hooks': reactHooksPlugin
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
// React основные правила
|
|
23
|
+
...reactPlugin.configs.recommended.rules,
|
|
24
|
+
'react/jsx-boolean-value': ['error', 'never'],
|
|
25
|
+
'react/jsx-curly-brace-presence': ['error', { children: 'never', props: 'never' }],
|
|
26
|
+
'react/jsx-fragments': ['error', 'syntax'],
|
|
27
|
+
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
|
|
28
|
+
'react/jsx-no-target-blank': 'error',
|
|
29
|
+
'react/jsx-pascal-case': 'error',
|
|
30
|
+
'react/no-array-index-key': 'warn',
|
|
31
|
+
'react/no-unstable-nested-components': 'error',
|
|
32
|
+
'react/prop-types': 'off',
|
|
33
|
+
'react/react-in-jsx-scope': 'off',
|
|
34
|
+
'react/self-closing-comp': 'error',
|
|
35
|
+
|
|
36
|
+
// React Hooks правила
|
|
37
|
+
...reactHooksPlugin.configs.recommended.rules,
|
|
38
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
39
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
40
|
+
|
|
41
|
+
// Доступность
|
|
42
|
+
...a11yPlugin.configs.recommended.rules,
|
|
43
|
+
'jsx-a11y/anchor-is-valid': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
components: ['Link'],
|
|
47
|
+
specialLink: ['to']
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
'jsx-a11y/click-events-have-key-events': 'warn',
|
|
51
|
+
'jsx-a11y/no-static-element-interactions': 'warn'
|
|
52
|
+
},
|
|
53
|
+
settings: {
|
|
54
|
+
react: {
|
|
55
|
+
version: 'detect'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
])
|
package/stylelint.config.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
/** @type {import('stylelint').Config} */
|
|
2
|
-
export default {
|
|
3
|
-
extends: ['stylelint-config-recommended', 'stylelint-config-recess-order'],
|
|
4
|
-
ignoreFiles: ['dist/**'],
|
|
5
|
-
plugins: [
|
|
6
|
-
'@stylistic/stylelint-plugin',
|
|
7
|
-
'stylelint-high-performance-animation',
|
|
8
|
-
'stylelint-use-nesting',
|
|
9
|
-
'stylelint-plugin-logical-css',
|
|
10
|
-
'stylelint-plugin-use-baseline'
|
|
11
|
-
],
|
|
12
|
-
rules: {
|
|
13
|
-
'@stylistic/color-hex-case': 'lower',
|
|
14
|
-
'@stylistic/number-leading-zero': 'always',
|
|
15
|
-
'@stylistic/unit-case': 'lower',
|
|
16
|
-
'color-function-notation': 'modern',
|
|
17
|
-
'csstools/use-nesting': 'always',
|
|
18
|
-
'
|
|
19
|
-
'plugin/
|
|
20
|
-
'plugin/use-
|
|
21
|
-
'plugin/use-logical-
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
}
|
|
1
|
+
/** @type {import('stylelint').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
extends: ['stylelint-config-recommended', 'stylelint-config-recess-order'],
|
|
4
|
+
ignoreFiles: ['dist/**'],
|
|
5
|
+
plugins: [
|
|
6
|
+
'@stylistic/stylelint-plugin',
|
|
7
|
+
'stylelint-high-performance-animation',
|
|
8
|
+
'stylelint-use-nesting',
|
|
9
|
+
'stylelint-plugin-logical-css',
|
|
10
|
+
'stylelint-plugin-use-baseline'
|
|
11
|
+
],
|
|
12
|
+
rules: {
|
|
13
|
+
'@stylistic/color-hex-case': 'lower',
|
|
14
|
+
'@stylistic/number-leading-zero': 'always',
|
|
15
|
+
'@stylistic/unit-case': 'lower',
|
|
16
|
+
'color-function-notation': 'modern',
|
|
17
|
+
'csstools/use-nesting': 'always',
|
|
18
|
+
'media-feature-range-notation': 'context',
|
|
19
|
+
'plugin/no-low-performance-animation-properties': true,
|
|
20
|
+
'plugin/use-baseline': [true, { available: 'newly' }],
|
|
21
|
+
'plugin/use-logical-properties-and-values': [true, { severity: 'error' }],
|
|
22
|
+
'plugin/use-logical-units': [true, { severity: 'error' }],
|
|
23
|
+
'selector-max-compound-selectors': 1
|
|
24
|
+
}
|
|
25
|
+
}
|