@hero-design/snowflake-guard 1.4.2 → 1.4.4-alpha.0
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/lib/src/__tests__/parseMobileSource.spec.js +47 -33
- package/lib/src/__tests__/parseSource.spec.js +50 -22
- package/lib/src/index.d.ts +1 -1
- package/lib/src/parseMobileSource.d.ts +1 -1
- package/lib/src/parseSource.d.ts +1 -1
- package/lib/src/parsers/flow.d.ts +1 -1
- package/lib/src/parsers/typescript.d.ts +1 -1
- package/lib/src/reports/constants.d.ts +11 -1
- package/lib/src/reports/constants.js +57 -1
- package/lib/src/reports/mobile/constants.d.ts +2 -1
- package/lib/src/reports/mobile/constants.js +2 -0
- package/lib/src/reports/mobile/reportCustomStyleProperties.d.ts +1 -1
- package/lib/src/reports/mobile/types.d.ts +1 -1
- package/lib/src/reports/reportClassName.d.ts +1 -1
- package/lib/src/reports/reportCustomStyleProperties.d.ts +1 -1
- package/lib/src/reports/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -42,215 +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: [
|
|
45
|
+
approvedLocs: [58, 60, 76, 85, 22],
|
|
46
46
|
styleLocs: [
|
|
47
|
-
|
|
48
|
-
|
|
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: [
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
239
|
+
loc: 114,
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
attributeName: 'height',
|
|
243
243
|
attributeValue: '100',
|
|
244
244
|
componentName: 'FilterTrigger',
|
|
245
245
|
inlineStyleProps: 'style',
|
|
246
|
-
loc:
|
|
246
|
+
loc: 119,
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
attributeName: 'padding',
|
|
250
250
|
attributeValue: '10',
|
|
251
251
|
componentName: 'FilterTrigger',
|
|
252
252
|
inlineStyleProps: 'style',
|
|
253
|
-
loc:
|
|
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,
|
|
254
268
|
},
|
|
255
269
|
],
|
|
256
270
|
});
|
|
@@ -42,81 +42,81 @@ describe('parseSource', () => {
|
|
|
42
42
|
it('reports correct snowflakes', () => {
|
|
43
43
|
const source = fs.readFileSync('./src/__mocks__/sourceSample.tsx', 'utf-8');
|
|
44
44
|
expect((0, parseSource_1.default)(source)).toEqual({
|
|
45
|
-
approvedLocs: [
|
|
46
|
-
classNameLocs: [
|
|
47
|
-
styleLocs: [
|
|
48
|
-
styledComponentLocs: [6, 15, 20],
|
|
49
|
-
sxLocs: [
|
|
45
|
+
approvedLocs: [81, 101, 105, 112, 93, 103, 10],
|
|
46
|
+
classNameLocs: [66, 64, 65, 67, 68],
|
|
47
|
+
styleLocs: [78, 96, 107, 71, 73, 74, 75, 76, 77, 79, 80],
|
|
48
|
+
styledComponentLocs: [6, 15, 20, 24, 28],
|
|
49
|
+
sxLocs: [90, 114, 85, 86, 87, 88, 89, 91, 92],
|
|
50
50
|
violatingAttributes: [
|
|
51
51
|
{
|
|
52
52
|
attributeName: 'padding',
|
|
53
53
|
attributeValue: '20',
|
|
54
54
|
componentName: 'Button.Link',
|
|
55
55
|
inlineStyleProps: 'style',
|
|
56
|
-
loc:
|
|
56
|
+
loc: 78,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
attributeName: 'padding',
|
|
60
60
|
attributeValue: '20',
|
|
61
61
|
componentName: 'Button.Link',
|
|
62
62
|
inlineStyleProps: 'sx',
|
|
63
|
-
loc:
|
|
63
|
+
loc: 90,
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
attributeName: 'padding',
|
|
67
67
|
attributeValue: '20',
|
|
68
68
|
componentName: 'Button.Link',
|
|
69
69
|
inlineStyleProps: 'style',
|
|
70
|
-
loc:
|
|
70
|
+
loc: 96,
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
attributeName: 'backgroundColor',
|
|
74
74
|
attributeValue: "'red'",
|
|
75
75
|
componentName: 'Button.Link',
|
|
76
76
|
inlineStyleProps: 'style',
|
|
77
|
-
loc:
|
|
77
|
+
loc: 96,
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
attributeName: 'padding',
|
|
81
81
|
attributeValue: '20',
|
|
82
82
|
componentName: 'Button.Link',
|
|
83
83
|
inlineStyleProps: 'style',
|
|
84
|
-
loc:
|
|
84
|
+
loc: 107,
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
attributeName: 'backgroundColor',
|
|
88
88
|
attributeValue: "'red'",
|
|
89
89
|
componentName: 'Button.Link',
|
|
90
90
|
inlineStyleProps: 'sx',
|
|
91
|
-
loc:
|
|
91
|
+
loc: 114,
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
attributeName: 'width',
|
|
95
95
|
attributeValue: '200',
|
|
96
96
|
componentName: 'Empty',
|
|
97
97
|
inlineStyleProps: 'style',
|
|
98
|
-
loc:
|
|
98
|
+
loc: 71,
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
attributeName: 'width',
|
|
102
102
|
attributeValue: '200',
|
|
103
103
|
componentName: 'Card.Header',
|
|
104
104
|
inlineStyleProps: 'style',
|
|
105
|
-
loc:
|
|
105
|
+
loc: 73,
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
attributeName: 'padding',
|
|
109
109
|
attributeValue: '30',
|
|
110
110
|
componentName: 'Button',
|
|
111
111
|
inlineStyleProps: 'style',
|
|
112
|
-
loc:
|
|
112
|
+
loc: 74,
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
attributeName: 'padding',
|
|
116
116
|
attributeValue: '30',
|
|
117
117
|
componentName: 'Button',
|
|
118
118
|
inlineStyleProps: 'style',
|
|
119
|
-
loc:
|
|
119
|
+
loc: 75,
|
|
120
120
|
additionalProps: [
|
|
121
121
|
{
|
|
122
122
|
propName: 'variant',
|
|
@@ -129,49 +129,77 @@ describe('parseSource', () => {
|
|
|
129
129
|
attributeValue: '30',
|
|
130
130
|
componentName: 'Button',
|
|
131
131
|
inlineStyleProps: 'style',
|
|
132
|
-
loc:
|
|
132
|
+
loc: 76,
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
attributeName: 'padding',
|
|
136
136
|
attributeValue: '30',
|
|
137
137
|
componentName: 'Button',
|
|
138
138
|
inlineStyleProps: 'style',
|
|
139
|
-
loc:
|
|
139
|
+
loc: 77,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
attributeName: 'margin',
|
|
143
|
+
attributeValue: '15',
|
|
144
|
+
componentName: 'Pane',
|
|
145
|
+
inlineStyleProps: 'style',
|
|
146
|
+
loc: 79,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
attributeName: 'margin',
|
|
150
|
+
attributeValue: '20',
|
|
151
|
+
componentName: 'Pane.Body',
|
|
152
|
+
inlineStyleProps: 'style',
|
|
153
|
+
loc: 80,
|
|
140
154
|
},
|
|
141
155
|
{
|
|
142
156
|
attributeName: 'mt',
|
|
143
157
|
attributeValue: '10',
|
|
144
158
|
componentName: 'Badge.Count',
|
|
145
159
|
inlineStyleProps: 'sx',
|
|
146
|
-
loc:
|
|
160
|
+
loc: 85,
|
|
147
161
|
},
|
|
148
162
|
{
|
|
149
163
|
attributeName: 'pt',
|
|
150
164
|
attributeValue: '10',
|
|
151
165
|
componentName: 'Badge',
|
|
152
166
|
inlineStyleProps: 'sx',
|
|
153
|
-
loc:
|
|
167
|
+
loc: 86,
|
|
154
168
|
},
|
|
155
169
|
{
|
|
156
170
|
attributeName: 'pt',
|
|
157
171
|
attributeValue: '10',
|
|
158
172
|
componentName: 'Badge',
|
|
159
173
|
inlineStyleProps: 'sx',
|
|
160
|
-
loc:
|
|
174
|
+
loc: 87,
|
|
161
175
|
},
|
|
162
176
|
{
|
|
163
177
|
attributeName: 'pt',
|
|
164
178
|
attributeValue: '10',
|
|
165
179
|
componentName: 'Badge',
|
|
166
180
|
inlineStyleProps: 'sx',
|
|
167
|
-
loc:
|
|
181
|
+
loc: 88,
|
|
168
182
|
},
|
|
169
183
|
{
|
|
170
184
|
attributeName: 'pt',
|
|
171
185
|
attributeValue: '10',
|
|
172
186
|
componentName: 'Badge',
|
|
173
187
|
inlineStyleProps: 'sx',
|
|
174
|
-
loc:
|
|
188
|
+
loc: 89,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
attributeName: 'margin',
|
|
192
|
+
attributeValue: '15',
|
|
193
|
+
componentName: 'Pane',
|
|
194
|
+
inlineStyleProps: 'sx',
|
|
195
|
+
loc: 91,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
attributeName: 'margin',
|
|
199
|
+
attributeValue: '20',
|
|
200
|
+
componentName: 'Pane.Footer',
|
|
201
|
+
inlineStyleProps: 'sx',
|
|
202
|
+
loc: 92,
|
|
175
203
|
},
|
|
176
204
|
],
|
|
177
205
|
});
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InlineStyleProps } from './reports/mobile/reportInlineStyle';
|
|
1
|
+
import type { InlineStyleProps } from './reports/mobile/reportInlineStyle';
|
|
2
2
|
import type { CompoundMobileComponentName } from './reports/mobile/types';
|
|
3
3
|
declare const parseMobileSource: (source: string) => {
|
|
4
4
|
styleLocs: number[];
|
package/lib/src/parseSource.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompoundComponentName } from './reports/types';
|
|
2
|
-
import { InlineStyleProps } from './reports/reportInlineStyle';
|
|
2
|
+
import type { InlineStyleProps } from './reports/reportInlineStyle';
|
|
3
3
|
declare const parseSource: (source: string) => {
|
|
4
4
|
classNameLocs: number[];
|
|
5
5
|
styleLocs: number[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as babelParser from '@babel/parser';
|
|
2
|
-
import { Overrides } from 'recast/parsers/_babel_options';
|
|
2
|
+
import type { Overrides } from 'recast/parsers/_babel_options';
|
|
3
3
|
export declare const parse: (source: string, options?: Overrides) => babelParser.ParseResult<import("@babel/types").File>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as babelParser from '@babel/parser';
|
|
2
|
-
import { Overrides } from 'recast/parsers/_babel_options';
|
|
2
|
+
import type { Overrides } from 'recast/parsers/_babel_options';
|
|
3
3
|
export declare const parse: (source: string, options?: Overrides) => babelParser.ParseResult<import("@babel/types").File>;
|
|
@@ -71,6 +71,11 @@ declare const RULESET_MAP: {
|
|
|
71
71
|
Notification: string[];
|
|
72
72
|
PageHeader: string[];
|
|
73
73
|
Pagination: string[];
|
|
74
|
+
Pane: string[];
|
|
75
|
+
'Pane.Header': string[];
|
|
76
|
+
'Pane.Body': string[];
|
|
77
|
+
'Pane.Footer': string[];
|
|
78
|
+
'Pane.CloseButton': string[];
|
|
74
79
|
Portlet: string[];
|
|
75
80
|
Progress: string[];
|
|
76
81
|
'Progress.Circle': string[];
|
|
@@ -180,6 +185,11 @@ declare const SX_RULESET_MAP: {
|
|
|
180
185
|
Notification: string[];
|
|
181
186
|
PageHeader: string[];
|
|
182
187
|
Pagination: string[];
|
|
188
|
+
Pane: string[];
|
|
189
|
+
'Pane.Header': string[];
|
|
190
|
+
'Pane.Body': string[];
|
|
191
|
+
'Pane.Footer': string[];
|
|
192
|
+
'Pane.CloseButton': string[];
|
|
183
193
|
Portlet: string[];
|
|
184
194
|
Progress: string[];
|
|
185
195
|
'Progress.Circle': string[];
|
|
@@ -216,7 +226,7 @@ declare const SX_RULESET_MAP: {
|
|
|
216
226
|
'Typography.Text': string[];
|
|
217
227
|
Widget: string[];
|
|
218
228
|
};
|
|
219
|
-
declare const HD_COMPONENTS: readonly ["Alert", "Badge", "Banner", "Breadcrumb", "Button", "Card", "Carousel", "Chart", "Checkbox", "Chip", "Collapse", "Comment", "ContextPanel", "DatePicker", "Divider", "Dropdown", "Empty", "File", "Filters", "Form", "Grid", "Icon", "InPageNavigation", "Input", "MediaQuery", "Menu", "Modal", "Notification", "PageHeader", "Pagination", "Portal", "Portlet", "Progress", "Radio", "Rate", "Result", "Select", "SelectButton", "SideBar", "Slider", "Spinner", "Statistic", "Steps", "Switch", "Table", "Tabs", "Tag", "TagInput", "TimePicker", "Timeline", "Tooltip", "Typography", "Widget"];
|
|
229
|
+
declare const HD_COMPONENTS: readonly ["Alert", "Badge", "Banner", "Breadcrumb", "Button", "Card", "Carousel", "Chart", "Checkbox", "Chip", "Collapse", "Comment", "ContextPanel", "DatePicker", "Divider", "Dropdown", "Empty", "File", "Filters", "Form", "Grid", "Icon", "InPageNavigation", "Input", "MediaQuery", "Menu", "Modal", "Notification", "PageHeader", "Pagination", "Pane", "Portal", "Portlet", "Progress", "Radio", "Rate", "Result", "Select", "SelectButton", "SideBar", "Slider", "Spinner", "Statistic", "Steps", "Switch", "Table", "Tabs", "Tag", "TagInput", "TimePicker", "Timeline", "Tooltip", "Typography", "Widget"];
|
|
220
230
|
declare const APPROVED_INLINE_STYLE_COMMENT = "@snowflake-guard/approved-inline-style";
|
|
221
231
|
declare const APPROVED_CLASSNAME_COMMENT = "@snowflake-guard/approved-classname";
|
|
222
232
|
declare const APPROVED_STYLED_COMPONENTS_COMMENT = "@snowflake-guard/approved-styled-components";
|
|
@@ -441,6 +441,41 @@ const RULESET_MAP = {
|
|
|
441
441
|
...WIDTH_ATTRS,
|
|
442
442
|
...HEIGHT_ATTRS,
|
|
443
443
|
],
|
|
444
|
+
Pane: [
|
|
445
|
+
...COMMON_PROHIBITED_ATTRS,
|
|
446
|
+
...SHADOW_ATTRS,
|
|
447
|
+
...WIDTH_ATTRS,
|
|
448
|
+
...HEIGHT_ATTRS,
|
|
449
|
+
...MARGIN_ATTRS,
|
|
450
|
+
],
|
|
451
|
+
'Pane.Header': [
|
|
452
|
+
...COMMON_PROHIBITED_ATTRS,
|
|
453
|
+
...SHADOW_ATTRS,
|
|
454
|
+
...WIDTH_ATTRS,
|
|
455
|
+
...HEIGHT_ATTRS,
|
|
456
|
+
...MARGIN_ATTRS,
|
|
457
|
+
],
|
|
458
|
+
'Pane.Body': [
|
|
459
|
+
...COMMON_PROHIBITED_ATTRS,
|
|
460
|
+
...SHADOW_ATTRS,
|
|
461
|
+
...WIDTH_ATTRS,
|
|
462
|
+
...HEIGHT_ATTRS,
|
|
463
|
+
...MARGIN_ATTRS,
|
|
464
|
+
],
|
|
465
|
+
'Pane.Footer': [
|
|
466
|
+
...COMMON_PROHIBITED_ATTRS,
|
|
467
|
+
...SHADOW_ATTRS,
|
|
468
|
+
...WIDTH_ATTRS,
|
|
469
|
+
...HEIGHT_ATTRS,
|
|
470
|
+
...MARGIN_ATTRS,
|
|
471
|
+
],
|
|
472
|
+
'Pane.CloseButton': [
|
|
473
|
+
...COMMON_PROHIBITED_ATTRS,
|
|
474
|
+
...SHADOW_ATTRS,
|
|
475
|
+
...WIDTH_ATTRS,
|
|
476
|
+
...HEIGHT_ATTRS,
|
|
477
|
+
...MARGIN_ATTRS,
|
|
478
|
+
],
|
|
444
479
|
Portlet: COMMON_PROHIBITED_ATTRS,
|
|
445
480
|
Progress: [
|
|
446
481
|
...COMMON_PROHIBITED_ATTRS,
|
|
@@ -745,7 +780,27 @@ const SX_RULESET_MAP = Object.assign(Object.assign({}, RULESET_MAP), { Alert: [.
|
|
|
745
780
|
...RULESET_MAP.PageHeader,
|
|
746
781
|
...COMMON_SX_PROHIBITED_ATTRS,
|
|
747
782
|
...SX_MARGIN_ATTRS,
|
|
748
|
-
], Pagination: [...RULESET_MAP.Pagination, ...COMMON_SX_PROHIBITED_ATTRS],
|
|
783
|
+
], Pagination: [...RULESET_MAP.Pagination, ...COMMON_SX_PROHIBITED_ATTRS], Pane: [
|
|
784
|
+
...RULESET_MAP.Pane,
|
|
785
|
+
...COMMON_SX_PROHIBITED_ATTRS,
|
|
786
|
+
...SX_MARGIN_ATTRS,
|
|
787
|
+
], 'Pane.Header': [
|
|
788
|
+
...RULESET_MAP['Pane.Header'],
|
|
789
|
+
...COMMON_SX_PROHIBITED_ATTRS,
|
|
790
|
+
...SX_MARGIN_ATTRS,
|
|
791
|
+
], 'Pane.Body': [
|
|
792
|
+
...RULESET_MAP['Pane.Body'],
|
|
793
|
+
...COMMON_SX_PROHIBITED_ATTRS,
|
|
794
|
+
...SX_MARGIN_ATTRS,
|
|
795
|
+
], 'Pane.Footer': [
|
|
796
|
+
...RULESET_MAP['Pane.Footer'],
|
|
797
|
+
...COMMON_SX_PROHIBITED_ATTRS,
|
|
798
|
+
...SX_MARGIN_ATTRS,
|
|
799
|
+
], 'Pane.CloseButton': [
|
|
800
|
+
...RULESET_MAP['Pane.CloseButton'],
|
|
801
|
+
...COMMON_SX_PROHIBITED_ATTRS,
|
|
802
|
+
...SX_MARGIN_ATTRS,
|
|
803
|
+
], Portlet: [...RULESET_MAP.Portlet, ...COMMON_SX_PROHIBITED_ATTRS], Progress: [...RULESET_MAP.Progress, ...COMMON_SX_PROHIBITED_ATTRS], 'Progress.Circle': [
|
|
749
804
|
...RULESET_MAP['Progress.Circle'],
|
|
750
805
|
...COMMON_SX_PROHIBITED_ATTRS,
|
|
751
806
|
], Radio: [...RULESET_MAP.Radio, ...COMMON_SX_PROHIBITED_ATTRS], 'Radio.Group': [...RULESET_MAP['Radio.Group'], ...COMMON_SX_PROHIBITED_ATTRS], 'Radio.Button': [
|
|
@@ -828,6 +883,7 @@ const HD_COMPONENTS = [
|
|
|
828
883
|
'Notification',
|
|
829
884
|
'PageHeader',
|
|
830
885
|
'Pagination',
|
|
886
|
+
'Pane',
|
|
831
887
|
'Portal',
|
|
832
888
|
'Portlet',
|
|
833
889
|
'Progress',
|
|
@@ -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", "FilterTrigger"];
|
|
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[])[];
|
|
@@ -77,6 +77,7 @@ declare const MOBILE_RULESET_MAP: {
|
|
|
77
77
|
Tag: string[];
|
|
78
78
|
TextInput: string[];
|
|
79
79
|
FormGroup: string[];
|
|
80
|
+
SegmentedControl: string[];
|
|
80
81
|
TimePicker: string[];
|
|
81
82
|
'Toast.Container': string[];
|
|
82
83
|
'Toast.Provider': string[];
|
|
@@ -127,6 +127,7 @@ const HD_MOBILE_COMPONENTS = [
|
|
|
127
127
|
'Search',
|
|
128
128
|
'FloatingIsland',
|
|
129
129
|
'FilterTrigger',
|
|
130
|
+
'SegmentedControl',
|
|
130
131
|
];
|
|
131
132
|
exports.HD_MOBILE_COMPONENTS = HD_MOBILE_COMPONENTS;
|
|
132
133
|
// Not common: MARGIN_ATTRS, WIDTH_ATTRS, HEIGHT_ATTRS
|
|
@@ -360,6 +361,7 @@ const MOBILE_RULESET_MAP = {
|
|
|
360
361
|
...HEIGHT_ATTRS,
|
|
361
362
|
],
|
|
362
363
|
FormGroup: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
364
|
+
SegmentedControl: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
363
365
|
TimePicker: [
|
|
364
366
|
...PADDING_ATTRS,
|
|
365
367
|
...BORDER_ATTRS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as recast from 'recast';
|
|
2
|
-
import { InlineStyleProps, ViolatingAttribute } from './reportInlineStyle';
|
|
2
|
+
import type { InlineStyleProps, ViolatingAttribute } from './reportInlineStyle';
|
|
3
3
|
import type { CompoundMobileComponentName, MobileComponentName } from './types';
|
|
4
4
|
export declare const getNonApprovedInlineLocs: (reportedLocs: {
|
|
5
5
|
style?: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { HD_MOBILE_COMPONENTS, MOBILE_RULESET_MAP } from './constants';
|
|
1
|
+
import type { HD_MOBILE_COMPONENTS, MOBILE_RULESET_MAP } from './constants';
|
|
2
2
|
export type MobileComponentName = typeof HD_MOBILE_COMPONENTS[number];
|
|
3
3
|
export type CompoundMobileComponentName = keyof typeof MOBILE_RULESET_MAP;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as recast from 'recast';
|
|
2
|
-
import { AdditionalProp, InlineStyleProps } from './reportInlineStyle';
|
|
2
|
+
import type { AdditionalProp, InlineStyleProps } from './reportInlineStyle';
|
|
3
3
|
import type { ComponentName, CompoundComponentName } from './types';
|
|
4
4
|
declare const reportCustomProperties: (ast: recast.types.ASTNode, componentList: {
|
|
5
5
|
[k: string]: ComponentName;
|