@itcase/lint 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/readme.md +30 -42
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/lint",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {
@@ -10,6 +10,7 @@
10
10
  "prepare": "husky",
11
11
  "semantic-release": "semantic-release"
12
12
  },
13
+ "type": "module",
13
14
  "license": "MIT",
14
15
  "private": false,
15
16
  "repository": {
package/readme.md CHANGED
@@ -1,72 +1,54 @@
1
1
  # ITCase Lint
2
2
 
3
- Пакет с пресетами конфигураций линтеров.
3
+ Presets of linter configurations
4
4
 
5
- ## Использование
6
-
7
- ### Установка
5
+ ## Installation
8
6
 
9
7
  ```bash
10
8
  $ npm i -D @itcase/lint eslint stylelint prettier
11
9
  ```
12
10
 
13
- ### Конфигурация
14
-
15
- #### С помощью `package.json`
16
-
17
- ```json
18
- {
19
- "prettier": "@itcase/lint/prettier",
20
- "eslintConfig": {
21
- "extends": "./node_modules/@itcase/lint/eslint/index.js"
22
- },
23
- "stylelint": {
24
- "extends": "@itcase/lint/stylelint"
25
- }
26
- }
27
- ```
28
-
29
- #### С помощью отдельных конфигурационных файлов
11
+ ## Usage
30
12
 
31
- ##### ESLint
13
+ ## ESLint
32
14
 
33
- Создать в корне проекта файл `.eslintrc.js` со следующим содержимым:
15
+ Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
34
16
 
35
17
  ```js
36
- module.exports = {
37
- extends: require.resolve('@itcase/lint/eslint'),
38
- };
18
+ import eslint from '@itcase/lint/eslint/index.js'
19
+
20
+ export default eslint
39
21
  ```
40
22
 
41
- ##### Stylelint
23
+ ## Stylelint
42
24
 
43
- Создать в корне проекта файл `stylelint.config.js` со следующим содержимым:
25
+ Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
44
26
 
45
27
  ```js
46
- module.exports = {
47
- extends: require.resolve('@itcase/lint/stylelint'),
48
- };
28
+ export default {
29
+ extends: ['@itcase/lint/stylelint/index.js'],
30
+ }
49
31
  ```
50
32
 
51
- ##### Prettier
52
-
53
- Создать в корне проекта файл `.prettierrc.js` со следующим содержимым:
33
+ ## Prettier
34
+ Create a `prettier.config.mjs` configuration file in the root of your project with the following content:
54
35
 
55
36
  ```js
56
- module.exports = require('@itcase/lint/prettier');
57
- ```
37
+ import prettier from '@itcase/lint/prettier/index.js'
58
38
 
59
- ### Настройка git-хуков
39
+ export default prettier
60
40
 
61
- Удобно использовать `husky` в связке с `lint-staged`, для этого необходимо:
41
+ ```
42
+
43
+ ## git-hook
62
44
 
63
- 1. Установить пакеты
45
+ 1. Use `husky` and `lint-staged`
64
46
 
65
47
  ```bash
66
48
  npm i -D husky lint-staged
67
49
  ```
68
50
 
69
- 2. Создать в корне проекта файл `.lintstagedrc` со следующим содержимым:
51
+ 2. Create a `.lintstagedrc` configuration file in the root of your project with the following content:
70
52
 
71
53
  ```json
72
54
  {
@@ -80,7 +62,13 @@ npm i -D husky lint-staged
80
62
 
81
63
  ```
82
64
 
83
- 3. Добавить **pre-commit** хук согласно документации husky: `npx lint-staged`
65
+ 3. Add **pre-commit** hook in `.husky/pre-commit`
84
66
 
85
- https://typicode.github.io/husky/how-to.html#adding-a-new-hook
67
+ ```bash
68
+ #!/bin/bash
86
69
 
70
+ if grep --include=*.{json,css,html} --exclude-dir={dist,node_modules,bower_components,.git} -nri --color -B 1 -A 1 '<\{7\} HEAD\|^\=\.{7\}\|>\.{7\}' .; then
71
+ echo 'Fix conflicts'
72
+ exit 1
73
+ else ./node_modules/lint-staged/bin/lint-staged.js; fi
74
+ ```