@hero-design/snowflake-guard 1.4.1 → 1.4.3

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,229 @@ 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: [56, 58, 74, 83, 20],
45
+ approvedLocs: [58, 60, 76, 85, 22],
46
46
  styleLocs: [
47
- 73, 77, 84, 50, 52, 53, 54, 55, 66, 68, 69, 70, 71, 72, 86, 95, 104,
48
- 112,
47
+ 75, 79, 86, 52, 54, 55, 56, 57, 68, 70, 71, 72, 73, 74, 88, 97, 106,
48
+ 114, 119, 127,
49
49
  ],
50
- styledComponentLocs: [16, 25, 30],
50
+ styledComponentLocs: [18, 27, 32],
51
51
  violatingAttributes: [
52
52
  {
53
53
  attributeName: 'padding',
54
54
  attributeValue: '20',
55
55
  componentName: 'Button.Icon',
56
56
  inlineStyleProps: 'style',
57
- loc: 73,
57
+ loc: 75,
58
58
  },
59
59
  {
60
60
  attributeName: 'padding',
61
61
  attributeValue: '20',
62
62
  componentName: 'Button.Icon',
63
63
  inlineStyleProps: 'style',
64
- loc: 77,
64
+ loc: 79,
65
65
  },
66
66
  {
67
67
  attributeName: 'backgroundColor',
68
68
  attributeValue: "'red'",
69
69
  componentName: 'Button.Icon',
70
70
  inlineStyleProps: 'style',
71
- loc: 77,
71
+ loc: 79,
72
72
  },
73
73
  {
74
74
  attributeName: 'backgroundColor',
75
75
  attributeValue: "'red'",
76
76
  componentName: 'Button.Icon',
77
77
  inlineStyleProps: 'style',
78
- loc: 84,
78
+ loc: 86,
79
79
  },
80
80
  {
81
81
  attributeName: 'padding',
82
82
  attributeValue: '10',
83
83
  componentName: 'Tabs',
84
84
  inlineStyleProps: 'barStyle',
85
- loc: 50,
85
+ loc: 52,
86
86
  },
87
87
  {
88
88
  attributeName: 'width',
89
89
  attributeValue: '100',
90
90
  componentName: 'Tabs',
91
91
  inlineStyleProps: 'containerStyle',
92
- loc: 50,
92
+ loc: 52,
93
93
  },
94
94
  {
95
95
  attributeName: 'width',
96
96
  attributeValue: '100',
97
97
  componentName: 'Tabs.Scroll',
98
98
  inlineStyleProps: 'containerStyle',
99
- loc: 52,
99
+ loc: 54,
100
100
  },
101
101
  {
102
102
  attributeName: 'color',
103
103
  attributeValue: "'red'",
104
104
  componentName: 'TextInput',
105
105
  inlineStyleProps: 'textStyle',
106
- loc: 53,
106
+ loc: 55,
107
107
  },
108
108
  {
109
109
  attributeName: 'color',
110
110
  attributeValue: "'red'",
111
111
  componentName: 'Search.OneLine',
112
112
  inlineStyleProps: 'textStyle',
113
- loc: 54,
113
+ loc: 56,
114
114
  },
115
115
  {
116
116
  attributeName: 'borderColor',
117
117
  attributeValue: "'red'",
118
118
  componentName: 'Search.OneLine',
119
119
  inlineStyleProps: 'textStyle',
120
- loc: 54,
120
+ loc: 56,
121
121
  },
122
122
  {
123
123
  attributeName: 'color',
124
124
  attributeValue: "'red'",
125
125
  componentName: 'Toolbar.Message',
126
126
  inlineStyleProps: 'textStyle',
127
- loc: 55,
127
+ loc: 57,
128
128
  },
129
129
  {
130
130
  attributeName: 'borderColor',
131
131
  attributeValue: "'red'",
132
132
  componentName: 'Toolbar.Message',
133
133
  inlineStyleProps: 'textStyle',
134
- loc: 55,
134
+ loc: 57,
135
135
  },
136
136
  {
137
137
  attributeName: 'width',
138
138
  attributeValue: '200',
139
139
  componentName: 'Empty',
140
140
  inlineStyleProps: 'style',
141
- loc: 66,
141
+ loc: 68,
142
142
  },
143
143
  {
144
144
  attributeName: 'width',
145
145
  attributeValue: '200',
146
146
  componentName: 'Button.Utility',
147
147
  inlineStyleProps: 'style',
148
- loc: 68,
148
+ loc: 70,
149
149
  },
150
150
  {
151
151
  attributeName: 'padding',
152
152
  attributeValue: '30',
153
153
  componentName: 'Button',
154
154
  inlineStyleProps: 'style',
155
- loc: 69,
155
+ loc: 71,
156
156
  },
157
157
  {
158
158
  attributeName: 'padding',
159
159
  attributeValue: '30',
160
160
  componentName: 'Button',
161
161
  inlineStyleProps: 'style',
162
- loc: 70,
162
+ loc: 72,
163
163
  },
164
164
  {
165
165
  attributeName: 'padding',
166
166
  attributeValue: '30',
167
167
  componentName: 'Button',
168
168
  inlineStyleProps: 'style',
169
- loc: 71,
169
+ loc: 73,
170
170
  },
171
171
  {
172
172
  attributeName: 'padding',
173
173
  attributeValue: '30',
174
174
  componentName: 'Button',
175
175
  inlineStyleProps: 'style',
176
- loc: 72,
176
+ loc: 74,
177
177
  },
178
178
  {
179
179
  attributeName: 'backgroundColor',
180
180
  attributeValue: "'red'",
181
181
  componentName: 'Chart.Column',
182
182
  inlineStyleProps: 'style',
183
- loc: 86,
183
+ loc: 88,
184
184
  },
185
185
  {
186
186
  attributeName: 'padding',
187
187
  attributeValue: '10',
188
188
  componentName: 'Chart.Column',
189
189
  inlineStyleProps: 'style',
190
- loc: 86,
190
+ loc: 88,
191
191
  },
192
192
  {
193
193
  attributeName: 'backgroundColor',
194
194
  attributeValue: "'red'",
195
195
  componentName: 'Chart.Line',
196
196
  inlineStyleProps: 'style',
197
- loc: 95,
197
+ loc: 97,
198
198
  },
199
199
  {
200
200
  attributeName: 'padding',
201
201
  attributeValue: '10',
202
202
  componentName: 'Chart.Line',
203
203
  inlineStyleProps: 'style',
204
- loc: 95,
204
+ loc: 97,
205
205
  },
206
206
  {
207
207
  attributeName: 'backgroundColor',
208
208
  attributeValue: "'red'",
209
209
  componentName: 'Chart.SelectAction',
210
210
  inlineStyleProps: 'style',
211
- loc: 104,
211
+ loc: 106,
212
212
  },
213
213
  {
214
214
  attributeName: 'padding',
215
215
  attributeValue: '10',
216
216
  componentName: 'Chart.SelectAction',
217
217
  inlineStyleProps: 'style',
218
- loc: 104,
218
+ loc: 106,
219
219
  },
220
220
  {
221
221
  attributeName: 'width',
222
222
  attributeValue: '400',
223
223
  componentName: 'Chart.SelectAction',
224
224
  inlineStyleProps: 'style',
225
- loc: 104,
225
+ loc: 106,
226
226
  },
227
227
  {
228
228
  attributeName: 'height',
229
229
  attributeValue: "'100%'",
230
230
  componentName: 'Chart.SelectAction',
231
231
  inlineStyleProps: 'style',
232
- loc: 104,
232
+ loc: 106,
233
233
  },
234
234
  {
235
235
  attributeName: 'padding',
236
236
  attributeValue: '10',
237
237
  componentName: 'FormGroup',
238
238
  inlineStyleProps: 'style',
239
- loc: 112,
239
+ loc: 114,
240
+ },
241
+ {
242
+ attributeName: 'height',
243
+ attributeValue: '100',
244
+ componentName: 'FilterTrigger',
245
+ inlineStyleProps: 'style',
246
+ loc: 119,
247
+ },
248
+ {
249
+ attributeName: 'padding',
250
+ attributeValue: '10',
251
+ componentName: 'FilterTrigger',
252
+ inlineStyleProps: 'style',
253
+ loc: 119,
254
+ },
255
+ {
256
+ attributeName: 'height',
257
+ attributeValue: '100',
258
+ componentName: 'SegmentedControl',
259
+ inlineStyleProps: 'style',
260
+ loc: 127,
261
+ },
262
+ {
263
+ attributeName: 'padding',
264
+ attributeValue: '10',
265
+ componentName: 'SegmentedControl',
266
+ inlineStyleProps: 'style',
267
+ loc: 127,
240
268
  },
241
269
  ],
