@itcase/lint 1.0.1 → 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.
- package/package.json +1 -1
- package/readme.md +30 -42
package/package.json
CHANGED
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
|
-
|
|
13
|
+
## ESLint
|
|
32
14
|
|
|
33
|
-
|
|
15
|
+
Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
|
|
34
16
|
|
|
35
17
|
```js
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
import eslint from '@itcase/lint/eslint/index.js'
|
|
19
|
+
|
|
20
|
+
export default eslint
|
|
39
21
|
```
|
|
40
22
|
|
|
41
|
-
|
|
23
|
+
## Stylelint
|
|
42
24
|
|
|
43
|
-
|
|
25
|
+
Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
|
|
44
26
|
|
|
45
27
|
```js
|
|
46
|
-
|
|
47
|
-
extends:
|
|
48
|
-
}
|
|
28
|
+
export default {
|
|
29
|
+
extends: ['@itcase/lint/stylelint/index.js'],
|
|
30
|
+
}
|
|
49
31
|
```
|
|
50
32
|
|
|
51
|
-
|
|
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
|
-
|
|
57
|
-
```
|
|
37
|
+
import prettier from '@itcase/lint/prettier/index.js'
|
|
58
38
|
|
|
59
|
-
|
|
39
|
+
export default prettier
|
|
60
40
|
|
|
61
|
-
|
|
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.
|
|
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.
|
|
65
|
+
3. Add **pre-commit** hook in `.husky/pre-commit`
|
|
84
66
|
|
|
85
|
-
|
|
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
|
+
```
|