@nordcraft/search 1.0.79 → 1.0.81
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/dist/rules/issues/actions/duplicateActionArgumentNameRule.test.js +3 -3
- package/dist/rules/issues/actions/duplicateActionArgumentNameRule.test.js.map +1 -1
- package/dist/rules/issues/actions/legacyActionRule.test.js +1 -1
- package/dist/rules/issues/actions/legacyActionRule.test.js.map +1 -1
- package/dist/rules/issues/actions/noReferenceProjectActionRule.test.js +1 -1
- package/dist/rules/issues/actions/noReferenceProjectActionRule.test.js.map +1 -1
- package/dist/rules/issues/actions/unknownActionArgumentRule.test.js +1 -1
- package/dist/rules/issues/actions/unknownActionArgumentRule.test.js.map +1 -1
- package/dist/rules/issues/actions/unknownActionEventRule.test.js +1 -1
- package/dist/rules/issues/actions/unknownActionEventRule.test.js.map +1 -1
- package/dist/rules/issues/actions/unknownProjectActionRule.test.js +1 -1
- package/dist/rules/issues/actions/unknownProjectActionRule.test.js.map +1 -1
- package/dist/rules/issues/apis/legacyApiRule.test.js +1 -1
- package/dist/rules/issues/apis/legacyApiRule.test.js.map +1 -1
- package/dist/rules/issues/apis/noReferenceApiRule.js +21 -1
- package/dist/rules/issues/apis/noReferenceApiRule.js.map +1 -1
- package/dist/rules/issues/apis/noReferenceApiRule.test.js +274 -0
- package/dist/rules/issues/apis/noReferenceApiRule.test.js.map +1 -1
- package/dist/rules/issues/context/noContextConsumersRule.test.js +3 -3
- package/dist/rules/issues/context/noContextConsumersRule.test.js.map +1 -1
- package/dist/rules/issues/context/unknownContextFormulaRule.test.js +1 -1
- package/dist/rules/issues/context/unknownContextFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/context/unknownContextProviderFormulaRule.test.js +1 -1
- package/dist/rules/issues/context/unknownContextProviderFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/context/unknownContextProviderRule.test.js +1 -1
- package/dist/rules/issues/context/unknownContextProviderRule.test.js.map +1 -1
- package/dist/rules/issues/dom/createRequiredDirectChildRule.test.js +1 -1
- package/dist/rules/issues/dom/createRequiredDirectChildRule.test.js.map +1 -1
- package/dist/rules/issues/dom/createRequiredDirectParentRule.test.js +1 -1
- package/dist/rules/issues/dom/createRequiredDirectParentRule.test.js.map +1 -1
- package/dist/rules/issues/dom/createRequiredElementAttributeRule.test.js +3 -3
- package/dist/rules/issues/dom/createRequiredElementAttributeRule.test.js.map +1 -1
- package/dist/rules/issues/dom/elementWithoutInteractiveContentRule.test.js +3 -3
- package/dist/rules/issues/dom/elementWithoutInteractiveContentRule.test.js.map +1 -1
- package/dist/rules/issues/dom/imageWithoutDimensionRule.test.js +4 -4
- package/dist/rules/issues/dom/imageWithoutDimensionRule.test.js.map +1 -1
- package/dist/rules/issues/dom/nonEmptyVoidElementRule.test.js +1 -1
- package/dist/rules/issues/dom/nonEmptyVoidElementRule.test.js.map +1 -1
- package/dist/rules/issues/events/duplicateEventTriggerRule.test.js +1 -1
- package/dist/rules/issues/events/duplicateEventTriggerRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/duplicateFormulaArgumentNameRule.test.js +2 -2
- package/dist/rules/issues/formulas/duplicateFormulaArgumentNameRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/noReferenceProjectFormulaRule.test.js +1 -1
- package/dist/rules/issues/formulas/noReferenceProjectFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/unknownComponentFormulaInputRule.test.js +2 -2
- package/dist/rules/issues/formulas/unknownComponentFormulaInputRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/unknownProjectFormulaInputRule.test.js +2 -2
- package/dist/rules/issues/formulas/unknownProjectFormulaInputRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/unknownProjectFormulaRule.test.js +55 -1
- package/dist/rules/issues/formulas/unknownProjectFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/unknownRepeatIndexFormulaRule.test.js +1 -1
- package/dist/rules/issues/formulas/unknownRepeatIndexFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/formulas/unknownRepeatItemFormulaRule.test.js +1 -1
- package/dist/rules/issues/formulas/unknownRepeatItemFormulaRule.test.js.map +1 -1
- package/dist/rules/issues/logic/noStaticNodeCondition.test.js +1 -1
- package/dist/rules/issues/logic/noStaticNodeCondition.test.js.map +1 -1
- package/dist/rules/issues/logic/noUnnecessaryConditionFalsy.test.js +1 -1
- package/dist/rules/issues/logic/noUnnecessaryConditionFalsy.test.js.map +1 -1
- package/dist/rules/issues/logic/noUnnecessaryConditionTruthy.test.js +1 -1
- package/dist/rules/issues/logic/noUnnecessaryConditionTruthy.test.js.map +1 -1
- package/dist/rules/issues/miscellaneous/requireExtensionRule.test.js +1 -1
- package/dist/rules/issues/miscellaneous/requireExtensionRule.test.js.map +1 -1
- package/dist/rules/issues/miscellaneous/unknownCookieRule.test.js +1 -1
- package/dist/rules/issues/miscellaneous/unknownCookieRule.test.js.map +1 -1
- package/dist/rules/issues/routing/duplicateRouteRule.test.js +1 -1
- package/dist/rules/issues/routing/duplicateRouteRule.test.js.map +1 -1
- package/dist/rules/issues/routing/duplicateUrlParameterRule.test.js +1 -1
- package/dist/rules/issues/routing/duplicateUrlParameterRule.test.js.map +1 -1
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.js +32 -11
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.js.map +1 -1
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.test.js +55 -1
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.test.js.map +1 -1
- package/dist/rules/issues/style/styleRules.index.js +2 -0
- package/dist/rules/issues/style/styleRules.index.js.map +1 -1
- package/dist/rules/issues/style/unknownCSSVariable.js +78 -0
- package/dist/rules/issues/style/unknownCSSVariable.js.map +1 -0
- package/dist/rules/issues/style/unknownCSSVariable.test.js +337 -0
- package/dist/rules/issues/style/unknownCSSVariable.test.js.map +1 -0
- package/dist/rules/issues/workflows/duplicateWorkflowParameterRule.test.js +1 -1
- package/dist/rules/issues/workflows/duplicateWorkflowParameterRule.test.js.map +1 -1
- package/dist/rules/issues/workflows/noPostNavigateAction.test.js +1 -1
- package/dist/rules/issues/workflows/noPostNavigateAction.test.js.map +1 -1
- package/dist/rules/issues/workflows/unknownContextProviderWorkflowRule.test.js +1 -1
- package/dist/rules/issues/workflows/unknownContextProviderWorkflowRule.test.js.map +1 -1
- package/dist/rules/issues/workflows/unknownContextWorkflowRule.test.js +1 -1
- package/dist/rules/issues/workflows/unknownContextWorkflowRule.test.js.map +1 -1
- package/dist/rules/issues/workflows/unknownTriggerWorkflowParameterRule.test.js +3 -3
- package/dist/rules/issues/workflows/unknownTriggerWorkflowParameterRule.test.js.map +1 -1
- package/dist/rules/issues/workflows/unknownTriggerWorkflowRule.test.js +1 -1
- package/dist/rules/issues/workflows/unknownTriggerWorkflowRule.test.js.map +1 -1
- package/dist/rules/issues/workflows/unknownWorkflowParameterRule.test.js +1 -1
- package/dist/rules/issues/workflows/unknownWorkflowParameterRule.test.js.map +1 -1
- package/dist/searchProject.js +10 -2
- package/dist/searchProject.js.map +1 -1
- package/package.json +3 -3
- package/src/rules/issues/actions/duplicateActionArgumentNameRule.test.ts +3 -3
- package/src/rules/issues/actions/legacyActionRule.test.ts +1 -1
- package/src/rules/issues/actions/noReferenceProjectActionRule.test.ts +1 -1
- package/src/rules/issues/actions/unknownActionArgumentRule.test.ts +1 -1
- package/src/rules/issues/actions/unknownActionEventRule.test.ts +1 -1
- package/src/rules/issues/actions/unknownProjectActionRule.test.ts +1 -1
- package/src/rules/issues/apis/legacyApiRule.test.ts +1 -1
- package/src/rules/issues/apis/noReferenceApiRule.test.ts +283 -0
- package/src/rules/issues/apis/noReferenceApiRule.ts +29 -1
- package/src/rules/issues/context/noContextConsumersRule.test.ts +3 -3
- package/src/rules/issues/context/unknownContextFormulaRule.test.ts +1 -1
- package/src/rules/issues/context/unknownContextProviderFormulaRule.test.ts +1 -1
- package/src/rules/issues/context/unknownContextProviderRule.test.ts +1 -1
- package/src/rules/issues/dom/createRequiredDirectChildRule.test.ts +1 -1
- package/src/rules/issues/dom/createRequiredDirectParentRule.test.ts +1 -1
- package/src/rules/issues/dom/createRequiredElementAttributeRule.test.ts +3 -3
- package/src/rules/issues/dom/elementWithoutInteractiveContentRule.test.ts +3 -3
- package/src/rules/issues/dom/imageWithoutDimensionRule.test.ts +4 -4
- package/src/rules/issues/dom/nonEmptyVoidElementRule.test.ts +1 -1
- package/src/rules/issues/events/duplicateEventTriggerRule.test.ts +1 -1
- package/src/rules/issues/formulas/duplicateFormulaArgumentNameRule.test.ts +2 -2
- package/src/rules/issues/formulas/noReferenceProjectFormulaRule.test.ts +1 -1
- package/src/rules/issues/formulas/unknownComponentFormulaInputRule.test.ts +2 -2
- package/src/rules/issues/formulas/unknownProjectFormulaInputRule.test.ts +2 -2
- package/src/rules/issues/formulas/unknownProjectFormulaRule.test.ts +59 -1
- package/src/rules/issues/formulas/unknownRepeatIndexFormulaRule.test.ts +1 -1
- package/src/rules/issues/formulas/unknownRepeatItemFormulaRule.test.ts +1 -1
- package/src/rules/issues/logic/noStaticNodeCondition.test.ts +1 -1
- package/src/rules/issues/logic/noUnnecessaryConditionFalsy.test.ts +1 -1
- package/src/rules/issues/logic/noUnnecessaryConditionTruthy.test.ts +1 -1
- package/src/rules/issues/miscellaneous/requireExtensionRule.test.ts +1 -1
- package/src/rules/issues/miscellaneous/unknownCookieRule.test.ts +1 -1
- package/src/rules/issues/routing/duplicateRouteRule.test.ts +1 -1
- package/src/rules/issues/routing/duplicateUrlParameterRule.test.ts +1 -1
- package/src/rules/issues/style/noReferenceGlobalCSSVariable.test.ts +59 -1
- package/src/rules/issues/style/noReferenceGlobalCSSVariable.ts +38 -12
- package/src/rules/issues/style/styleRules.index.ts +2 -0
- package/src/rules/issues/style/unknownCSSVariable.test.ts +364 -0
- package/src/rules/issues/style/unknownCSSVariable.ts +101 -0
- package/src/rules/issues/workflows/duplicateWorkflowParameterRule.test.ts +1 -1
- package/src/rules/issues/workflows/noPostNavigateAction.test.ts +1 -1
- package/src/rules/issues/workflows/unknownContextProviderWorkflowRule.test.ts +1 -1
- package/src/rules/issues/workflows/unknownContextWorkflowRule.test.ts +1 -1
- package/src/rules/issues/workflows/unknownTriggerWorkflowParameterRule.test.ts +3 -3
- package/src/rules/issues/workflows/unknownTriggerWorkflowRule.test.ts +1 -1
- package/src/rules/issues/workflows/unknownWorkflowParameterRule.test.ts +1 -1
- package/src/searchProject.ts +12 -0
- package/src/types.d.ts +1 -0
|
@@ -122,7 +122,7 @@ describe('noContextConsumersRule', () => {
|
|
|
122
122
|
}),
|
|
123
123
|
)
|
|
124
124
|
|
|
125
|
-
expect(problems).
|
|
125
|
+
expect(problems).toBeEmpty()
|
|
126
126
|
})
|
|
127
127
|
test('should not detect component with exposed workflows/formulas when a slot exists', () => {
|
|
128
128
|
const problems = Array.from(
|
|
@@ -177,7 +177,7 @@ describe('noContextConsumersRule', () => {
|
|
|
177
177
|
}),
|
|
178
178
|
)
|
|
179
179
|
|
|
180
|
-
expect(problems).
|
|
180
|
+
expect(problems).toBeEmpty()
|
|
181
181
|
})
|
|
182
182
|
test('should not detect component with exposed workflows/formulas when a child component exists', () => {
|
|
183
183
|
const problems = Array.from(
|
|
@@ -235,6 +235,6 @@ describe('noContextConsumersRule', () => {
|
|
|
235
235
|
}),
|
|
236
236
|
)
|
|
237
237
|
|
|
238
|
-
expect(problems).
|
|
238
|
+
expect(problems).toBeEmpty()
|
|
239
239
|
})
|
|
240
240
|
})
|
|
@@ -119,7 +119,7 @@ describe('requiredElementAttributeRule', () => {
|
|
|
119
119
|
}),
|
|
120
120
|
)
|
|
121
121
|
|
|
122
|
-
expect(problems).
|
|
122
|
+
expect(problems).toBeEmpty()
|
|
123
123
|
})
|
|
124
124
|
test('should not detect issues when elements have all required attributes', () => {
|
|
125
125
|
const problems = Array.from(
|
|
@@ -155,7 +155,7 @@ describe('requiredElementAttributeRule', () => {
|
|
|
155
155
|
}),
|
|
156
156
|
)
|
|
157
157
|
|
|
158
|
-
expect(problems).
|
|
158
|
+
expect(problems).toBeEmpty()
|
|
159
159
|
})
|
|
160
160
|
|
|
161
161
|
test('should report if attribute is false or null, as such attributes are not rendered', () => {
|
|
@@ -256,6 +256,6 @@ describe('requiredElementAttributeRule', () => {
|
|
|
256
256
|
}),
|
|
257
257
|
)
|
|
258
258
|
|
|
259
|
-
expect(problems).
|
|
259
|
+
expect(problems).toBeEmpty()
|
|
260
260
|
})
|
|
261
261
|
})
|
|
@@ -216,7 +216,7 @@ describe('elementWithoutInteractiveContentRule', () => {
|
|
|
216
216
|
rules: [elementWithoutInteractiveContentRule],
|
|
217
217
|
}),
|
|
218
218
|
)
|
|
219
|
-
expect(problems).
|
|
219
|
+
expect(problems).toBeEmpty()
|
|
220
220
|
})
|
|
221
221
|
test('should detect invalid children when negative attribute requirement is met', () => {
|
|
222
222
|
const problems = Array.from(
|
|
@@ -265,7 +265,7 @@ describe('elementWithoutInteractiveContentRule', () => {
|
|
|
265
265
|
rules: [elementWithoutInteractiveContentRule],
|
|
266
266
|
}),
|
|
267
267
|
)
|
|
268
|
-
expect(problems).
|
|
268
|
+
expect(problems).toBeEmpty()
|
|
269
269
|
})
|
|
270
270
|
test('should detect invalid label in button element in nested component', () => {
|
|
271
271
|
const problems = Array.from(
|
|
@@ -396,6 +396,6 @@ describe('elementWithoutInteractiveContentRule', () => {
|
|
|
396
396
|
}),
|
|
397
397
|
)
|
|
398
398
|
|
|
399
|
-
expect(problems).
|
|
399
|
+
expect(problems).toBeEmpty()
|
|
400
400
|
})
|
|
401
401
|
})
|
|
@@ -77,7 +77,7 @@ describe('imageWithoutDimensionRule', () => {
|
|
|
77
77
|
}),
|
|
78
78
|
)
|
|
79
79
|
|
|
80
|
-
expect(problems).
|
|
80
|
+
expect(problems).toBeEmpty()
|
|
81
81
|
})
|
|
82
82
|
|
|
83
83
|
test('should report if image has width but no height', () => {
|
|
@@ -246,7 +246,7 @@ describe('imageWithoutDimensionRule', () => {
|
|
|
246
246
|
}),
|
|
247
247
|
)
|
|
248
248
|
|
|
249
|
-
expect(problems).
|
|
249
|
+
expect(problems).toBeEmpty()
|
|
250
250
|
})
|
|
251
251
|
|
|
252
252
|
test('should not report if dimensions are dynamic', () => {
|
|
@@ -288,7 +288,7 @@ describe('imageWithoutDimensionRule', () => {
|
|
|
288
288
|
}),
|
|
289
289
|
)
|
|
290
290
|
|
|
291
|
-
expect(problems).
|
|
291
|
+
expect(problems).toBeEmpty()
|
|
292
292
|
})
|
|
293
293
|
|
|
294
294
|
test('should not report non-image elements', () => {
|
|
@@ -321,7 +321,7 @@ describe('imageWithoutDimensionRule', () => {
|
|
|
321
321
|
}),
|
|
322
322
|
)
|
|
323
323
|
|
|
324
|
-
expect(problems).
|
|
324
|
+
expect(problems).toBeEmpty()
|
|
325
325
|
})
|
|
326
326
|
|
|
327
327
|
test('should report if dimensions are set to non-static keywords (auto | empty string)', () => {
|
|
@@ -106,7 +106,7 @@ describe('duplicateFormulaArgumentNameRule', () => {
|
|
|
106
106
|
}),
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
-
expect(problems).
|
|
109
|
+
expect(problems).toBeEmpty()
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
test('should detect multiple duplicates', () => {
|
|
@@ -175,6 +175,6 @@ describe('duplicateFormulaArgumentNameRule', () => {
|
|
|
175
175
|
}),
|
|
176
176
|
)
|
|
177
177
|
|
|
178
|
-
expect(problems).
|
|
178
|
+
expect(problems).toBeEmpty()
|
|
179
179
|
})
|
|
180
180
|
})
|
|
@@ -89,7 +89,7 @@ describe('unknownComponentFormulaInput', () => {
|
|
|
89
89
|
}),
|
|
90
90
|
)
|
|
91
91
|
|
|
92
|
-
expect(problems).
|
|
92
|
+
expect(problems).toBeEmpty()
|
|
93
93
|
})
|
|
94
94
|
test('should not detect @toddle.parent/item path formulas', () => {
|
|
95
95
|
const problems = Array.from(
|
|
@@ -136,6 +136,6 @@ describe('unknownComponentFormulaInput', () => {
|
|
|
136
136
|
}),
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
expect(problems).
|
|
139
|
+
expect(problems).toBeEmpty()
|
|
140
140
|
})
|
|
141
141
|
})
|
|
@@ -70,7 +70,7 @@ describe('unknownProjectFormulaInput', () => {
|
|
|
70
70
|
}),
|
|
71
71
|
)
|
|
72
72
|
|
|
73
|
-
expect(problems).
|
|
73
|
+
expect(problems).toBeEmpty()
|
|
74
74
|
})
|
|
75
75
|
test('should not detect @toddle.parent/item path formulas', () => {
|
|
76
76
|
const problems = Array.from(
|
|
@@ -107,6 +107,6 @@ describe('unknownProjectFormulaInput', () => {
|
|
|
107
107
|
}),
|
|
108
108
|
)
|
|
109
109
|
|
|
110
|
-
expect(problems).
|
|
110
|
+
expect(problems).toBeEmpty()
|
|
111
111
|
})
|
|
112
112
|
})
|
|
@@ -121,6 +121,64 @@ describe('unknownProjectFormulaRule', () => {
|
|
|
121
121
|
}),
|
|
122
122
|
)
|
|
123
123
|
|
|
124
|
-
expect(problems).
|
|
124
|
+
expect(problems).toBeEmpty()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('should not report unknown formulas from within packages', () => {
|
|
128
|
+
const problems = Array.from(
|
|
129
|
+
searchProject({
|
|
130
|
+
files: {
|
|
131
|
+
formulas: {},
|
|
132
|
+
packages: {
|
|
133
|
+
'my-package': {
|
|
134
|
+
components: {},
|
|
135
|
+
actions: {},
|
|
136
|
+
formulas: {
|
|
137
|
+
'package-formula': {
|
|
138
|
+
formula: {
|
|
139
|
+
type: 'function',
|
|
140
|
+
name: 'non-existent-formula',
|
|
141
|
+
arguments: [],
|
|
142
|
+
},
|
|
143
|
+
name: 'package-formula',
|
|
144
|
+
arguments: [],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
manifest: {
|
|
148
|
+
name: 'my-package',
|
|
149
|
+
commit: '123',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
components: {
|
|
154
|
+
test: {
|
|
155
|
+
name: 'test',
|
|
156
|
+
nodes: {
|
|
157
|
+
root: {
|
|
158
|
+
type: 'element',
|
|
159
|
+
attrs: {
|
|
160
|
+
test: functionFormula('package-formula', {
|
|
161
|
+
package: 'my-package',
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
164
|
+
classes: {},
|
|
165
|
+
events: {},
|
|
166
|
+
tag: 'div',
|
|
167
|
+
children: [],
|
|
168
|
+
style: {},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
formulas: {},
|
|
172
|
+
apis: {},
|
|
173
|
+
attributes: {},
|
|
174
|
+
variables: {},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
rules: [unknownProjectFormulaRule],
|
|
179
|
+
}),
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
expect(problems).toBeEmpty()
|
|
125
183
|
})
|
|
126
184
|
})
|
|
@@ -57,7 +57,7 @@ describe('noReferenceGlobalCSSVariableRule', () => {
|
|
|
57
57
|
}),
|
|
58
58
|
)
|
|
59
59
|
|
|
60
|
-
expect(problems).
|
|
60
|
+
expect(problems).toBeEmpty()
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
test('should report global CSS variables that are never used', () => {
|
|
@@ -243,4 +243,62 @@ describe('noReferenceGlobalCSSVariableRule', () => {
|
|
|
243
243
|
expect(problems[0].details).toEqual({ name: '--local-color' })
|
|
244
244
|
expect(problems[1].details).toEqual({ name: '--a-third-local-color' })
|
|
245
245
|
})
|
|
246
|
+
|
|
247
|
+
test('should not report when variable is used in package components', () => {
|
|
248
|
+
const problems = Array.from(
|
|
249
|
+
searchProject({
|
|
250
|
+
files: {
|
|
251
|
+
themes: {
|
|
252
|
+
Default: {
|
|
253
|
+
fonts: [],
|
|
254
|
+
propertyDefinitions: {
|
|
255
|
+
'--global-color': {
|
|
256
|
+
syntax: { type: 'primitive', name: 'color' },
|
|
257
|
+
description: 'A global color',
|
|
258
|
+
inherits: true,
|
|
259
|
+
initialValue: 'blue',
|
|
260
|
+
values: {},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
formulas: {},
|
|
266
|
+
components: {},
|
|
267
|
+
packages: [
|
|
268
|
+
{
|
|
269
|
+
manifest: {
|
|
270
|
+
name: 'Test Package',
|
|
271
|
+
commit: '',
|
|
272
|
+
},
|
|
273
|
+
components: {
|
|
274
|
+
PackageComponent: {
|
|
275
|
+
name: 'PackageComponent',
|
|
276
|
+
nodes: {
|
|
277
|
+
root: {
|
|
278
|
+
tag: 'div',
|
|
279
|
+
type: 'element',
|
|
280
|
+
attrs: {},
|
|
281
|
+
style: {
|
|
282
|
+
color: 'var(--global-color)',
|
|
283
|
+
},
|
|
284
|
+
events: {},
|
|
285
|
+
classes: {},
|
|
286
|
+
children: [],
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
formulas: {},
|
|
290
|
+
apis: {},
|
|
291
|
+
attributes: {},
|
|
292
|
+
variables: {},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
] as any,
|
|
297
|
+
},
|
|
298
|
+
rules: [noReferenceGlobalCSSVariableRule],
|
|
299
|
+
}),
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
expect(problems).toBeEmpty()
|
|
303
|
+
})
|
|
246
304
|
})
|
|
@@ -28,12 +28,11 @@ export const noReferenceGlobalCSSVariableRule: Rule<{
|
|
|
28
28
|
;[{ style: node.style }, ...(node.variants ?? [])].forEach(
|
|
29
29
|
({ style }) => {
|
|
30
30
|
Object.values(style ?? {}).forEach((styleValue) => {
|
|
31
|
-
if (typeof styleValue
|
|
32
|
-
|
|
31
|
+
if (typeof styleValue === 'string') {
|
|
32
|
+
styleValue.matchAll(REGEX).forEach(([_, varName]) => {
|
|
33
|
+
vars.add(varName)
|
|
34
|
+
})
|
|
33
35
|
}
|
|
34
|
-
styleValue.matchAll(REGEX).forEach(([_, varName]) => {
|
|
35
|
-
vars.add(varName)
|
|
36
|
-
})
|
|
37
36
|
})
|
|
38
37
|
},
|
|
39
38
|
)
|
|
@@ -45,6 +44,34 @@ export const noReferenceGlobalCSSVariableRule: Rule<{
|
|
|
45
44
|
},
|
|
46
45
|
)
|
|
47
46
|
|
|
47
|
+
const usedCSSVariablesInPackageComponents = memo(
|
|
48
|
+
'css-variables-used-in-package-components',
|
|
49
|
+
() => {
|
|
50
|
+
const vars = new Set<string>()
|
|
51
|
+
Object.values(files.packages ?? {}).forEach((pkg) => {
|
|
52
|
+
Object.values(pkg?.components ?? {}).forEach((component) => {
|
|
53
|
+
Object.values(component?.nodes ?? {}).forEach((node) => {
|
|
54
|
+
if (node.type === 'element' || node.type === 'component') {
|
|
55
|
+
;[{ style: node.style }, ...(node.variants ?? [])].forEach(
|
|
56
|
+
({ style }) => {
|
|
57
|
+
Object.values(style ?? {}).forEach((styleValue) => {
|
|
58
|
+
if (typeof styleValue === 'string') {
|
|
59
|
+
styleValue.matchAll(REGEX).forEach(([_, varName]) => {
|
|
60
|
+
vars.add(varName)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
return vars
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
48
75
|
const usedCSSVariablesInCSSVariables = memo(
|
|
49
76
|
'css-variables-used-in-css-variables',
|
|
50
77
|
() => {
|
|
@@ -52,13 +79,11 @@ export const noReferenceGlobalCSSVariableRule: Rule<{
|
|
|
52
79
|
Object.values(theme.propertyDefinitions ?? {}).forEach((propDef) => {
|
|
53
80
|
;[...Object.values(propDef.values), propDef.initialValue].forEach(
|
|
54
81
|
(val) => {
|
|
55
|
-
if (typeof val
|
|
56
|
-
|
|
82
|
+
if (typeof val === 'string') {
|
|
83
|
+
val.matchAll(REGEX).forEach(([_, varName]) => {
|
|
84
|
+
vars.add(varName)
|
|
85
|
+
})
|
|
57
86
|
}
|
|
58
|
-
|
|
59
|
-
val.matchAll(REGEX).forEach(([_, varName]) => {
|
|
60
|
-
vars.add(varName)
|
|
61
|
-
})
|
|
62
87
|
},
|
|
63
88
|
)
|
|
64
89
|
})
|
|
@@ -69,7 +94,8 @@ export const noReferenceGlobalCSSVariableRule: Rule<{
|
|
|
69
94
|
|
|
70
95
|
if (
|
|
71
96
|
usedCSSVariablesInCSSVariables.has(value.key) ||
|
|
72
|
-
usedCSSVariablesInComponents.has(value.key)
|
|
97
|
+
usedCSSVariablesInComponents.has(value.key) ||
|
|
98
|
+
usedCSSVariablesInPackageComponents.has(value.key)
|
|
73
99
|
) {
|
|
74
100
|
return
|
|
75
101
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { invalidStyleSyntaxRule } from './invalidStyleSyntaxRule'
|
|
2
2
|
import { noReferenceGlobalCSSVariableRule } from './noReferenceGlobalCSSVariable'
|
|
3
3
|
import { unknownClassnameRule } from './unknownClassnameRule'
|
|
4
|
+
import { unknownCSSVariableRule } from './unknownCSSVariable'
|
|
4
5
|
|
|
5
6
|
export default [
|
|
6
7
|
invalidStyleSyntaxRule,
|
|
7
8
|
unknownClassnameRule,
|
|
9
|
+
unknownCSSVariableRule,
|
|
8
10
|
noReferenceGlobalCSSVariableRule,
|
|
9
11
|
]
|