arui-presets-lint 6.0.1 → 6.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/.prettierignore +1 -0
- package/CHANGELOG.md +15 -0
- package/MIGRATION_GUIDE_V6.md +6 -4
- package/README.md +26 -31
- package/eslint/index.js +4 -0
- package/package.json +6 -4
- package/release.config.js +7 -4
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CHANGELOG.md
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# 6.2.0 (2023-05-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **eslint:** forbid import of lodash 7df02af
|
|
7
|
+
|
|
8
|
+
# 6.1.0 (2022-12-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* dump stylelint-core-vars fafcdfd
|
|
14
|
+
* separate lint and format, remove incremental false from husky 75d15b9
|
|
15
|
+
|
|
1
16
|
## 6.0.1 (2022-07-27)
|
|
2
17
|
|
|
3
18
|
|
package/MIGRATION_GUIDE_V6.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Для успешной миграции на v6 с более ранних версий нужно:
|
|
2
2
|
|
|
3
|
-
1. Проверить, что в проекте стоит версия nodejs не ниже 12.
|
|
3
|
+
1. Проверить, что в проекте стоит версия nodejs не ниже 12.22.0 / 14.17.0.
|
|
4
4
|
|
|
5
5
|
2. Удалить более неиспользуемые зависимости:
|
|
6
|
+
|
|
6
7
|
```sh
|
|
7
8
|
yarn remove prettier-eslint prettier-eslint-cli eslint-plugin-prettier
|
|
8
9
|
```
|
|
@@ -10,11 +11,12 @@
|
|
|
10
11
|
3. Добавить текущие зависимости [README.md](README.md)(##Установка)
|
|
11
12
|
|
|
12
13
|
4. Заменить вызовы prettier-eslint на prettier:
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
- в lint-staged [README.md](README.md)(## Конфигурация `husky` и `lint-staged`)
|
|
16
|
+
- в скриптах package.json [README.md](README.md)(## Конфигурация скриптов для запуска линтеров и форматтера в `package.json`)
|
|
15
17
|
|
|
16
18
|
5. (Опционально) Поменять подключаемый конфиг [README.md](README.md)(## Конфигурация всех линтеров через `package.json`). Что изменилось: в `eslintConfig.extends` больше не нужно писать `/index.js` в конце, а `commitlint.extends` теперь может быть строкой, а не массивом.
|
|
17
19
|
|
|
18
|
-
6. Выполнить команду `yarn format` и поправить возникающие ошибки (предупреждения в моменте править не обязательно, если не включен --max-warnings=0).
|
|
20
|
+
6. Выполнить команду `yarn format`, затем `yarn lint:fix` и поправить возникающие ошибки (предупреждения в моменте править не обязательно, если не включен --max-warnings=0).
|
|
19
21
|
|
|
20
22
|
7. Сообщить остальным людям которые работают с проектом, что нужно доустановить зависимости (`yarn install`) и перенастроить IDE [README.md](README.md)(## Настройка IDE)
|
package/README.md
CHANGED
|
@@ -17,15 +17,18 @@
|
|
|
17
17
|
Переходите с версии ниже чем 6.0.0? [Прочтите](MIGRATION_GUIDE_V6.md)
|
|
18
18
|
|
|
19
19
|
## Релизы
|
|
20
|
+
|
|
20
21
|
Данный проект использует [semantic-release](https://semantic-release.gitbook.io/semantic-release/).
|
|
21
22
|
|
|
22
23
|
Релизы публикуются руками. Если вам нужно выпустить новую версию библиотеки - выполните следующие действия (а лучше прикрутите сюда нормальный ci):
|
|
24
|
+
|
|
23
25
|
```
|
|
24
26
|
yarn --immutable
|
|
25
27
|
yarn semantic-release --no-ci
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
## Установка
|
|
31
|
+
|
|
29
32
|
Для установки всех зависимостей проекта рекомендуется использовать [install-peerdeps](https://github.com/nathanhleung/install-peerdeps)
|
|
30
33
|
|
|
31
34
|
```sh
|
|
@@ -63,19 +66,21 @@ yarn info arui-presets-lint peerDependencies
|
|
|
63
66
|
```json
|
|
64
67
|
{
|
|
65
68
|
"scripts": {
|
|
66
|
-
"lint:css": "stylelint
|
|
69
|
+
"lint:css": "stylelint **/*.css",
|
|
67
70
|
"lint:scripts": "eslint \"**/*.{js,jsx,ts,tsx}\" --ext .js,.jsx,.ts,.tsx",
|
|
68
71
|
"lint": "yarn lint:css && yarn lint:scripts",
|
|
69
72
|
"lint:fix": "yarn lint:scripts --fix && yarn lint:css --fix",
|
|
70
|
-
"format": "prettier --
|
|
73
|
+
"format": "prettier --write \"./**/*.{ts,tsx,js,jsx,css,json,md}\""
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
```
|
|
74
77
|
|
|
75
|
-
Если eslint
|
|
76
|
-
их с помощью [.eslintignore](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code#the-eslintignore-file)
|
|
78
|
+
Если eslint/stylelint/prettier затрагивают файлы, над которыми вы не имеете контроль, вы можете исключить
|
|
79
|
+
их с помощью [.eslintignore](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code#the-eslintignore-file) / [.stylelintignore](https://stylelint.io/user-guide/ignore-code/#files-entirely) / [.prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
> ⚠️ Внимание, .eslintignore [по умолчанию не подтягиватся в lint-staged](https://github.com/okonet/lint-staged#how-can-i-ignore-files-from-eslintignore)!
|
|
82
|
+
|
|
83
|
+
Для запуска eslint/stylelint рекомендуется использовать флаг [--max-warnings](https://eslint.org/docs/latest/user-guide/command-line-interface#--max-warnings), который позволяет ограничить количество возникающих предупреждений.
|
|
79
84
|
|
|
80
85
|
## Конфигурация `husky` и `lint-staged`:
|
|
81
86
|
|
|
@@ -88,32 +93,25 @@ yarn info arui-presets-lint peerDependencies
|
|
|
88
93
|
}
|
|
89
94
|
},
|
|
90
95
|
"lint-staged": {
|
|
91
|
-
"*.{js,jsx,ts,tsx}": [
|
|
92
|
-
"prettier --write",
|
|
93
|
-
"eslint",
|
|
94
|
-
"yarn jest --findRelatedTests"
|
|
95
|
-
],
|
|
96
|
+
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint"],
|
|
96
97
|
"*.css": ["prettier --write", "stylelint"],
|
|
97
|
-
"*.json": ["prettier --write"]
|
|
98
|
-
}
|
|
98
|
+
"*.{json,md}": ["prettier --write"]
|
|
99
|
+
}
|
|
99
100
|
}
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Также в lint-staged можно добавить флаги `--max-warnings=0` для stylelint и eslint, что не даст сделать коммит при наличии warning-а в коде (по умолчанию блокирует при наличии error).
|
|
105
|
-
|
|
103
|
+
Также рекомендуется изменить вызов husky.hooks.pre-commit на `tsc --noEmit && lint-staged` для дополнительной проверки кода на ошибки typescript и добавить запуск юнит-тестов `jest --findRelatedTests` в lint-staged (последним шагом для скриптовых файлов).
|
|
106
104
|
|
|
107
105
|
## Итоговая конфигурация линтеров
|
|
108
106
|
|
|
109
107
|
```json
|
|
110
108
|
{
|
|
111
109
|
"scripts": {
|
|
112
|
-
"lint:css": "stylelint
|
|
110
|
+
"lint:css": "stylelint **/*.css",
|
|
113
111
|
"lint:scripts": "eslint \"**/*.{js,jsx,ts,tsx}\" --ext .js,.jsx,.ts,.tsx",
|
|
114
112
|
"lint": "yarn lint:css && yarn lint:scripts",
|
|
115
113
|
"lint:fix": "yarn lint:scripts --fix && yarn lint:css --fix",
|
|
116
|
-
"format": "prettier --
|
|
114
|
+
"format": "prettier --write \"./**/*.{ts,tsx,js,jsx,css,json,md}\""
|
|
117
115
|
},
|
|
118
116
|
"husky": {
|
|
119
117
|
"hooks": {
|
|
@@ -122,27 +120,24 @@ yarn info arui-presets-lint peerDependencies
|
|
|
122
120
|
}
|
|
123
121
|
},
|
|
124
122
|
"lint-staged": {
|
|
125
|
-
"*.{js,jsx,ts,tsx}": [
|
|
126
|
-
"prettier --write",
|
|
127
|
-
"eslint",
|
|
128
|
-
"yarn jest --findRelatedTests"
|
|
129
|
-
],
|
|
123
|
+
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint"],
|
|
130
124
|
"*.css": ["prettier --write", "stylelint"],
|
|
131
|
-
"*.json": ["prettier --write"]
|
|
132
|
-
}
|
|
125
|
+
"*.{json,md}": ["prettier --write"]
|
|
126
|
+
}
|
|
133
127
|
}
|
|
134
128
|
```
|
|
135
129
|
|
|
136
130
|
## Настройка IDE:
|
|
131
|
+
|
|
137
132
|
1. Включить ESLint
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
- [Расширение для VS Code](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
134
|
+
- [Инструкция для Webstorm](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_activate)
|
|
140
135
|
2. Включить Stylelint
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
- [Расширение для VS Code](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
|
|
137
|
+
- [Инструкция для Webstorm](https://www.jetbrains.com/help/webstorm/using-stylelint-code-quality-tool.html#ws_stylelint_configure)
|
|
143
138
|
3. Включить Prettier
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
- [Расширение для VS Code](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
140
|
+
- [Инструкция для Webstorm](https://prettier.io/docs/en/webstorm.html)
|
|
146
141
|
|
|
147
142
|
## Лицензия
|
|
148
143
|
|
package/eslint/index.js
CHANGED
|
@@ -171,6 +171,10 @@ module.exports = {
|
|
|
171
171
|
},
|
|
172
172
|
],
|
|
173
173
|
'import/no-import-module-exports': 'off',
|
|
174
|
+
'no-restricted-imports': [
|
|
175
|
+
'error',
|
|
176
|
+
{ name:'lodash', message: 'Please use single imports of lodash functions, e.g `import isEqual from "lodash/isEqual"` instead of `"import { isEqual } from "lodash"`'},
|
|
177
|
+
],
|
|
174
178
|
},
|
|
175
179
|
overrides: [
|
|
176
180
|
{
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arui-presets-lint",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Config files for arui-apps",
|
|
5
5
|
"author": "Good guys from Alfa-Bank",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@alfalab/stylelint-core-vars": "1.
|
|
8
|
+
"@alfalab/stylelint-core-vars": "1.5.0",
|
|
9
9
|
"@commitlint/cli": "16.3.0",
|
|
10
10
|
"@commitlint/config-conventional": "16.2.4",
|
|
11
11
|
"arui-cssvars": "1.2.0",
|
|
@@ -68,14 +68,16 @@
|
|
|
68
68
|
"typescript": "4.4.4"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
|
-
"lint": "eslint ./",
|
|
72
71
|
"precommit": "lint-staged",
|
|
73
72
|
"test": "yarn test:eslint && yarn test:stylelint",
|
|
74
73
|
"test:eslint": "yarn eslint:prettier-conflicts-check && eslint \"./test/**/*.{ts,tsx,js,jsx}\"",
|
|
75
74
|
"test:stylelint": "yarn stylelint:prettier-conflicts-check && node ./test/stylelint-test.js",
|
|
76
75
|
"stylelint:prettier-conflicts-check": "stylelint-config-prettier-check",
|
|
77
76
|
"eslint:prettier-conflicts-check": "eslint-config-prettier ./eslint/index.js",
|
|
78
|
-
"
|
|
77
|
+
"lint:css": "stylelint **/*.css",
|
|
78
|
+
"lint:scripts": "eslint \"**/*.{js,jsx,ts,tsx}\" --ext .js,.jsx,.ts,.tsx",
|
|
79
|
+
"lint:fix": "yarn lint:css --fix && yarn lint:scripts --fix",
|
|
80
|
+
"format": "prettier --write \"./**/*.{ts,tsx,js,jsx,css,json,md}\""
|
|
79
81
|
},
|
|
80
82
|
"lint-staged": {
|
|
81
83
|
"**/*.{js,jsx,ts,tsx,json}": [
|
package/release.config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
plugins: [
|
|
3
3
|
'@semantic-release/commit-analyzer',
|
|
4
|
-
[
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
[
|
|
5
|
+
'@semantic-release/release-notes-generator',
|
|
6
|
+
{
|
|
7
|
+
linkReferences: false,
|
|
8
|
+
linkCompare: false,
|
|
9
|
+
},
|
|
10
|
+
],
|
|
8
11
|
'@semantic-release/changelog',
|
|
9
12
|
'@semantic-release/npm',
|
|
10
13
|
'@semantic-release/git',
|