@itcase/lint 1.0.4 → 1.0.6
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/eslint/index.js +24 -2
- package/package.json +1 -1
- package/readme.md +15 -9
package/eslint/index.js
CHANGED
|
@@ -164,10 +164,32 @@ const eslintConfig = [
|
|
|
164
164
|
},
|
|
165
165
|
],
|
|
166
166
|
|
|
167
|
-
//
|
|
167
|
+
// Union types
|
|
168
|
+
'perfectionist/sort-union-types': [
|
|
169
|
+
'error',
|
|
170
|
+
{
|
|
171
|
+
type: 'natural',
|
|
172
|
+
order: 'asc',
|
|
173
|
+
groups: [
|
|
174
|
+
'conditional',
|
|
175
|
+
'function',
|
|
176
|
+
'import',
|
|
177
|
+
'keyword',
|
|
178
|
+
'literal',
|
|
179
|
+
'named',
|
|
180
|
+
'object',
|
|
181
|
+
'operator',
|
|
182
|
+
'tuple',
|
|
183
|
+
'union',
|
|
184
|
+
'nullish',
|
|
185
|
+
'unknown',
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
|
|
190
|
+
// Maps, Enum, Intersection types
|
|
168
191
|
'perfectionist/sort-maps': ['error', { type: 'natural', order: 'asc' }],
|
|
169
192
|
'perfectionist/sort-enums': ['error', { type: 'natural', order: 'asc' }],
|
|
170
|
-
'perfectionist/sort-union-types': ['error', { type: 'natural', order: 'asc' }],
|
|
171
193
|
'perfectionist/sort-intersection-types': ['error', { type: 'natural', order: 'asc' }],
|
|
172
194
|
},
|
|
173
195
|
},
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -20,6 +20,17 @@ import eslint from '@itcase/lint/eslint/index.js'
|
|
|
20
20
|
export default eslint
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## ESLint with MobX
|
|
24
|
+
|
|
25
|
+
Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import eslint from '@itcase/lint/eslint/index.js'
|
|
29
|
+
import eslintMobx from '@itcase/lint/eslint/mobx/index.js'
|
|
30
|
+
|
|
31
|
+
export default [...eslint, ...eslintMobx]
|
|
32
|
+
```
|
|
33
|
+
|
|
23
34
|
## Stylelint
|
|
24
35
|
|
|
25
36
|
Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
|
|
@@ -31,13 +42,13 @@ export default {
|
|
|
31
42
|
```
|
|
32
43
|
|
|
33
44
|
## Prettier
|
|
45
|
+
|
|
34
46
|
Create a `prettier.config.mjs` configuration file in the root of your project with the following content:
|
|
35
47
|
|
|
36
48
|
```js
|
|
37
49
|
import prettier from '@itcase/lint/prettier/index.js'
|
|
38
50
|
|
|
39
51
|
export default prettier
|
|
40
|
-
|
|
41
52
|
```
|
|
42
53
|
|
|
43
54
|
## git-hook
|
|
@@ -52,14 +63,9 @@ npm i -D husky lint-staged
|
|
|
52
63
|
|
|
53
64
|
```json
|
|
54
65
|
{
|
|
55
|
-
"*.css": [
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
"*.(js|jsx|ts|tsx)": [
|
|
59
|
-
"npx eslint --fix"
|
|
60
|
-
]
|
|
66
|
+
"*.css": ["npx stylelint --fix"],
|
|
67
|
+
"*.(js|jsx|ts|tsx)": ["npx eslint --fix"]
|
|
61
68
|
}
|
|
62
|
-
|
|
63
69
|
```
|
|
64
70
|
|
|
65
71
|
3. Add **pre-commit** hook in `.husky/pre-commit`
|
|
@@ -71,4 +77,4 @@ if grep --include=*.{json,css,html} --exclude-dir={dist,node_modules,bower_compo
|
|
|
71
77
|
echo 'Fix conflicts'
|
|
72
78
|
exit 1
|
|
73
79
|
else ./node_modules/lint-staged/bin/lint-staged.js; fi
|
|
74
|
-
```
|
|
80
|
+
```
|