@hero-design/snowflake-guard 1.3.5 → 1.3.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.
@@ -42,135 +42,193 @@ 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: [54, 56, 72, 81, 18],
46
- styleLocs: [71, 75, 82, 48, 50, 51, 52, 53, 64, 66, 67, 68, 69, 70],
47
- styledComponentLocs: [14, 23, 28],
45
+ approvedLocs: [55, 57, 73, 82, 19],
46
+ styleLocs: [
47
+ 72, 76, 83, 49, 51, 52, 53, 54, 65, 67, 68, 69, 70, 71, 85, 94, 103,
48
+ ],
49
+ styledComponentLocs: [15, 24, 29],
48
50
  violatingAttributes: [
49
51
  {
50
52
  attributeName: 'padding',
51
53
  attributeValue: '20',
52
54
  componentName: 'Button.Icon',
53
55
  inlineStyleProps: 'style',
54
- loc: 71,
56
+ loc: 72,
55
57
  },
56
58
  {
57
59
  attributeName: 'padding',
58
60
  attributeValue: '20',
59
61
  componentName: 'Button.Icon',
60
62
  inlineStyleProps: 'style',
61
- loc: 75,
63
+ loc: 76,
62
64
  },
63
65
  {
64
66
  attributeName: 'backgroundColor',
65
67
  attributeValue: "'red'",
66
68
  componentName: 'Button.Icon',
67
69
  inlineStyleProps: 'style',
68
- loc: 75,
70
+ loc: 76,
69
71
  },
70
72
  {
71
73
  attributeName: 'backgroundColor',
72
74
  attributeValue: "'red'",
73
75
  componentName: 'Button.Icon',
74
76
  inlineStyleProps: 'style',
75
- loc: 82,
77
+ loc: 83,
76
78
  },
77
79
  {
78
80
  attributeName: 'padding',
79
81
  attributeValue: '10',
80
82
  componentName: 'Tabs',
81
83
  inlineStyleProps: 'barStyle',
82
- loc: 48,
84
+ loc: 49,
83
85
  },
84
86
  {
85
87
  attributeName: 'width',
86
88
  attributeValue: '100',
87
89
  componentName: 'Tabs',
88
90
  inlineStyleProps: 'containerStyle',
89
- loc: 48,
91
+ loc: 49,
90
92
  },
91
93
  {
92
94
  attributeName: 'width',
93
95
  attributeValue: '100',
94
96
  componentName: 'Tabs.Scroll',
95
97
  inlineStyleProps: 'containerStyle',
96
- loc: 50,
98
+ loc: 51,
97
99
  },
98
100
  {
99
101
  attributeName: 'color',
100
102
  attributeValue: "'red'",
101
103
  componentName: 'TextInput',
102
104
  inlineStyleProps: 'textStyle',
103
- loc: 51,
105
+ loc: 52,
104
106
  },
105
107
  {
106
108
  attributeName: 'color',
107
109
  attributeValue: "'red'",
108
110
  componentName: 'Search.OneLine',
109
111
  inlineStyleProps: 'textStyle',
110
- loc: 52,
112
+ loc: 53,
111
113
  },
112
114
  {
113
115
  attributeName: 'borderColor',
114
116
  attributeValue: "'red'",
115
117
  componentName: 'Search.OneLine',
116
118
  inlineStyleProps: 'textStyle',
117
- loc: 52,
119
+ loc: 53,
118
120
  },
119
121
  {
120
122
  attributeName: 'color',
121
123
  attributeValue: "'red'",
122
124
  componentName: 'Toolbar.Message',
123
125
  inlineStyleProps: 'textStyle',
124
- loc: 53,
126
+ loc: 54,
125
127
  },
126
128
  {
127
129
  attributeName: 'borderColor',
128
130
  attributeValue: "'red'",
129
131
  componentName: 'Toolbar.Message',
130
132
  inlineStyleProps: 'textStyle',
131
- loc: 53,
133
+ loc: 54,
132
134
  },
133
135
  {
134
136
  attributeName: 'width',
135
137
  attributeValue: '200',
136
138
  componentName: 'Empty',
137
139
  inlineStyleProps: 'style',
138
- loc: 64,
140
+ loc: 65,
139
141
  },
140
142
  {
141
143
  attributeName: 'width',
142
144
  attributeValue: '200',
143
145
  componentName: 'Button.Utility',
144
146
  inlineStyleProps: 'style',
145
- loc: 66,
147
+ loc: 67,
146
148
  },
147
149
  {
148
150
  attributeName: 'padding',
149
151
  attributeValue: '30',
150
152
  componentName: 'Button',
151
153
  inlineStyleProps: 'style',
152
- loc: 67,
154
+ loc: 68,
153
155
  },
154
156
  {
155
157
  attributeName: 'padding',
156
158
  attributeValue: '30',
157
159
  componentName: 'Button',
158
160
  inlineStyleProps: 'style',
159
- loc: 68,
161
+ loc: 69,
160
162
  },
161
163
  {
162
164
  attributeName: 'padding',
163
165
  attributeValue: '30',
164
166
  componentName: 'Button',
165
167
  inlineStyleProps: 'style',
166
- loc: 69,
168
+ loc: 70,
167
169
  },
168
170
  {
169
171
  attributeName: 'padding',
170
172
  attributeValue: '30',
171
173
  componentName: 'Button',
172
174
  inlineStyleProps: 'style',
173
- loc: 70,
175
+ loc: 71,
176
+ },
177
+ {
178
+ attributeName: 'backgroundColor',
179
+ attributeValue: "'red'",
180
+ componentName: 'Chart.Column',
181
+ inlineStyleProps: 'style',
182
+ loc: 85,
183
+ },
184
+ {
185
+ attributeName: 'padding',
186
+ attributeValue: '10',
187
+ componentName: 'Chart.Column',
188
+ inlineStyleProps: 'style',
189
+ loc: 85,
190
+ },
191
+ {
192
+ attributeName: 'backgroundColor',
193
+ attributeValue: "'red'",
194
+ componentName: 'Chart.Line',
195
+ inlineStyleProps: 'style',
196
+ loc: 94,
197
+ },
198
+ {
199
+ attributeName: 'padding',
200
+ attributeValue: '10',
201
+ componentName: 'Chart.Line',
202
+ inlineStyleProps: 'style',
203
+ loc: 94,
204
+ },
205
+ {
206
+ attributeName: 'backgroundColor',
207
+ attributeValue: "'red'",
208
+ componentName: 'Chart.SelectAction',
209
+ inlineStyleProps: 'style',
210
+ loc: 103,
211
+ },
212
+ {
213
+ attributeName: 'padding',
214
+ attributeValue: '10',
215
+ componentName: 'Chart.SelectAction',
216
+ inlineStyleProps: 'style',
217
+ loc: 103,
218
+ },
219
+ {
220
+ attributeName: 'width',
221
+ attributeValue: '400',
222
+ componentName: 'Chart.SelectAction',
223
+ inlineStyleProps: 'style',
224
+ loc: 103,
225
+ },
226
+ {
227
+ attributeName: 'height',
228
+ attributeValue: "'100%'",
229
+ componentName: 'Chart.SelectAction',
230
+ inlineStyleProps: 'style',
231
+ loc: 103,
174
232
  },
175
233
  ],
