arui-presets-lint 8.1.0 → 8.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
@@ -63,6 +63,7 @@
63
63
  Для запуска eslint/stylelint рекомендуется использовать флаг [--max-warnings](https://eslint.org/docs/latest/user-guide/command-line-interface#--max-warnings), который позволяет ограничить количество возникающих предупреждений.
64
64
 
65
65
  Пример такой конфигурации:
66
+
66
67
  ```json
67
68
  {
68
69
  "scripts": {
@@ -89,25 +90,24 @@ extends:
89
90
  extends:
90
91
  - ./node_modules/arui-presets-lint/lefthook/index.yml
91
92
 
92
- # Добавить сборку typescript на pre-commit:
93
93
  pre-commit:
94
94
  commands:
95
+ # Добавить сборку typescript на pre-commit:
95
96
  check-ts:
96
97
  run: npx --no-install tsc --noEmit
97
98
 
98
- # Запустить тесты, относящиеся к измененному файлу:
99
+ # Запустить тесты, относящиеся к измененному файлу:
99
100
  run-tests:
100
101
  glob: '*.{js,ts,jsx,tsx,mts,mjs,cjs,cts}'
101
102
  run: npx --no-install jest --findRelatedTests --passWithNoTests {staged_files}
102
103
 
103
- # Запустить команду 'lint' на pre-push:
104
104
  pre-push:
105
105
  commands:
106
+ # Запустить команду 'lint' на pre-push:
106
107
  run-lint:
107
108
  run: yarn lint
108
109
  ```
109
110
 
110
-
111
111
  ## Гибкая конфигурация
112
112
 
113
113
  Так как `yarn run` в yarn 2+ не поддерживает возможность запускать бинарные файлы, которые не установлены как прямые зависимости, а `yarn dlx` не умеет запускать бинарники без скачивания его из npm, существует возможность это сделать через вызов `npx --no-install ...`:
@@ -126,13 +126,16 @@ npx --no-install eslint "**/*.{js,jsx}" --ext .js,.jsx --ignore-pattern=.gitigno
126
126
  Таким образом можно гибко настраивать поведение линтеров для вашего проекта, если по какой-то причине стандартная конфигурация вам не подходит.
127
127
 
128
128
  ## Дебаг
129
+
129
130
  Если нужно увидеть в консоли чему именно соответствует алиас в cli-утилите, нужно запустить arui-presets-lint с флагом --echo, например:
131
+
130
132
  ```sh
131
133
  yarn arui-presets-lint --echo format
132
134
  # >> prettier --write "./**/*.{ts,tsx,js,jsx,mjs,mts,cjs,cts,css,json}" --no-error-on-unmatched-pattern --cache
133
135
  ```
134
136
 
135
137
  Если нужно посмотреть, какой именно конфиг применяется в текущем проекте:
138
+
136
139
  ```sh
137
140
  # eslint:
138
141
  npx --no-install eslint --print-config file.tsx > eslintconfig.json
@@ -144,7 +147,6 @@ npx --no-install stylelint --print-config file.css > stylelintconfig.json
144
147
  npx --no-install commitlint --print-config > commitlintconfig.txt
145
148
  ```
146
149
 
147
-
148
150
  ## Настройка IDE:
149
151
 
150
152
  1. Включить ESLint
@@ -1,22 +1,26 @@
1
1
  # Гид по миграции на arui-presets-lint@8
2
2
 
3
3
  ## Введение
4
+
4
5
  Обновление содержит в себе множество изменений, которые позволяют работать с конфигурацией линтеров в проектах проще. Ключевые изменения:
5
- - Поставляется готовая конфигурация lefthook - инструмента, который заменяет lint-staged и husky
6
- - Больше никаких peer dependency - работа с ними вызывала боль, инструменты по их автоматической установке не работают в yarn 4. Никто больше не сможет сломать вашу конфигурацию случайным поднятием зависимости
7
- - CLI для запуска команд позволяет не писать копипасту в каждом проекте
8
- - Новые решения гибкие - возможность писать собственные команды остается, как и возможность расширить конфигурацию lefthook (см [README](./README.md))
6
+
7
+ - Поставляется готовая конфигурация lefthook - инструмента, который заменяет lint-staged и husky
8
+ - Больше никаких peer dependency - работа с ними вызывала боль, инструменты по их автоматической установке не работают в yarn 4. Никто больше не сможет сломать вашу конфигурацию случайным поднятием зависимости
9
+ - CLI для запуска команд позволяет не писать копипасту в каждом проекте
10
+ - Новые решения гибкие - возможность писать собственные команды остается, как и возможность расширить конфигурацию lefthook (см [README](./README.md))
9
11
 
10
12
  1. Для начала нужно выполнить команду:
11
13
 
12
14
  ```bash
13
15
  yarn remove eslint eslint-config-airbnb eslint-config-airbnb-typescript eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-cypress eslint-plugin-dirnames eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort eslint-plugin-unicorn lint-staged prettier stylelint @typescript-eslint/parser @typescript-eslint/eslint-plugin stylelint-config-prettier husky kebab-case @commitlint/cli @commitlint/config-conventional
14
16
  ```
17
+
15
18
  -- отмечу, что никаких зависимостей с плагинами stylelint/eslint в проекте быть не должно, кроме тех, которые использует ваш локальный конфиг
16
19
 
17
- 2. Удалить конфигурации husky и lint-staged (могут находится в .husky, .huskyrc.js, package.json.husky, .lintstagedrc.js, package.json.lint-staged, итп)
20
+ 2. Удалить конфигурации husky и lint-staged (могут находится в .husky, .huskyrc.js, package.json.husky, .lintstagedrc.js, package.json.lint-staged, итп). Для husky 5+ нужно также удалить настройку `hooksPath = .husky` из `git/config`.
18
21
 
19
22
  3. Добавить в lefthook.yml следующее:
23
+
20
24
  ```yml
21
25
  extends:
22
26
  - ./node_modules/arui-presets-lint/lefthook/index.yml
@@ -28,29 +32,30 @@ extends:
28
32
  extends:
29
33
  - ./node_modules/arui-presets-lint/lefthook/index.yml
30
34
 
31
- # Добавить сборку typescript на pre-commit:
32
35
  pre-commit:
33
36
  commands:
37
+ # Добавить сборку typescript на pre-commit:
34
38
  check-ts:
35
39
  run: npx --no-install tsc --noEmit
36
40
 
37
- # Запустить тесты, относящиеся к измененному файлу:
41
+ # Запустить тесты, относящиеся к измененному файлу:
38
42
  run-tests:
39
43
  glob: '*.{js,ts,jsx,tsx,mts,mjs,cjs,cts}'
40
44
  run: npx --no-install jest --findRelatedTests --passWithNoTests {staged_files}
41
45
 
42
- # Запустить команду 'lint' на pre-push:
43
46
  pre-push:
44
47
  commands:
48
+ # Запустить команду 'lint' на pre-push:
45
49
  run-lint:
46
50
  run: yarn lint
47
51
  ```
48
52
 
49
-
50
53
  4. Выполнить следующую команду:
54
+
51
55
  ```
52
56
  npx --no-install lefthook install
53
57
  ```
58
+
54
59
  чтобы установить новую конфигурацию git-hooks. Отмечу, что в библиотеке lefthook есть скрипт, который делает это автоматически при каждой установке библиотеки arui-presets-lint.
55
60
 
56
61
  5. Поменять команды для запуска в package.json.scripts, они должны выглядить следующим образом:
@@ -68,16 +73,16 @@ npx --no-install lefthook install
68
73
  }
