@itcase/lint 1.0.2 → 1.0.4
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/eslint.styleObjects.js +125 -0
- package/eslint/eslint.styleProps.js +67 -0
- package/eslint/index.js +23 -71
- package/eslint/mobx/index.js +20 -0
- package/package.json +2 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// In what order they are written, that’s how they will be sorted
|
|
2
|
+
const eslintStyleObjects = [
|
|
3
|
+
// Size and positioning
|
|
4
|
+
// Размер и позиционирование
|
|
5
|
+
'width',
|
|
6
|
+
'height',
|
|
7
|
+
'flex',
|
|
8
|
+
'flexDirection',
|
|
9
|
+
'justifyContent',
|
|
10
|
+
'alignItems',
|
|
11
|
+
'alignSelf',
|
|
12
|
+
'flexGrow',
|
|
13
|
+
'flexShrink',
|
|
14
|
+
'flexBasis',
|
|
15
|
+
'flexWrap',
|
|
16
|
+
'position',
|
|
17
|
+
'top',
|
|
18
|
+
'right',
|
|
19
|
+
'bottom',
|
|
20
|
+
'left',
|
|
21
|
+
'zIndex',
|
|
22
|
+
'minWidth',
|
|
23
|
+
'maxWidth',
|
|
24
|
+
'minHeight',
|
|
25
|
+
'maxHeight',
|
|
26
|
+
'aspectRatio',
|
|
27
|
+
|
|
28
|
+
// Indents and margins
|
|
29
|
+
// Отступы и поля
|
|
30
|
+
'margin',
|
|
31
|
+
'marginTop',
|
|
32
|
+
'marginRight',
|
|
33
|
+
'marginBottom',
|
|
34
|
+
'marginLeft',
|
|
35
|
+
'marginHorizontal',
|
|
36
|
+
'marginVertical',
|
|
37
|
+
'padding',
|
|
38
|
+
'paddingTop',
|
|
39
|
+
'paddingRight',
|
|
40
|
+
'paddingBottom',
|
|
41
|
+
'paddingLeft',
|
|
42
|
+
'paddingHorizontal',
|
|
43
|
+
'paddingVertical',
|
|
44
|
+
'gap',
|
|
45
|
+
|
|
46
|
+
// Borders and shadows
|
|
47
|
+
// Границы и тени
|
|
48
|
+
'borderWidth',
|
|
49
|
+
'borderColor',
|
|
50
|
+
'borderRadius',
|
|
51
|
+
'borderTopWidth',
|
|
52
|
+
'borderRightWidth',
|
|
53
|
+
'borderBottomWidth',
|
|
54
|
+
'borderLeftWidth',
|
|
55
|
+
'borderTopColor',
|
|
56
|
+
'borderRightColor',
|
|
57
|
+
'borderBottomColor',
|
|
58
|
+
'borderLeftColor',
|
|
59
|
+
'borderStyle',
|
|
60
|
+
'borderEndWidth',
|
|
61
|
+
'borderStartWidth',
|
|
62
|
+
'borderTopLeftRadius',
|
|
63
|
+
'borderTopRightRadius',
|
|
64
|
+
'borderBottomLeftRadius',
|
|
65
|
+
'borderBottomRightRadius',
|
|
66
|
+
'shadowColor',
|
|
67
|
+
'shadowOffset',
|
|
68
|
+
'shadowOpacity',
|
|
69
|
+
'shadowRadius',
|
|
70
|
+
'elevation',
|
|
71
|
+
|
|
72
|
+
// Color and background
|
|
73
|
+
// Цвет и фон
|
|
74
|
+
'backgroundColor',
|
|
75
|
+
'opacity',
|
|
76
|
+
|
|
77
|
+
// Fonts and text
|
|
78
|
+
// Шрифты и текст
|
|
79
|
+
'color',
|
|
80
|
+
'fontSize',
|
|
81
|
+
'fontWeight',
|
|
82
|
+
'fontStyle',
|
|
83
|
+
'fontFamily',
|
|
84
|
+
'lineHeight',
|
|
85
|
+
'letterSpacing',
|
|
86
|
+
'textAlign',
|
|
87
|
+
'textDecorationLine',
|
|
88
|
+
'textDecorationStyle',
|
|
89
|
+
'textDecorationColor',
|
|
90
|
+
'textTransform',
|
|
91
|
+
'textShadowColor',
|
|
92
|
+
'textShadowOffset',
|
|
93
|
+
'textShadowRadius',
|
|
94
|
+
'includeFontPadding',
|
|
95
|
+
'textAlignVertical',
|
|
96
|
+
'writingDirection',
|
|
97
|
+
|
|
98
|
+
// Other
|
|
99
|
+
// Прочее
|
|
100
|
+
'overflow',
|
|
101
|
+
'display',
|
|
102
|
+
'resizeMode',
|
|
103
|
+
'backfaceVisibility',
|
|
104
|
+
'tintColor',
|
|
105
|
+
'overlayColor',
|
|
106
|
+
'end',
|
|
107
|
+
'start',
|
|
108
|
+
'direction',
|
|
109
|
+
'transform',
|
|
110
|
+
'transformOrigin',
|
|
111
|
+
'translateX',
|
|
112
|
+
'translateY',
|
|
113
|
+
'scale',
|
|
114
|
+
'rotate',
|
|
115
|
+
'rotateX',
|
|
116
|
+
'rotateY',
|
|
117
|
+
'perspective',
|
|
118
|
+
'cursor',
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
const eslintStyleObjectsCustomGroups = {}
|
|
122
|
+
|
|
123
|
+
eslintStyleObjects.forEach((key) => (eslintStyleObjectsCustomGroups[key] = key))
|
|
124
|
+
|
|
125
|
+
export { eslintStyleObjects, eslintStyleObjectsCustomGroups }
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// In what order they are written, that’s how they will be sorted
|
|
2
|
+
const eslintStyleProps = [
|
|
3
|
+
'width',
|
|
4
|
+
'height',
|
|
5
|
+
'minWidth',
|
|
6
|
+
'minHeight',
|
|
7
|
+
'maxWidth',
|
|
8
|
+
'maxHeight',
|
|
9
|
+
'aspectRatio',
|
|
10
|
+
'font',
|
|
11
|
+
'color',
|
|
12
|
+
'labelTextColor',
|
|
13
|
+
'labelTextSize',
|
|
14
|
+
'fill',
|
|
15
|
+
'fillHover',
|
|
16
|
+
'background',
|
|
17
|
+
'background-position',
|
|
18
|
+
'background-repeat',
|
|
19
|
+
'background-size',
|
|
20
|
+
'padding',
|
|
21
|
+
'margin',
|
|
22
|
+
'border',
|
|
23
|
+
'borderWidth',
|
|
24
|
+
'borderColor',
|
|
25
|
+
'borderStyle',
|
|
26
|
+
'borderRadius',
|
|
27
|
+
'borderLeft',
|
|
28
|
+
'borderTop',
|
|
29
|
+
'borderRight',
|
|
30
|
+
'borderBottom',
|
|
31
|
+
'float',
|
|
32
|
+
'clear',
|
|
33
|
+
'position',
|
|
34
|
+
'overflow',
|
|
35
|
+
'content',
|
|
36
|
+
'display',
|
|
37
|
+
'flex',
|
|
38
|
+
'flexDirection',
|
|
39
|
+
'flexWrap',
|
|
40
|
+
'flexFlow',
|
|
41
|
+
'order',
|
|
42
|
+
'justify-content',
|
|
43
|
+
'align-items',
|
|
44
|
+
'align-self',
|
|
45
|
+
'align-content',
|
|
46
|
+
'flexGrow',
|
|
47
|
+
'flexShrink',
|
|
48
|
+
'flexBasis',
|
|
49
|
+
'visibility',
|
|
50
|
+
'box-sizing',
|
|
51
|
+
'box-shadow',
|
|
52
|
+
'left',
|
|
53
|
+
'top',
|
|
54
|
+
'right',
|
|
55
|
+
'bottom',
|
|
56
|
+
'verticalAlign',
|
|
57
|
+
'zIndex',
|
|
58
|
+
'transform',
|
|
59
|
+
'transition',
|
|
60
|
+
'opacity',
|
|
61
|
+
'cursor',
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
const eslintStylePropsCustomGroups = {}
|
|
65
|
+
eslintStyleProps.forEach((key) => (eslintStylePropsCustomGroups[key] = key))
|
|
66
|
+
|
|
67
|
+
export { eslintStyleProps, eslintStylePropsCustomGroups }
|
package/eslint/index.js
CHANGED
|
@@ -6,75 +6,14 @@ import eslintReact from 'eslint-plugin-react'
|
|
|
6
6
|
import eslintReactHooks from 'eslint-plugin-react-hooks'
|
|
7
7
|
import eslintTypeScript from 'typescript-eslint'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'height',
|
|
12
|
-
'minWidth',
|
|
13
|
-
'minHeight',
|
|
14
|
-
'maxWidth',
|
|
15
|
-
'maxHeight',
|
|
16
|
-
'aspectRatio',
|
|
17
|
-
'font',
|
|
18
|
-
'color',
|
|
19
|
-
'labelTextColor',
|
|
20
|
-
'labelTextSize',
|
|
21
|
-
'fill',
|
|
22
|
-
'fillHover',
|
|
23
|
-
'background',
|
|
24
|
-
'background-position',
|
|
25
|
-
'background-repeat',
|
|
26
|
-
'background-size',
|
|
27
|
-
'padding',
|
|
28
|
-
'margin',
|
|
29
|
-
'border',
|
|
30
|
-
'borderWidth',
|
|
31
|
-
'borderColor',
|
|
32
|
-
'borderStyle',
|
|
33
|
-
'borderRadius',
|
|
34
|
-
'borderLeft',
|
|
35
|
-
'borderTop',
|
|
36
|
-
'borderRight',
|
|
37
|
-
'borderBottom',
|
|
38
|
-
'float',
|
|
39
|
-
'clear',
|
|
40
|
-
'position',
|
|
41
|
-
'overflow',
|
|
42
|
-
'content',
|
|
43
|
-
'display',
|
|
44
|
-
'flex',
|
|
45
|
-
'flexDirection',
|
|
46
|
-
'flexWrap',
|
|
47
|
-
'flexFlow',
|
|
48
|
-
'order',
|
|
49
|
-
'justify-content',
|
|
50
|
-
'align-items',
|
|
51
|
-
'align-self',
|
|
52
|
-
'align-content',
|
|
53
|
-
'flexGrow',
|
|
54
|
-
'flexShrink',
|
|
55
|
-
'flexBasis',
|
|
56
|
-
'visibility',
|
|
57
|
-
'box-sizing',
|
|
58
|
-
'box-shadow',
|
|
59
|
-
'left',
|
|
60
|
-
'top',
|
|
61
|
-
'right',
|
|
62
|
-
'bottom',
|
|
63
|
-
'verticalAlign',
|
|
64
|
-
'zIndex',
|
|
65
|
-
'transform',
|
|
66
|
-
'transition',
|
|
67
|
-
'opacity',
|
|
68
|
-
'cursor',
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
const eslintStylePropsCustomGroups = {}
|
|
72
|
-
eslintStyleProps.forEach((key) => (eslintStylePropsCustomGroups[key] = key))
|
|
9
|
+
import { eslintStyleObjects, eslintStyleObjectsCustomGroups } from './eslint.styleObjects.js'
|
|
10
|
+
import { eslintStyleProps, eslintStylePropsCustomGroups } from './eslint.styleProps.js'
|
|
73
11
|
|
|
74
12
|
const eslintConfig = [
|
|
75
13
|
eslintJs.configs.recommended,
|
|
76
|
-
eslintPluginPrettierRecommended,
|
|
77
14
|
...eslintTypeScript.configs.recommended,
|
|
15
|
+
eslintPluginPrettierRecommended,
|
|
16
|
+
|
|
78
17
|
{
|
|
79
18
|
plugins: {
|
|
80
19
|
react: eslintReact,
|
|
@@ -82,16 +21,16 @@ const eslintConfig = [
|
|
|
82
21
|
perfectionist: eslintPerfectionist,
|
|
83
22
|
},
|
|
84
23
|
},
|
|
24
|
+
|
|
85
25
|
{
|
|
86
26
|
ignores: ['dist', 'node_modules', 'eslint.config.mjs'],
|
|
87
27
|
},
|
|
28
|
+
|
|
88
29
|
{
|
|
89
30
|
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
90
31
|
rules: {
|
|
32
|
+
// react-hooks configs recommended rules
|
|
91
33
|
...eslintReactHooks.configs.recommended.rules,
|
|
92
|
-
camelcase: 'off',
|
|
93
|
-
'multiline-ternary': 'off',
|
|
94
|
-
'object-shorthand': ['warn', 'consistent'],
|
|
95
34
|
|
|
96
35
|
// @typescript-eslint
|
|
97
36
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
@@ -105,6 +44,11 @@ const eslintConfig = [
|
|
|
105
44
|
'react-hooks/exhaustive-deps': 'warn',
|
|
106
45
|
'react-hooks/rules-of-hooks': 'error',
|
|
107
46
|
|
|
47
|
+
// disables the requirement to format ternary operators in multiline form
|
|
48
|
+
'multiline-ternary': 'off',
|
|
49
|
+
// shorthand for methods and properties of objects
|
|
50
|
+
'object-shorthand': ['warn', 'consistent'],
|
|
51
|
+
|
|
108
52
|
// Class
|
|
109
53
|
'perfectionist/sort-classes': [
|
|
110
54
|
'error',
|
|
@@ -142,6 +86,7 @@ const eslintConfig = [
|
|
|
142
86
|
'isDesktop',
|
|
143
87
|
'id',
|
|
144
88
|
'children',
|
|
89
|
+
...eslintStyleObjects,
|
|
145
90
|
'device',
|
|
146
91
|
'is',
|
|
147
92
|
'unknown',
|
|
@@ -153,6 +98,7 @@ const eslintConfig = [
|
|
|
153
98
|
isMobile: 'isMobile*',
|
|
154
99
|
isTablet: 'isTablet*',
|
|
155
100
|
isDesktop: 'isDesktop*',
|
|
101
|
+
...eslintStyleObjectsCustomGroups,
|
|
156
102
|
is: 'is*',
|
|
157
103
|
callback: 'on*',
|
|
158
104
|
},
|
|
@@ -166,7 +112,10 @@ const eslintConfig = [
|
|
|
166
112
|
type: 'natural',
|
|
167
113
|
order: 'asc',
|
|
168
114
|
groups: [
|
|
169
|
-
'
|
|
115
|
+
'className',
|
|
116
|
+
'key',
|
|
117
|
+
'ref',
|
|
118
|
+
'name',
|
|
170
119
|
...eslintStyleProps,
|
|
171
120
|
'shorthand',
|
|
172
121
|
'unknown',
|
|
@@ -176,11 +125,14 @@ const eslintConfig = [
|
|
|
176
125
|
'callback',
|
|
177
126
|
],
|
|
178
127
|
customGroups: {
|
|
179
|
-
|
|
128
|
+
className: 'className',
|
|
129
|
+
key: 'key',
|
|
130
|
+
ref: 'ref',
|
|
131
|
+
name: 'name',
|
|
132
|
+
...eslintStylePropsCustomGroups,
|
|
180
133
|
is: 'is*',
|
|
181
134
|
callback: 'on*',
|
|
182
135
|
set: ['set*'],
|
|
183
|
-
...eslintStylePropsCustomGroups,
|
|
184
136
|
},
|
|
185
137
|
},
|
|
186
138
|
],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import eslintMobx from 'eslint-plugin-mobx'
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
plugins: {
|
|
6
|
+
mobx: eslintMobx,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
// mobx
|
|
13
|
+
'mobx/exhaustive-make-observable': 'warn',
|
|
14
|
+
'mobx/missing-make-observable': 'error',
|
|
15
|
+
'mobx/missing-observer': 'warn',
|
|
16
|
+
'mobx/no-anonymous-observer': 'warn',
|
|
17
|
+
'mobx/unconditional-make-observable': 'error',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/lint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets",
|
|
6
6
|
"engines": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"eslint",
|
|
22
|
+
"eslint/mobx",
|
|
22
23
|
"prettier",
|
|
23
24
|
"stylelint",
|
|
24
25
|
"README.md"
|