242
270
  });
@@ -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", "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"];
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", "SegmentedControl"];
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[];
@@ -76,6 +77,7 @@ declare const MOBILE_RULESET_MAP: {
76
77
  Tag: string[];
77
78
  TextInput: string[];
78
79
  FormGroup: string[];
80
+ SegmentedControl: string[];
79
81
  TimePicker: string[];
80
82
  'Toast.Container': string[];
81
83
  'Toast.Provider': string[];
@@ -126,6 +126,8 @@ const HD_MOBILE_COMPONENTS = [
126
126
  'FlatListWithFAB',
127
127
  'Search',
128
128
  'FloatingIsland',
129
+ 'FilterTrigger',
130
+ 'SegmentedControl',
129
131
  ];
130
132
  exports.HD_MOBILE_COMPONENTS = HD_MOBILE_COMPONENTS;
131
133
  // Not common: MARGIN_ATTRS, WIDTH_ATTRS, HEIGHT_ATTRS
@@ -238,6 +240,7 @@ const MOBILE_RULESET_MAP = {
238
240
  ],
239
241
  'FAB.Pair': [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
240
242
  FloatingIsland: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
243
+ FilterTrigger: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
241
244
  Icon: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
242
245
  Image: [...COMMON_PROHIBITED_ATTRS],
243
246
  'List.BasicItem': [...COMMON_PROHIBITED_ATTRS],
@@ -358,6 +361,7 @@ const MOBILE_RULESET_MAP = {
358
361
  ...HEIGHT_ATTRS,
359
362
  ],
360
363
  FormGroup: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
364
+ SegmentedControl: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
361
365
  TimePicker: [
362
366
  ...PADDING_ATTRS,
363
367
  ...BORDER_ATTRS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/snowflake-guard",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "A hero-design bot detecting snowflake usage",
5
5
  "author": "Hau Dao",
6
6
  "license": "ISC",