69
74
  ```
70
75
 
71
- 6. Выполнить команду ```yarn lint:fix```, и исправить возникающие ошибки
76
+ 6. Выполнить команду `yarn lint:fix`, и исправить возникающие ошибки
72
77
 
73
78
  ## Возможные проблемы и способы их решения:
74
79
 
75
80
  > Q: Получаю ошибку `node_modules/.bin/prettier: Permission denied`
76
81
 
77
82
  > A: Это плавающая проблема с установкой библиотеки prettier, которая решается командой: `chmod +x ./node_modules/.bin/prettier`
78
- Происходит такое только на системах macOS [issue](https://github.com/prettier/prettier/issues/15164)
83
+ > Происходит такое только на системах macOS [issue](https://github.com/prettier/prettier/issues/15164)
79
84
 
80
85
  > Q: Отображается warning при изменении файла, который не должен проверятся eslint:
81
- `0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to disable file ignore settings or use "--no-warn-ignored" to suppress this warning.`
86
+ > `0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to disable file ignore settings or use "--no-warn-ignored" to suppress this warning.`
82
87
 
83
88
  > A: Это ожидаемое поведение, eslint не будет пытаться изменить файл. Warning будет отключен в рамках [issue](https://github.com/core-ds/arui-presets-lint/issues/28), следите за обновлениями
package/cli/index.mjs CHANGED
@@ -18,7 +18,6 @@ const enableEcho = process.argv[2] === '--echo';
18
18
  const command = enableEcho ? process.argv[3] : process.argv[2];
19
19
 
20
20
  if (!command || !commands.includes(command)) {
21
- // eslint-disable-next-line no-console
22
21
  console.error(`Please specify one of available commands: ${commands.join(' ')}`);
23
22
 
24
23
  process.exit(-1);
@@ -29,7 +28,6 @@ const args = enableEcho ? process.argv.slice(4) : process.argv.slice(3);
29
28
  const exec = [commandsMap[command], ...args].join(' ');
30
29
 
31
30
  if (enableEcho) {
32
- // eslint-disable-next-line no-console
33
31
  console.log('>>', exec);
34
32
  }
35
33
 
@@ -40,7 +38,6 @@ try {
40
38
  stdio: ['pipe', 'inherit', 'inherit'],
41
39
  });
42
40
  } catch (error) {
43
- // eslint-disable-next-line no-console
44
41
  console.error(error.message);
45
42
  process.exit(error.exitCode);
46
43
  }
@@ -14,7 +14,6 @@ pre-commit:
14
14
  glob: '*.{json}'
15
15
  run: npx --no-install prettier --write {staged_files} --cache && git add {staged_files}
16
16
  commit-msg:
17
- parallel: true
18
17
  commands:
19
18
  commitlint:
20
19
  run: npx --no-install commitlint --edit {1}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "arui-presets-lint",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Config files for arui-apps",
5
5
  "author": "core-ds contributors",
6
6
  "license": "MIT",
7
7
  "bin": "./cli/index.mjs",
8
8
  "dependencies": {
9
- "@alfalab/stylelint-core-vars": "1.7.0",
9
+ "@alfalab/stylelint-core-vars": "1.7.1",
10
10
  "@commitlint/cli": "18.4.4",
11
11
  "@commitlint/config-conventional": "18.4.4",
12
12
  "@typescript-eslint/eslint-plugin": "7.18.0",
@@ -23,18 +23,18 @@
23
23
  "eslint-plugin-react": "7.37.2",
24
24
  "eslint-plugin-react-hooks": "4.6.2",
25
25
  "eslint-plugin-simple-import-sort": "12.1.1",
26
- "eslint-plugin-unicorn": "56.0.0",
26
+ "eslint-plugin-unicorn": "56.0.1",
27
27
  "execa": "9.5.1",
28
28
  "kebab-case": "1.0.0",
29
- "lefthook": "1.8.2",
29
+ "lefthook": "1.8.4",
30
30
  "prettier": "3.3.3",
31
- "stylelint": "16.10.0"
31
+ "stylelint": "16.11.0"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=18.12.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@alfalab/core-components": "47.25.0",
37
+ "@alfalab/core-components": "48.3.0",
38
38
  "@semantic-release/changelog": "6.0.3",
39
39
  "@semantic-release/commit-analyzer": "11.1.0",
40
40
  "@semantic-release/git": "10.0.1",
@@ -68,11 +68,12 @@
68
68
  "test/**/*"
69
69
  ]
70
70
  }
71
- ]
71
+ ],
72
+ "no-console": "off"
72
73
  }
73
74
  },
74
75
  "commitlint": {
75
76
  "extends": "./commitlint"
76
77
  },
77
- "packageManager": "yarn@4.5.1"
78
+ "packageManager": "yarn@4.5.3"
78
79
  }