eslint-config-mgz 1.0.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 +288 -0
- package/base.js +49 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# eslint-config-mgz
|
|
2
|
+
|
|
3
|
+
Shared ESLint configuration for React + TypeScript projects
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🇷🇺 Русский
|
|
8
|
+
|
|
9
|
+
### 📦 Описание
|
|
10
|
+
|
|
11
|
+
`eslint-config-mgz` — это переиспользуемая конфигурация ESLint
|
|
12
|
+
для frontend проектов с React и TypeScript:
|
|
13
|
+
|
|
14
|
+
- ✅ **TypeScript** поддержка с `@typescript-eslint`
|
|
15
|
+
- ✅ **React** правила и хуки
|
|
16
|
+
- ✅ **Import** правила для модулей
|
|
17
|
+
- ✅ **JSX accessibility** проверки
|
|
18
|
+
- ✅ **Prettier** интеграция (отключает конфликтующие правила)
|
|
19
|
+
|
|
20
|
+
Цель пакета — стандартизировать линтинг во всех проектах и обеспечить качество кода.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### 📂 Содержимое пакета
|
|
25
|
+
|
|
26
|
+
| Файл | Назначение |
|
|
27
|
+
| --------- | ------------------------------ |
|
|
28
|
+
| `base.js` | Основная конфигурация ESLint |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### 🚀 Установка
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
yarn add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 🧩 Использование
|
|
49
|
+
|
|
50
|
+
#### В .eslintrc.js
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
module.exports = {
|
|
54
|
+
extends: ["eslint-config-mgz"],
|
|
55
|
+
parserOptions: {
|
|
56
|
+
project: "./tsconfig.json",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### В .eslintrc.json
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"extends": ["eslint-config-mgz"],
|
|
66
|
+
"parserOptions": {
|
|
67
|
+
"project": "./tsconfig.json"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### С дополнительными правилами
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
module.exports = {
|
|
76
|
+
extends: ["eslint-config-mgz"],
|
|
77
|
+
rules: {
|
|
78
|
+
// Ваши дополнительные правила
|
|
79
|
+
"no-console": "warn",
|
|
80
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
81
|
+
},
|
|
82
|
+
parserOptions: {
|
|
83
|
+
project: "./tsconfig.json",
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 🧠 Включенные правила
|
|
91
|
+
|
|
92
|
+
#### **ESLint Recommended**
|
|
93
|
+
- Базовые правила JavaScript
|
|
94
|
+
|
|
95
|
+
#### **TypeScript ESLint**
|
|
96
|
+
- Правила для TypeScript кода
|
|
97
|
+
- Строгая типизация
|
|
98
|
+
- Лучшие практики TS
|
|
99
|
+
|
|
100
|
+
#### **React ESLint**
|
|
101
|
+
- Правила для React компонентов
|
|
102
|
+
- React Hooks правила
|
|
103
|
+
- JSX правила
|
|
104
|
+
|
|
105
|
+
#### **Import ESLint**
|
|
106
|
+
- Правила импортов модулей
|
|
107
|
+
- Проверка путей импорта
|
|
108
|
+
|
|
109
|
+
#### **JSX Accessibility**
|
|
110
|
+
- Доступность JSX элементов
|
|
111
|
+
- WCAG рекомендации
|
|
112
|
+
|
|
113
|
+
#### **Prettier Integration**
|
|
114
|
+
- Отключение конфликтующих правил
|
|
115
|
+
- Совместимость с prettier
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### ⚠️ Важные нюансы
|
|
120
|
+
|
|
121
|
+
- **Peer dependencies**: Все плагины нужно устанавливать отдельно
|
|
122
|
+
- **TypeScript**: Требуется `tsconfig.json` для parserOptions.project
|
|
123
|
+
- **React**: Автоматически определяет версию React
|
|
124
|
+
- **Prettier**: Рекомендуется использовать вместе с prettier-config-mgz
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### ❓ Возможные вопросы
|
|
129
|
+
|
|
130
|
+
**Нужен ли tsconfig.json?**
|
|
131
|
+
Да, для правильной работы TypeScript правил нужен файл tsconfig.json.
|
|
132
|
+
|
|
133
|
+
**Можно ли переопределять правила?**
|
|
134
|
+
Да, добавляйте свои правила в локальном .eslintrc файле.
|
|
135
|
+
|
|
136
|
+
**Почему некоторые правила отключены?**
|
|
137
|
+
Некоторые правила отключены намеренно для гибкости или из-за конфликтов с другими инструментами.
|
|
138
|
+
|
|
139
|
+
## 🇬🇧 English
|
|
140
|
+
|
|
141
|
+
### 📦 Description
|
|
142
|
+
|
|
143
|
+
`eslint-config-mgz` is a shared ESLint configuration
|
|
144
|
+
for frontend projects with React and TypeScript:
|
|
145
|
+
|
|
146
|
+
- ✅ **TypeScript** support with `@typescript-eslint`
|
|
147
|
+
- ✅ **React** rules and hooks
|
|
148
|
+
- ✅ **Import** rules for modules
|
|
149
|
+
- ✅ **JSX accessibility** checks
|
|
150
|
+
- ✅ **Prettier** integration (disables conflicting rules)
|
|
151
|
+
|
|
152
|
+
The goal is to standardize linting across all projects and ensure code quality.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 📂 Package contents
|
|
157
|
+
|
|
158
|
+
| File | Purpose |
|
|
159
|
+
| --------- | ------------------------- |
|
|
160
|
+
| `base.js` | Main ESLint configuration |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### 🚀 Installation
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
npm install -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### 🧩 Usage
|
|
173
|
+
|
|
174
|
+
#### In .eslintrc.js
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
module.exports = {
|
|
178
|
+
extends: ["eslint-config-mgz"],
|
|
179
|
+
parserOptions: {
|
|
180
|
+
project: "./tsconfig.json",
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### With additional rules
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
module.exports = {
|
|
189
|
+
extends: ["eslint-config-mgz"],
|
|
190
|
+
rules: {
|
|
191
|
+
// Your additional rules
|
|
192
|
+
"no-console": "warn",
|
|
193
|
+
},
|
|
194
|
+
parserOptions: {
|
|
195
|
+
project: "./tsconfig.json",
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### ⚠️ Important notes
|
|
203
|
+
|
|
204
|
+
- **Peer dependencies**: All plugins must be installed separately
|
|
205
|
+
- **TypeScript**: Requires `tsconfig.json` for parserOptions.project
|
|
206
|
+
- **React**: Automatically detects React version
|
|
207
|
+
- **Prettier**: Recommended to use with prettier-config-mgz
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### ❓ Possible questions
|
|
212
|
+
|
|
213
|
+
**Is tsconfig.json required?**
|
|
214
|
+
Yes, needed for proper TypeScript rules functioning.
|
|
215
|
+
|
|
216
|
+
**Can rules be overridden?**
|
|
217
|
+
Yes, add your rules in local .eslintrc file.
|
|
218
|
+
|
|
219
|
+
**Why are some rules disabled?**
|
|
220
|
+
Some rules are intentionally disabled for flexibility or due to conflicts with other tools.
|
|
221
|
+
|
|
222
|
+
## 🇰🇿 Қазақша
|
|
223
|
+
|
|
224
|
+
### 📦 Сипаттама
|
|
225
|
+
|
|
226
|
+
`eslint-config-mgz` — React және TypeScript жобалары үшін
|
|
227
|
+
қайта қолданылатын ESLint конфигурациясы:
|
|
228
|
+
|
|
229
|
+
- ✅ **TypeScript** `@typescript-eslint` арқылы қолдау
|
|
230
|
+
- ✅ **React** ережелері және хуктары
|
|
231
|
+
- ✅ **Import** модульдердің ережелері
|
|
232
|
+
- ✅ **JSX accessibility** тексерулері
|
|
233
|
+
- ✅ **Prettier** интеграциясы (қайшы келетін ережелерді өшіру)
|
|
234
|
+
|
|
235
|
+
Мақсаты — барлық жобаларда линтингті стандарттау және код сапасын қамтамасыз ету.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### 📂 Пакет құрамында
|
|
240
|
+
|
|
241
|
+
| Файл | Мақсаты |
|
|
242
|
+
| --------- | ----------------------- |
|
|
243
|
+
| `base.js` | Негізгі ESLint конфигі |
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
### 🚀 Орнату
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npm install -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
### 🧩 Қолдану
|
|
256
|
+
|
|
257
|
+
#### .eslintrc.js ішінде
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
module.exports = {
|
|
261
|
+
extends: ["eslint-config-mgz"],
|
|
262
|
+
parserOptions: {
|
|
263
|
+
project: "./tsconfig.json",
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### ⚠️ Маңызды ескертулер
|
|
271
|
+
|
|
272
|
+
- **Peer dependencies**: Барлық плагиндерді бөлек орнату қажет
|
|
273
|
+
- **TypeScript**: parserOptions.project үшін tsconfig.json қажет
|
|
274
|
+
- **React**: React нұсқасын автоматты түрде анықтайды
|
|
275
|
+
- **Prettier**: prettier-config-mgz бірге қолдану ұсынылады
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### ❓ Мүмкін сұрақтар
|
|
280
|
+
|
|
281
|
+
**tsconfig.json қажет пе?**
|
|
282
|
+
Иә, TypeScript ережелерінің дұрыс жұмысы үшін қажет.
|
|
283
|
+
|
|
284
|
+
**Ережелерді өзгертуге бола ма?**
|
|
285
|
+
Иә, жергілікті .eslintrc файлында өз ережелеріңізді қосыңыз.
|
|
286
|
+
|
|
287
|
+
**Неге кейбір ережелер өшірілген?**
|
|
288
|
+
Кейбір ережелер икемділік үшін немесе басқа құралдармен қайшылықтар салдарынан арнайы өшірілген.
|
package/base.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: "@typescript-eslint/parser",
|
|
3
|
+
extends: [
|
|
4
|
+
"eslint:recommended",
|
|
5
|
+
"plugin:react/recommended",
|
|
6
|
+
"plugin:react-hooks/recommended",
|
|
7
|
+
"plugin:import/recommended",
|
|
8
|
+
"plugin:jsx-a11y/recommended",
|
|
9
|
+
"plugin:@typescript-eslint/recommended",
|
|
10
|
+
"eslint-config-prettier",
|
|
11
|
+
],
|
|
12
|
+
settings: {
|
|
13
|
+
react: {
|
|
14
|
+
version: "detect",
|
|
15
|
+
},
|
|
16
|
+
"import/resolver": {
|
|
17
|
+
node: {
|
|
18
|
+
paths: ["src"],
|
|
19
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
plugins: ["@typescript-eslint"],
|
|
24
|
+
rules: {
|
|
25
|
+
"no-alert": "error",
|
|
26
|
+
"no-console": "error",
|
|
27
|
+
"no-undef-init": "error",
|
|
28
|
+
"no-undefined": "error",
|
|
29
|
+
"no-var": "error",
|
|
30
|
+
"no-inline-comments": "off",
|
|
31
|
+
"no-use-before-define": "off",
|
|
32
|
+
"import/no-unresolved": "off",
|
|
33
|
+
"react/react-in-jsx-scope": "off",
|
|
34
|
+
"react/display-name": "off",
|
|
35
|
+
"react/no-array-index-key": "warn",
|
|
36
|
+
"no-duplicate-imports": "warn",
|
|
37
|
+
"jsx-a11y/no-autofocus": "off",
|
|
38
|
+
"jsx-a11y/anchor-has-content": "off",
|
|
39
|
+
"jsx-a11y/heading-has-content": "off",
|
|
40
|
+
"react/prop-types": "off",
|
|
41
|
+
"react/no-unknown-property": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
ignore: ["cmdk-input-wrapper", "cmdk-empty"],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
"import/named": "off",
|
|
48
|
+
},
|
|
49
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-config-mgz",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Shared ESLint config for React + TypeScript projects",
|
|
5
|
+
"main": "base.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"README.md",
|
|
8
|
+
"base.js"
|
|
9
|
+
],
|
|
10
|
+
"readme": "README.md",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"eslint",
|
|
13
|
+
"typescript",
|
|
14
|
+
"react",
|
|
15
|
+
"shared-config"
|
|
16
|
+
],
|
|
17
|
+
"author": "DSRC TEAM",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"eslint": "^8.0.0",
|
|
21
|
+
"eslint-plugin-react": "^7.0.0",
|
|
22
|
+
"eslint-plugin-react-hooks": "^4.0.0",
|
|
23
|
+
"eslint-plugin-import": "^2.0.0",
|
|
24
|
+
"eslint-plugin-jsx-a11y": "^6.0.0",
|
|
25
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
27
|
+
"eslint-config-prettier": "^9.0.0"
|
|
28
|
+
}
|
|
29
|
+
}
|