@hero-design/snowflake-guard 1.4.0 → 1.4.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.
|
@@ -42,201 +42,215 @@ describe('parseSource', () => {
|
|
|
42
42
|
it('reports correct snowflakes with typescript files', () => {
|
|
43
43
|
const source = fs.readFileSync('./src/__mocks__/mobileSourceSample.tsx', 'utf-8');
|
|
44
44
|
expect((0, parseMobileSource_1.default)(source)).toEqual({
|
|
45
|
-
approvedLocs: [
|
|
45
|
+
approvedLocs: [57, 59, 75, 84, 21],
|
|
46
46
|
styleLocs: [
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
74, 78, 85, 51, 53, 54, 55, 56, 67, 69, 70, 71, 72, 73, 87, 96, 105,
|
|
48
|
+
113, 118,
|
|
49
49
|
],
|
|
50
|
-
styledComponentLocs: [
|
|
50
|
+
styledComponentLocs: [17, 26, 31],
|
|
51
51
|
violatingAttributes: [
|
|
52
52
|
{
|
|
53
53
|
attributeName: 'padding',
|
|
54
54
|
attributeValue: '20',
|
|
55
55
|
componentName: 'Button.Icon',
|
|
56
56
|
inlineStyleProps: 'style',
|
|
57
|
-
loc:
|
|
57
|
+
loc: 74,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
attributeName: 'padding',
|
|
61
61
|
attributeValue: '20',
|
|
62
62
|
componentName: 'Button.Icon',
|
|
63
63
|
inlineStyleProps: 'style',
|
|
64
|
-
loc:
|
|
64
|
+
loc: 78,
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
attributeName: 'backgroundColor',
|
|
68
68
|
attributeValue: "'red'",
|
|
69
69
|
componentName: 'Button.Icon',
|
|
70
70
|
inlineStyleProps: 'style',
|
|
71
|
-
loc:
|
|
71
|
+
loc: 78,
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
attributeName: 'backgroundColor',
|
|
75
75
|
attributeValue: "'red'",
|
|
76
76
|
componentName: 'Button.Icon',
|
|
77
77
|
inlineStyleProps: 'style',
|
|
78
|
-
loc:
|
|
78
|
+
loc: 85,
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
attributeName: 'padding',
|
|
82
82
|
attributeValue: '10',
|
|
83
83
|
componentName: 'Tabs',
|
|
84
84
|
inlineStyleProps: 'barStyle',
|
|
85
|
-
loc:
|
|
85
|
+
loc: 51,
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
attributeName: 'width',
|
|
89
89
|
attributeValue: '100',
|
|
90
90
|
componentName: 'Tabs',
|
|
91
91
|
inlineStyleProps: 'containerStyle',
|
|
92
|
-
loc:
|
|
92
|
+
loc: 51,
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
attributeName: 'width',
|
|
96
96
|
attributeValue: '100',
|
|
97
97
|
componentName: 'Tabs.Scroll',
|
|
98
98
|
inlineStyleProps: 'containerStyle',
|
|
99
|
-
loc:
|
|
99
|
+
loc: 53,
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
attributeName: 'color',
|
|
103
103
|
attributeValue: "'red'",
|
|
104
104
|
componentName: 'TextInput',
|
|
105
105
|
inlineStyleProps: 'textStyle',
|
|
106
|
-
loc:
|
|
106
|
+
loc: 54,
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
attributeName: 'color',
|
|
110
110
|
attributeValue: "'red'",
|
|
111
111
|
componentName: 'Search.OneLine',
|
|
112
112
|
inlineStyleProps: 'textStyle',
|
|
113
|
-
loc:
|
|
113
|
+
loc: 55,
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
attributeName: 'borderColor',
|
|
117
117
|
attributeValue: "'red'",
|
|
118
118
|
componentName: 'Search.OneLine',
|
|
119
119
|
inlineStyleProps: 'textStyle',
|
|
120
|
-
loc:
|
|
120
|
+
loc: 55,
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
attributeName: 'color',
|
|
124
124
|
attributeValue: "'red'",
|
|
125
125
|
componentName: 'Toolbar.Message',
|
|
126
126
|
inlineStyleProps: 'textStyle',
|
|
127
|
-
loc:
|
|
127
|
+
loc: 56,
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
attributeName: 'borderColor',
|
|
131
131
|
attributeValue: "'red'",
|
|
132
132
|
componentName: 'Toolbar.Message',
|
|
133
133
|
inlineStyleProps: 'textStyle',
|
|
134
|
-
loc:
|
|
134
|
+
loc: 56,
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
attributeName: 'width',
|
|
138
138
|
attributeValue: '200',
|
|
139
139
|
componentName: 'Empty',
|
|
140
140
|
inlineStyleProps: 'style',
|
|
141
|
-
loc:
|
|
141
|
+
loc: 67,
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
attributeName: 'width',
|
|
145
145
|
attributeValue: '200',
|
|
146
146
|
componentName: 'Button.Utility',
|
|
147
147
|
inlineStyleProps: 'style',
|
|
148
|
-
loc:
|
|
148
|
+
loc: 69,
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
attributeName: 'padding',
|
|
152
152
|
attributeValue: '30',
|
|
153
153
|
componentName: 'Button',
|
|
154
154
|
inlineStyleProps: 'style',
|
|
155
|
-
loc:
|
|
155
|
+
loc: 70,
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
attributeName: 'padding',
|
|
159
159
|
attributeValue: '30',
|
|
160
160
|
componentName: 'Button',
|
|
161
161
|
inlineStyleProps: 'style',
|
|
162
|
-
loc:
|
|
162
|
+
loc: 71,
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
attributeName: 'padding',
|
|
166
166
|
attributeValue: '30',
|
|
167
167
|
componentName: 'Button',
|
|
168
168
|
inlineStyleProps: 'style',
|
|
169
|
-
loc:
|
|
169
|
+
loc: 72,
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
attributeName: 'padding',
|
|
173
173
|
attributeValue: '30',
|
|
174
174
|
componentName: 'Button',
|
|
175
175
|
inlineStyleProps: 'style',
|
|
176
|
-
loc:
|
|
176
|
+
loc: 73,
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
attributeName: 'backgroundColor',
|
|
180
180
|
attributeValue: "'red'",
|
|
181
181
|
componentName: 'Chart.Column',
|
|
182
182
|
inlineStyleProps: 'style',
|
|
183
|
-
loc:
|
|
183
|
+
loc: 87,
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
attributeName: 'padding',
|
|
187
187
|
attributeValue: '10',
|
|
188
188
|
componentName: 'Chart.Column',
|
|
189
189
|
inlineStyleProps: 'style',
|
|
190
|
-
loc:
|
|
190
|
+
loc: 87,
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
attributeName: 'backgroundColor',
|
|
194
194
|
attributeValue: "'red'",
|
|
195
195
|
componentName: 'Chart.Line',
|
|
196
196
|
inlineStyleProps: 'style',
|
|
197
|
-
loc:
|
|
197
|
+
loc: 96,
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
attributeName: 'padding',
|
|
201
201
|
attributeValue: '10',
|
|
202
202
|
componentName: 'Chart.Line',
|
|
203
203
|
inlineStyleProps: 'style',
|
|
204
|
-
loc:
|
|
204
|
+
loc: 96,
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
attributeName: 'backgroundColor',
|
|
208
208
|
attributeValue: "'red'",
|
|
209
209
|
componentName: 'Chart.SelectAction',
|
|
210
210
|
inlineStyleProps: 'style',
|
|
211
|
-
loc:
|
|
211
|
+
loc: 105,
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
attributeName: 'padding',
|
|
215
215
|
attributeValue: '10',
|
|
216
216
|
componentName: 'Chart.SelectAction',
|
|
217
217
|
inlineStyleProps: 'style',
|
|
218
|
-
loc:
|
|
218
|
+
loc: 105,
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
attributeName: 'width',
|
|
222
222
|
attributeValue: '400',
|
|
223
223
|
componentName: 'Chart.SelectAction',
|
|
224
224
|
inlineStyleProps: 'style',
|
|
225
|
-
loc:
|
|
225
|
+
loc: 105,
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
228
|
attributeName: 'height',
|
|
229
229
|
attributeValue: "'100%'",
|
|
230
230
|
componentName: 'Chart.SelectAction',
|
|
231
231
|
inlineStyleProps: 'style',
|
|
232
|
-
loc:
|
|
232
|
+
loc: 105,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
attributeName: 'padding',
|
|
236
|
+
attributeValue: '10',
|
|
237
|
+
componentName: 'FormGroup',
|
|
238
|
+
inlineStyleProps: 'style',
|
|
239
|
+
loc: 113,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
attributeName: 'height',
|
|
243
|
+
attributeValue: '100',
|
|
244
|
+
componentName: 'FilterTrigger',
|
|
245
|
+
inlineStyleProps: 'style',
|
|
246
|
+
loc: 118,
|
|
233
247
|
},
|
|
234
248
|
{
|
|
235
249
|
attributeName: 'padding',
|
|
236
250
|
attributeValue: '10',
|
|
237
|
-
componentName: '
|
|
251
|
+
componentName: 'FilterTrigger',
|
|
238
252
|
inlineStyleProps: 'style',
|
|
239
|
-
loc:
|
|
253
|
+
loc: 118,
|
|
240
254
|
},
|
|
241
255
|
],
|
|
242
256
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const HD_MOBILE_COMPONENTS: readonly ["Accordion", "Alert", "Attachment", "Avatar", "Badge", "BottomNavigation", "BottomSheet", "Box", "Button", "Calendar", "Carousel", "Card", "Chart", "Chip", "Collapse", "Checkbox", "ContentNavigator", "DatePicker", "Divider", "Drawer", "Empty", "Error", "FAB", "HeroDesignProvider", "MapPin", "Icon", "Image", "List", "PinInput", "Progress", "Slider", "Spinner", "Swipeable", "Radio", "SectionHeading", "Select", "Skeleton", "Success", "Switch", "Tabs", "Tag", "TextInput", "TimePicker", "Toast", "Toolbar", "Typography", "Rate", "RefreshControl", "RichTextEditor", "PageControl", "Portal", "ScrollViewWithFAB", "SectionListWithFAB", "FlatListWithFAB", "Search", "FloatingIsland"];
|
|
1
|
+
declare const HD_MOBILE_COMPONENTS: readonly ["Accordion", "Alert", "Attachment", "Avatar", "Badge", "BottomNavigation", "BottomSheet", "Box", "Button", "Calendar", "Carousel", "Card", "Chart", "Chip", "Collapse", "Checkbox", "ContentNavigator", "DatePicker", "Divider", "Drawer", "Empty", "Error", "FAB", "FormGroup", "HeroDesignProvider", "MapPin", "Icon", "Image", "List", "PinInput", "Progress", "Slider", "Spinner", "Swipeable", "Radio", "SectionHeading", "Select", "Skeleton", "Success", "Switch", "Tabs", "Tag", "TextInput", "TimePicker", "Toast", "Toolbar", "Typography", "Rate", "RefreshControl", "RichTextEditor", "PageControl", "Portal", "ScrollViewWithFAB", "SectionListWithFAB", "FlatListWithFAB", "Search", "FloatingIsland", "FilterTrigger"];
|
|
2
2
|
declare const MOBILE_RULESET_MAP: {
|
|
3
3
|
Accordion: string[];
|
|
4
4
|
Alert: (string | string[])[];
|
|
@@ -36,6 +36,7 @@ declare const MOBILE_RULESET_MAP: {
|
|
|
36
36
|
'FAB.ActionGroup': string[];
|
|
37
37
|
'FAB.Pair': string[];
|
|
38
38
|
FloatingIsland: string[];
|
|
39
|
+
FilterTrigger: string[];
|
|
39
40
|
Icon: string[];
|
|
40
41
|
Image: string[];
|
|
41
42
|
'List.BasicItem': string[];
|
|
@@ -75,7 +76,7 @@ declare const MOBILE_RULESET_MAP: {
|
|
|
75
76
|
'Tabs.Scroll': string[];
|
|
76
77
|
Tag: string[];
|
|
77
78
|
TextInput: string[];
|
|
78
|
-
|
|
79
|
+
FormGroup: string[];
|
|
79
80
|
TimePicker: string[];
|
|
80
81
|
'Toast.Container': string[];
|
|
81
82
|
'Toast.Provider': string[];
|
|
@@ -92,6 +92,7 @@ const HD_MOBILE_COMPONENTS = [
|
|
|
92
92
|
'Empty',
|
|
93
93
|
'Error',
|
|
94
94
|
'FAB',
|
|
95
|
+
'FormGroup',
|
|
95
96
|
'HeroDesignProvider',
|
|
96
97
|
'MapPin',
|
|
97
98
|
'Icon',
|
|
@@ -125,6 +126,7 @@ const HD_MOBILE_COMPONENTS = [
|
|
|
125
126
|
'FlatListWithFAB',
|
|
126
127
|
'Search',
|
|
127
128
|
'FloatingIsland',
|
|
129
|
+
'FilterTrigger',
|
|
128
130
|
];
|
|
129
131
|
exports.HD_MOBILE_COMPONENTS = HD_MOBILE_COMPONENTS;
|
|
130
132
|
// Not common: MARGIN_ATTRS, WIDTH_ATTRS, HEIGHT_ATTRS
|
|
@@ -237,6 +239,7 @@ const MOBILE_RULESET_MAP = {
|
|
|
237
239
|
],
|
|
238
240
|
'FAB.Pair': [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
239
241
|
FloatingIsland: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
242
|
+
FilterTrigger: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
240
243
|
Icon: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
241
244
|
Image: [...COMMON_PROHIBITED_ATTRS],
|
|
242
245
|
'List.BasicItem': [...COMMON_PROHIBITED_ATTRS],
|
|
@@ -356,7 +359,7 @@ const MOBILE_RULESET_MAP = {
|
|
|
356
359
|
...TEXT_ATTRS,
|
|
357
360
|
...HEIGHT_ATTRS,
|
|
358
361
|
],
|
|
359
|
-
|
|
362
|
+
FormGroup: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
360
363
|
TimePicker: [
|
|
361
364
|
...PADDING_ATTRS,
|
|
362
365
|
...BORDER_ATTRS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/snowflake-guard",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "A hero-design bot detecting snowflake usage",
|
|
5
5
|
"author": "Hau Dao",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"eslint-config-hd": "8.42.5",
|
|
44
44
|
"eslint-config-prettier": "^8.5.0",
|
|
45
45
|
"eslint-import-resolver-typescript": "^3.5.2",
|
|
46
|
-
"eslint-plugin-import": "^2.
|
|
46
|
+
"eslint-plugin-import": "^2.32.0",
|
|
47
47
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
48
48
|
"eslint-plugin-prettier": "^4.0.0",
|
|
49
|
-
"eslint-plugin-react": "^7.37.
|
|
49
|
+
"eslint-plugin-react": "^7.37.5",
|
|
50
50
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
51
51
|
"jest": "^29.0.0",
|
|
52
52
|
"nock": "^13.0.5",
|