176
234
  });
@@ -1,4 +1,4 @@
1
- declare const HD_MOBILE_COMPONENTS: readonly ["Accordion", "Alert", "Attachment", "Avatar", "Badge", "BottomNavigation", "BottomSheet", "Box", "Button", "Calendar", "Carousel", "Card", "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", "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"];
2
2
  declare const MOBILE_RULESET_MAP: {
3
3
  Accordion: string[];
4
4
  Alert: (string | string[])[];
@@ -21,6 +21,9 @@ declare const MOBILE_RULESET_MAP: {
21
21
  'Carousel.Card': string[];
22
22
  Checkbox: string[];
23
23
  Chip: string[];
24
+ 'Chart.Column': string[];
25
+ 'Chart.Line': string[];
26
+ 'Chart.SelectAction': string[];
24
27
  Collapse: string[];
25
28
  ContentNavigator: string[];
26
29
  DatePicker: string[];
@@ -81,6 +81,7 @@ const HD_MOBILE_COMPONENTS = [
81
81
  'Calendar',
82
82
  'Carousel',
83
83
  'Card',
84
+ 'Chart',
84
85
  'Chip',
85
86
  'Collapse',
86
87
  'Checkbox',
@@ -187,6 +188,13 @@ const MOBILE_RULESET_MAP = {
187
188
  'Carousel.Card': [...COMMON_PROHIBITED_ATTRS],
188
189
  Checkbox: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
189
190
  Chip: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
191
+ 'Chart.Column': [...COMMON_PROHIBITED_ATTRS],
192
+ 'Chart.Line': [...COMMON_PROHIBITED_ATTRS],
193
+ 'Chart.SelectAction': [
194
+ ...COMMON_PROHIBITED_ATTRS,
195
+ ...WIDTH_ATTRS,
196
+ ...HEIGHT_ATTRS,
197
+ ],
190
198
  Collapse: [...TEXT_ATTRS],
191
199
  ContentNavigator: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
192
200
  DatePicker: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/snowflake-guard",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "A hero-design bot detecting snowflake usage",
5
5
  "author": "Hau Dao",
6
6
  "license": "ISC",
@@ -35,11 +35,22 @@
35
35
  "@eslint/eslintrc": "^3.1.0",
36
36
  "@types/jest": "^29.0.0",
37
37
  "@types/node": "^20.14.8",
38
+ "@typescript-eslint/eslint-plugin": "^5.12.1",
39
+ "@typescript-eslint/parser": "^5.12.1",
38
40
  "config-tsconfig": "8.42.5",
39
41
  "eslint": "^8.56.0",
42
+ "eslint-config-airbnb": "^19.0.4",
40
43
  "eslint-config-hd": "8.42.5",
44
+ "eslint-config-prettier": "^8.5.0",
45
+ "eslint-import-resolver-typescript": "^3.5.2",
46
+ "eslint-plugin-import": "^2.26.0",
47
+ "eslint-plugin-jsx-a11y": "^6.5.1",
48
+ "eslint-plugin-prettier": "^4.0.0",
49
+ "eslint-plugin-react": "^7.37.3",
50
+ "eslint-plugin-react-hooks": "^4.3.0",
41
51
  "jest": "^29.0.0",
42
52
  "nock": "^13.0.5",
53
+ "prettier": "^2.5.1",
43
54
  "prettier-config-hd": "8.42.4",
44
55
  "smee-client": "^1.2.2",
45
56
  "ts-jest": "^29.0.0",