@bpa-dev/eslint-config 1.1.0 → 1.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/README.md CHANGED
@@ -1,122 +1,129 @@
1
- # @bpa-dev/eslint-config
2
-
3
- Универсальная конфигурация ESLint и Prettier для проектов BPA. Поддерживает JavaScript, TypeScript и React.
4
-
5
- ## 🚀 Особенности
6
-
7
- - ✅ Современный **ESLint 9+ Flat Config**
8
- - ✅ Поддержка **JavaScript (ES2024)** и **TypeScript**
9
- - ✅ Конфигурация для **React** с хуками и доступностью
10
- - ✅ Единый стиль кода с **Prettier**
11
- - ✅ Правила для импортов и сортировки
12
- - ✅ Готово к использованию из коробки
13
-
14
- ## 📦 Установка
15
-
16
- ### Для JavaScript/TypeScript проектов
17
-
18
- ```bash
19
- npm install --save-dev @bpa-dev/eslint-config eslint prettier typescript
20
- ```
21
-
22
- ### Для React проектов
23
-
24
- ```bash
25
- npm install --save-dev @bpa-dev/eslint-config eslint prettier typescript
26
- ```
27
-
28
- ## ⚙️ Использование
29
-
30
- ### ESLint
31
-
32
- #### Для обычных JS/TS проектов
33
-
34
- Создайте файл `eslint.config.js` в корне проекта:
35
-
36
- ```javascript
37
- import bpaConfig from '@bpa-dev/eslint-config'
38
-
39
- export default bpaConfig
40
- ```
41
-
42
- #### Для React проектов
43
-
44
- ```javascript
45
- import bpaReactConfig from '@bpa-dev/eslint-config/react'
46
-
47
- export default bpaReactConfig
48
- ```
49
-
50
- #### Расширение конфигурации
51
-
52
- Вы можете добавить свои правила:
53
-
54
- ```javascript
55
- import bpaConfig from '@bpa-dev/eslint-config'
56
-
57
- export default [
58
- ...bpaConfig,
59
- {
60
- rules: {
61
- // Ваши дополнительные правила
62
- 'no-console': 'off'
63
- }
64
- }
65
- ]
66
- ```
67
-
68
- ### Prettier
69
-
70
- Создайте файл `prettier.config.js` в корне проекта:
71
-
72
- ```javascript
73
- import bpaPrettierConfig from '@bpa-dev/eslint-config/prettier'
74
-
75
- export default bpaPrettierConfig
76
- ```
77
-
78
- Или расширьте конфигурацию:
79
-
80
- ```javascript
81
- import bpaPrettierConfig from '@bpa-dev/eslint-config/prettier'
82
-
83
- export default {
84
- ...bpaPrettierConfig,
85
- printWidth: 120 // переопределение настроек
86
- }
87
- ```
88
-
89
- ### package.json скрипты
90
-
91
- Добавьте в `package.json`:
92
-
93
- ```json
94
- {
95
- "scripts": {
96
- "lint": "eslint .",
97
- "lint:fix": "eslint . --fix",
98
- "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
99
- "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\""
100
- }
101
- }
102
- ```
103
-
104
- ## 🎯 VS Code интеграция
105
-
106
- Установите расширения:
107
-
108
- - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
109
- - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
110
-
111
- Создайте `.vscode/settings.json`:
112
-
113
- ```json
114
- {
115
- "editor.formatOnSave": true,
116
- "editor.defaultFormatter": "esbenp.prettier-vscode",
117
- "editor.codeActionsOnSave": {
118
- "source.fixAll.eslint": "explicit"
119
- },
120
- "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"]
121
- }
122
- ```
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
+ export default {
89
+ ...bpaStylelintConfig,
90
+ '@stylistic/color-hex-case': 'upper' // переопределение настроек
91
+ }
92
+ ```
93
+
94
+ ### package.json скрипты
95
+
96
+ Добавьте в `package.json`:
97
+
98
+ ```json
99
+ {
100
+ "scripts": {
101
+ "lint": "eslint .",
102
+ "lint:fix": "eslint . --fix",
103
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
104
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\""
105
+ }
106
+ }
107
+ ```
108
+
109
+ ## 🎯 VS Code интеграция
110
+
111
+ Установите расширения:
112
+
113
+ - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
114
+ - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
115
+ - [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
116
+
117
+ Создайте `.vscode/settings.json`:
118
+
119
+ ```json
120
+ {
121
+ "editor.formatOnSave": true,
122
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
123
+ "editor.codeActionsOnSave": {
124
+ "source.fixAll.eslint": "explicit"
125
+ },
126
+ "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
127
+ "stylelint.validate": ["css"]
128
+ }
129
+ ```
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
- {
46
- rules: {
47
- '@typescript-eslint/consistent-return': 'off',
48
- '@typescript-eslint/explicit-function-return-type': 'off',
49
- '@typescript-eslint/explicit-module-boundary-types': 'off',
50
- '@typescript-eslint/naming-convention': 'off',
51
- '@typescript-eslint/no-magic-numbers': 'off',
52
- '@typescript-eslint/no-unsafe-assignment': 'warn',
53
- '@typescript-eslint/no-unsafe-member-access': 'warn',
54
- '@typescript-eslint/no-unsafe-type-assertion': 'warn',
55
- '@typescript-eslint/prefer-readonly-parameter-types': 'off',
56
- '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
57
- '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
58
- '@typescript-eslint/strict-boolean-expressions': 'warn',
59
- 'import/extensions': [
60
- 'error',
61
- 'ignorePackages',
62
- {
63
- ts: 'never',
64
- tsx: 'never'
65
- }
66
- ],
67
- 'import/no-duplicates': 'error',
68
- 'import/no-named-as-default': 'error',
69
- 'import/no-unresolved': 'error',
70
- 'no-console': 'error',
71
- 'perfectionist/sort-classes': 'off',
72
- 'perfectionist/sort-imports': [
73
- 'error',
74
- {
75
- groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'side-effect', 'type'],
76
- newlinesBetween: 1,
77
- order: 'asc',
78
- type: 'natural'
79
- }
80
- ],
81
- 'unicorn/filename-case': 'off',
82
- 'unicorn/no-array-callback-reference': 'off',
83
- 'unicorn/no-keyword-prefix': '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,61 +1,78 @@
1
- {
2
- "name": "@bpa-dev/eslint-config",
3
- "version": "1.1.0",
4
- "description": "Набор конфигураций для ESLint и Prettier для проектов BPA",
5
- "main": "index.js",
6
- "type": "module",
7
- "exports": {
8
- ".": "./index.js",
9
- "./prettier": "./prettier.config.js",
10
- "./react": "./react.js"
11
- },
12
- "files": [
13
- "index.js",
14
- "react.js",
15
- "prettier.config.js"
16
- ],
17
- "keywords": [
18
- "eslint",
19
- "eslintconfig",
20
- "prettier",
21
- "config",
22
- "javascript",
23
- "typescript",
24
- "react"
25
- ],
26
- "author": "BPA",
27
- "license": "MIT",
28
- "scripts": {
29
- "eslint:fix": "eslint . --fix -c index.js",
30
- "prettier:write": "prettier . --write",
31
- "format": "npm run eslint:fix && npm run prettier:write"
32
- },
33
- "peerDependencies": {
34
- "eslint": "^9.0.0",
35
- "prettier": "^3.0.0",
36
- "typescript": "^5.0.0"
37
- },
38
- "dependencies": {
39
- "@eslint/js": "^9.39.2",
40
- "@typescript-eslint/eslint-plugin": "^8.53.1",
41
- "@typescript-eslint/parser": "^8.53.1",
42
- "eslint-config-prettier": "^10.1.8",
43
- "eslint-import-resolver-typescript": "^4.4.4",
44
- "eslint-plugin-import": "^2.32.0",
45
- "eslint-plugin-jsx-a11y": "^6.10.2",
46
- "eslint-plugin-perfectionist": "^5.4.0",
47
- "eslint-plugin-prettier": "^5.5.5",
48
- "eslint-plugin-promise": "^7.2.1",
49
- "eslint-plugin-react": "^7.37.5",
50
- "eslint-plugin-react-hooks": "^7.0.1",
51
- "eslint-plugin-security": "^3.0.1",
52
- "eslint-plugin-unicorn": "^62.0.0",
53
- "typescript-eslint": "^8.53.1"
54
- },
55
- "devDependencies": {
56
- "eslint": "^9.39.2",
57
- "globals": "^17.0.0",
58
- "prettier": "^3.8.1",
59
- "typescript": "^5.9.3"
60
- }
61
- }
1
+ {
2
+ "name": "@bpa-dev/eslint-config",
3
+ "version": "1.2.0",
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.0",
64
+ "stylelint-use-nesting": "^6.0.1",
65
+ "typescript-eslint": "^8.53.1"
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,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
+ ])
@@ -0,0 +1,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
+ 'plugin/no-low-performance-animation-properties': true,
19
+ 'plugin/use-baseline': [true, { available: 'newly' }],
20
+ 'plugin/use-logical-properties-and-values': [true, { severity: 'error' }],
21
+ 'plugin/use-logical-units': [true, { severity: 'error' }],
22
+ 'selector-max-compound-selectors': 1
23
+ }
24
+ }