@itcase/lint 1.0.21 → 1.0.23
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 +21 -138
- package/eslint/perfectionist/index.js +21 -0
- package/eslint/perfectionist/sortClasses.js +28 -0
- package/eslint/perfectionist/sortEnums.js +3 -0
- package/eslint/perfectionist/sortInterfaces.js +16 -0
- package/eslint/perfectionist/sortIntersectionTypes.js +3 -0
- package/eslint/perfectionist/sortJSXProps.js +34 -0
- package/eslint/perfectionist/sortMaps.js +3 -0
- package/eslint/perfectionist/sortObjectTypes.js +11 -0
- package/eslint/perfectionist/sortObjects.js +34 -0
- package/eslint/perfectionist/sortUnionTypes.js +22 -0
- package/package.json +6 -8
package/eslint/index.js
CHANGED
|
@@ -8,8 +8,17 @@ import eslintReact from 'eslint-plugin-react'
|
|
|
8
8
|
import eslintReactHooks from 'eslint-plugin-react-hooks'
|
|
9
9
|
import eslintTypeScript from 'typescript-eslint'
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
sortClasses,
|
|
13
|
+
sortEnums,
|
|
14
|
+
sortInterfaces,
|
|
15
|
+
sortIntersectionTypes,
|
|
16
|
+
sortJSXProps,
|
|
17
|
+
sortMaps,
|
|
18
|
+
sortObjects,
|
|
19
|
+
sortObjectTypes,
|
|
20
|
+
sortUnionTypes,
|
|
21
|
+
} from './perfectionist/index.js'
|
|
13
22
|
|
|
14
23
|
const eslintConfig = [
|
|
15
24
|
eslintJs.configs.recommended,
|
|
@@ -42,7 +51,7 @@ const eslintConfig = [
|
|
|
42
51
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
43
52
|
// Sometimes you need an empty one, for example when extends
|
|
44
53
|
'@typescript-eslint/no-empty-object-type': 'off',
|
|
45
|
-
|
|
54
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
46
55
|
|
|
47
56
|
// react
|
|
48
57
|
// TODO: make rule "react/prop-types" as error only for JS(x) files
|
|
@@ -59,148 +68,22 @@ const eslintConfig = [
|
|
|
59
68
|
'object-shorthand': ['warn', 'consistent'],
|
|
60
69
|
|
|
61
70
|
// Class
|
|
62
|
-
'perfectionist/sort-classes':
|
|
63
|
-
'error',
|
|
64
|
-
{
|
|
65
|
-
type: 'natural',
|
|
66
|
-
order: 'asc',
|
|
67
|
-
groups: [
|
|
68
|
-
'top',
|
|
69
|
-
'index-signature',
|
|
70
|
-
'static-property',
|
|
71
|
-
'private-property',
|
|
72
|
-
'property',
|
|
73
|
-
'constructor',
|
|
74
|
-
'static-method',
|
|
75
|
-
'private-method',
|
|
76
|
-
'get-method',
|
|
77
|
-
'set-method',
|
|
78
|
-
'method',
|
|
79
|
-
],
|
|
80
|
-
customGroups: {
|
|
81
|
-
top: ['id'],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
|
|
71
|
+
'perfectionist/sort-classes': sortClasses,
|
|
86
72
|
// Objects
|
|
87
|
-
'perfectionist/sort-objects':
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
type: 'natural',
|
|
91
|
-
order: 'asc',
|
|
92
|
-
groups: [
|
|
93
|
-
'isMobile',
|
|
94
|
-
'isTablet',
|
|
95
|
-
'isDesktop',
|
|
96
|
-
'id',
|
|
97
|
-
'children',
|
|
98
|
-
...eslintStyleObjects,
|
|
99
|
-
'device',
|
|
100
|
-
'is',
|
|
101
|
-
'unknown',
|
|
102
|
-
'callback',
|
|
103
|
-
],
|
|
104
|
-
customGroups: {
|
|
105
|
-
id: 'id',
|
|
106
|
-
children: 'children',
|
|
107
|
-
isMobile: 'isMobile*',
|
|
108
|
-
isTablet: 'isTablet*',
|
|
109
|
-
isDesktop: 'isDesktop*',
|
|
110
|
-
...eslintStyleObjectsCustomGroups,
|
|
111
|
-
device: 'device',
|
|
112
|
-
is: 'is*',
|
|
113
|
-
callback: 'on*',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
|
|
73
|
+
'perfectionist/sort-objects': sortObjects,
|
|
74
|
+
'perfectionist/sort-object-types': sortObjectTypes,
|
|
118
75
|
// Props
|
|
119
|
-
'perfectionist/sort-jsx-props':
|
|
120
|
-
'error',
|
|
121
|
-
{
|
|
122
|
-
type: 'natural',
|
|
123
|
-
order: 'asc',
|
|
124
|
-
groups: [
|
|
125
|
-
'className',
|
|
126
|
-
'key',
|
|
127
|
-
'ref',
|
|
128
|
-
'name',
|
|
129
|
-
...eslintStyleProps,
|
|
130
|
-
'shorthand',
|
|
131
|
-
'unknown',
|
|
132
|
-
'multiline',
|
|
133
|
-
'is',
|
|
134
|
-
'set',
|
|
135
|
-
'callback',
|
|
136
|
-
],
|
|
137
|
-
customGroups: {
|
|
138
|
-
className: 'className',
|
|
139
|
-
key: 'key',
|
|
140
|
-
ref: 'ref',
|
|
141
|
-
name: 'name',
|
|
142
|
-
...eslintStylePropsCustomGroups,
|
|
143
|
-
is: 'is*',
|
|
144
|
-
callback: 'on*',
|
|
145
|
-
set: ['set*'],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
|
|
150
|
-
// Types
|
|
151
|
-
'perfectionist/sort-object-types': [
|
|
152
|
-
'error',
|
|
153
|
-
{
|
|
154
|
-
type: 'natural',
|
|
155
|
-
order: 'asc',
|
|
156
|
-
groups: ['top'],
|
|
157
|
-
customGroups: { top: 'id' },
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
|
|
76
|
+
'perfectionist/sort-jsx-props': sortJSXProps,
|
|
161
77
|
// Interfaces
|
|
162
|
-
'perfectionist/sort-interfaces':
|
|
163
|
-
'error',
|
|
164
|
-
{
|
|
165
|
-
type: 'natural',
|
|
166
|
-
order: 'asc',
|
|
167
|
-
groups: ['top', 'unknown', 'is', 'callback', 'set'],
|
|
168
|
-
customGroups: {
|
|
169
|
-
top: ['id', '*Id'],
|
|
170
|
-
is: 'is*',
|
|
171
|
-
callback: 'on*',
|
|
172
|
-
set: ['set*'],
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
],
|
|
78
|
+
'perfectionist/sort-interfaces': sortInterfaces,
|
|
176
79
|
|
|
177
80
|
// Union types
|
|
178
|
-
'perfectionist/sort-union-types':
|
|
179
|
-
'error',
|
|
180
|
-
{
|
|
181
|
-
type: 'natural',
|
|
182
|
-
order: 'asc',
|
|
183
|
-
groups: [
|
|
184
|
-
'conditional',
|
|
185
|
-
'function',
|
|
186
|
-
'import',
|
|
187
|
-
'keyword',
|
|
188
|
-
'literal',
|
|
189
|
-
'named',
|
|
190
|
-
'object',
|
|
191
|
-
'operator',
|
|
192
|
-
'tuple',
|
|
193
|
-
'union',
|
|
194
|
-
'nullish',
|
|
195
|
-
'unknown',
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
],
|
|
81
|
+
'perfectionist/sort-union-types': sortUnionTypes,
|
|
199
82
|
|
|
200
83
|
// Maps, Enum, Intersection types
|
|
201
|
-
'perfectionist/sort-maps':
|
|
202
|
-
'perfectionist/sort-enums':
|
|
203
|
-
'perfectionist/sort-intersection-types':
|
|
84
|
+
'perfectionist/sort-maps': sortMaps,
|
|
85
|
+
'perfectionist/sort-enums': sortEnums,
|
|
86
|
+
'perfectionist/sort-intersection-types': sortIntersectionTypes,
|
|
204
87
|
},
|
|
205
88
|
},
|
|
206
89
|
...eslintMarkdown.configs.recommended,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sortClasses } from './sortClasses.js'
|
|
2
|
+
import { sortEnums } from './sortEnums.js'
|
|
3
|
+
import { sortInterfaces } from './sortInterfaces.js'
|
|
4
|
+
import { sortIntersectionTypes } from './sortIntersectionTypes.js'
|
|
5
|
+
import { sortJSXProps } from './sortJSXProps.js'
|
|
6
|
+
import { sortMaps } from './sortMaps.js'
|
|
7
|
+
import { sortObjects } from './sortObjects.js'
|
|
8
|
+
import { sortObjectTypes } from './sortObjectTypes.js'
|
|
9
|
+
import { sortUnionTypes } from './sortUnionTypes.js'
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
sortClasses,
|
|
13
|
+
sortEnums,
|
|
14
|
+
sortInterfaces,
|
|
15
|
+
sortIntersectionTypes,
|
|
16
|
+
sortJSXProps,
|
|
17
|
+
sortMaps,
|
|
18
|
+
sortObjects,
|
|
19
|
+
sortObjectTypes,
|
|
20
|
+
sortUnionTypes,
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const sortClasses = [
|
|
2
|
+
'error',
|
|
3
|
+
{
|
|
4
|
+
type: 'natural',
|
|
5
|
+
order: 'asc',
|
|
6
|
+
groups: [
|
|
7
|
+
'top',
|
|
8
|
+
'index-signature',
|
|
9
|
+
'static-property',
|
|
10
|
+
'private-property',
|
|
11
|
+
'property',
|
|
12
|
+
'constructor',
|
|
13
|
+
'static-method',
|
|
14
|
+
'private-method',
|
|
15
|
+
'get-method',
|
|
16
|
+
'set-method',
|
|
17
|
+
'method',
|
|
18
|
+
],
|
|
19
|
+
customGroups: [
|
|
20
|
+
{
|
|
21
|
+
groupName: 'top',
|
|
22
|
+
elementNamePattern: 'id',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
export { sortClasses }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const sortInterfaces = [
|
|
2
|
+
'error',
|
|
3
|
+
{
|
|
4
|
+
type: 'natural',
|
|
5
|
+
order: 'asc',
|
|
6
|
+
groups: ['top', 'unknown', 'is', 'callback', 'set'],
|
|
7
|
+
customGroups: {
|
|
8
|
+
top: ['id', 'Id'],
|
|
9
|
+
is: 'is*',
|
|
10
|
+
callback: 'on*',
|
|
11
|
+
set: ['set*'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export { sortInterfaces }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { eslintStyleProps, eslintStylePropsCustomGroups } from './../eslint.styleProps.js'
|
|
2
|
+
|
|
3
|
+
const sortJSXProps = [
|
|
4
|
+
'error',
|
|
5
|
+
{
|
|
6
|
+
type: 'natural',
|
|
7
|
+
order: 'asc',
|
|
8
|
+
groups: [
|
|
9
|
+
'className',
|
|
10
|
+
'key',
|
|
11
|
+
'ref',
|
|
12
|
+
'name',
|
|
13
|
+
...eslintStyleProps,
|
|
14
|
+
'shorthand',
|
|
15
|
+
'unknown',
|
|
16
|
+
'multiline',
|
|
17
|
+
'is',
|
|
18
|
+
'set',
|
|
19
|
+
'callback',
|
|
20
|
+
],
|
|
21
|
+
customGroups: {
|
|
22
|
+
className: 'className',
|
|
23
|
+
key: 'key',
|
|
24
|
+
ref: 'ref',
|
|
25
|
+
name: 'name',
|
|
26
|
+
...eslintStylePropsCustomGroups,
|
|
27
|
+
is: 'is*',
|
|
28
|
+
callback: 'on*',
|
|
29
|
+
set: ['set*'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export { sortJSXProps }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { eslintStyleObjects, eslintStyleObjectsCustomGroups } from './../eslint.styleObjects.js'
|
|
2
|
+
|
|
3
|
+
const sortObjects = [
|
|
4
|
+
'error',
|
|
5
|
+
{
|
|
6
|
+
type: 'natural',
|
|
7
|
+
order: 'asc',
|
|
8
|
+
groups: [
|
|
9
|
+
'isMobile',
|
|
10
|
+
'isTablet',
|
|
11
|
+
'isDesktop',
|
|
12
|
+
'id',
|
|
13
|
+
'children',
|
|
14
|
+
...eslintStyleObjects,
|
|
15
|
+
'device',
|
|
16
|
+
'is',
|
|
17
|
+
'unknown',
|
|
18
|
+
'callback',
|
|
19
|
+
],
|
|
20
|
+
customGroups: {
|
|
21
|
+
id: 'id',
|
|
22
|
+
children: 'children',
|
|
23
|
+
isMobile: 'isMobile*',
|
|
24
|
+
isTablet: 'isTablet*',
|
|
25
|
+
isDesktop: 'isDesktop*',
|
|
26
|
+
...eslintStyleObjectsCustomGroups,
|
|
27
|
+
device: 'device',
|
|
28
|
+
is: 'is*',
|
|
29
|
+
callback: 'on*',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export { sortObjects }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const sortUnionTypes = [
|
|
2
|
+
'error',
|
|
3
|
+
{
|
|
4
|
+
type: 'natural',
|
|
5
|
+
order: 'asc',
|
|
6
|
+
groups: [
|
|
7
|
+
'conditional',
|
|
8
|
+
'function',
|
|
9
|
+
'import',
|
|
10
|
+
'keyword',
|
|
11
|
+
'literal',
|
|
12
|
+
'named',
|
|
13
|
+
'object',
|
|
14
|
+
'operator',
|
|
15
|
+
'tuple',
|
|
16
|
+
'union',
|
|
17
|
+
'nullish',
|
|
18
|
+
'unknown',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
export { sortUnionTypes }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/lint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets",
|
|
6
6
|
"engines": {
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"eslint",
|
|
22
22
|
"eslint/mobx",
|
|
23
|
+
"perfectionist",
|
|
23
24
|
"prettier",
|
|
25
|
+
"react-native",
|
|
26
|
+
"storybook",
|
|
24
27
|
"stylelint",
|
|
25
28
|
"README.md"
|
|
26
29
|
],
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
"@eslint/compat": "^1.2.3",
|
|
34
37
|
"@eslint/js": "^9.15.0",
|
|
35
38
|
"@eslint/markdown": "^6.2.1",
|
|
36
|
-
"@ianvs/prettier-plugin-sort-imports": "
|
|
39
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
|
|
37
40
|
"eslint": "^9.15.0",
|
|
38
41
|
"eslint-config-prettier": "^9.1.0",
|
|
39
42
|
"eslint-plugin-json": "^4.0.1",
|
|
@@ -47,19 +50,14 @@
|
|
|
47
50
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
48
51
|
"eslint-plugin-react-native": "^4.1.0",
|
|
49
52
|
"eslint-plugin-react-refresh": "^0.4.14",
|
|
50
|
-
"prettier": "^3.4.1",
|
|
51
53
|
"eslint-plugin-storybook": "^0.11.1",
|
|
54
|
+
"prettier": "^3.4.1",
|
|
52
55
|
"stylelint-config-standard": "^36.0.1",
|
|
53
56
|
"stylelint-no-unsupported-browser-features": "^8.0.2",
|
|
54
57
|
"stylelint-order": "^6.0.4",
|
|
55
58
|
"stylelint-prettier": "^5.0.2",
|
|
56
59
|
"typescript-eslint": "^8.16.0"
|
|
57
60
|
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"@ianvs/prettier-plugin-sort-imports": "3.7.2",
|
|
60
|
-
"prettier": "^3.3.3",
|
|
61
|
-
"stylelint": "^16.7.0"
|
|
62
|
-
},
|
|
63
61
|
"devDependencies": {
|
|
64
62
|
"@commitlint/cli": "^19.6.0",
|
|
65
63
|
"@commitlint/config-conventional": "^19.6.0",
|