@nordcraft/search 1.0.66 → 1.0.67
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/actionRules.index.js +2 -0
- package/dist/rules/issues/actions/actionRules.index.js.map +1 -1
- package/dist/rules/issues/actions/unknownActionArgumentRule.js +37 -0
- package/dist/rules/issues/actions/unknownActionArgumentRule.js.map +1 -0
- package/dist/rules/issues/actions/unknownActionArgumentRule.test.js +306 -0
- package/dist/rules/issues/actions/unknownActionArgumentRule.test.js.map +1 -0
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.js +57 -0
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.js.map +1 -0
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.test.js +230 -0
- package/dist/rules/issues/style/noReferenceGlobalCSSVariable.test.js.map +1 -0
- package/dist/rules/issues/style/styleRules.index.js +6 -1
- package/dist/rules/issues/style/styleRules.index.js.map +1 -1
- package/dist/searchProject.js +43 -0
- package/dist/searchProject.js.map +1 -1
- package/package.json +3 -3
- package/src/rules/issues/actions/actionRules.index.ts +2 -0
- package/src/rules/issues/actions/unknownActionArgumentRule.test.ts +319 -0
- package/src/rules/issues/actions/unknownActionArgumentRule.ts +51 -0
- package/src/rules/issues/style/noReferenceGlobalCSSVariable.test.ts +246 -0
- package/src/rules/issues/style/noReferenceGlobalCSSVariable.ts +78 -0
- package/src/rules/issues/style/styleRules.index.ts +6 -1
- package/src/searchProject.ts +47 -0
- package/src/types.d.ts +26 -0
package/src/searchProject.ts
CHANGED
|
@@ -134,6 +134,25 @@ export function* searchProject({
|
|
|
134
134
|
state,
|
|
135
135
|
fixOptions: fixOptions as any,
|
|
136
136
|
})
|
|
137
|
+
for (const propKey in files.themes[key].propertyDefinitions ?? {}) {
|
|
138
|
+
const propDef = files.themes[key].propertyDefinitions?.[propKey as any]
|
|
139
|
+
if (propDef) {
|
|
140
|
+
yield* visitNode({
|
|
141
|
+
args: {
|
|
142
|
+
nodeType: 'project-theme-property',
|
|
143
|
+
value: { key: propKey, value: propDef },
|
|
144
|
+
path: ['themes', key, 'propertyDefinitions', propKey],
|
|
145
|
+
rules,
|
|
146
|
+
files,
|
|
147
|
+
pathsToVisit,
|
|
148
|
+
useExactPaths,
|
|
149
|
+
memo,
|
|
150
|
+
},
|
|
151
|
+
state,
|
|
152
|
+
fixOptions: fixOptions as any,
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
}
|
|
137
156
|
}
|
|
138
157
|
|
|
139
158
|
if (files.services) {
|
|
@@ -307,6 +326,7 @@ function* visitNode({
|
|
|
307
326
|
switch (nodeType) {
|
|
308
327
|
// The node types below currently don't require any further traversal
|
|
309
328
|
case 'action-model':
|
|
329
|
+
case 'action-custom-model-argument':
|
|
310
330
|
case 'component-api-input':
|
|
311
331
|
case 'component-api':
|
|
312
332
|
case 'component-attribute':
|
|
@@ -320,6 +340,7 @@ function* visitNode({
|
|
|
320
340
|
case 'project-action':
|
|
321
341
|
case 'project-config':
|
|
322
342
|
case 'project-theme':
|
|
343
|
+
case 'project-theme-property':
|
|
323
344
|
case 'style-declaration':
|
|
324
345
|
case 'style-variant':
|
|
325
346
|
break
|
|
@@ -561,6 +582,32 @@ function* visitNode({
|
|
|
561
582
|
state,
|
|
562
583
|
fixOptions: fixOptions as any,
|
|
563
584
|
})
|
|
585
|
+
if (action.type === 'Custom' || action.type === undefined) {
|
|
586
|
+
for (
|
|
587
|
+
let index = 0;
|
|
588
|
+
index < (action.arguments?.length ?? 0);
|
|
589
|
+
index++
|
|
590
|
+
) {
|
|
591
|
+
const arg = action.arguments?.[index]
|
|
592
|
+
if (arg) {
|
|
593
|
+
yield* visitNode({
|
|
594
|
+
args: {
|
|
595
|
+
nodeType: 'action-custom-model-argument',
|
|
596
|
+
value: { action, argument: arg, argumentIndex: index },
|
|
597
|
+
path: [...path, ...actionPath, 'arguments', index],
|
|
598
|
+
rules,
|
|
599
|
+
files,
|
|
600
|
+
pathsToVisit,
|
|
601
|
+
useExactPaths,
|
|
602
|
+
memo,
|
|
603
|
+
component,
|
|
604
|
+
},
|
|
605
|
+
state,
|
|
606
|
+
fixOptions: fixOptions as any,
|
|
607
|
+
})
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
564
611
|
}
|
|
565
612
|
break
|
|
566
613
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
ActionModel,
|
|
8
8
|
Component,
|
|
9
9
|
ComponentNodeModel,
|
|
10
|
+
CustomActionArgument,
|
|
11
|
+
CustomActionModel,
|
|
10
12
|
ElementNodeModel,
|
|
11
13
|
NodeModel,
|
|
12
14
|
StyleVariant,
|
|
@@ -24,6 +26,7 @@ import type {
|
|
|
24
26
|
} from '@nordcraft/ssr/dist/ssr.types'
|
|
25
27
|
import type { LegacyActionRuleFix } from './rules/issues/actions/legacyActionRule'
|
|
26
28
|
import type { NoReferenceProjectActionRuleFix } from './rules/issues/actions/noReferenceProjectActionRule'
|
|
29
|
+
import type { UnknownActionArgumentRuleFix } from './rules/issues/actions/unknownActionArgumentRule'
|
|
27
30
|
import type { NoReferenceApiRuleFix } from './rules/issues/apis/noReferenceApiRule'
|
|
28
31
|
import type { NoReferenceApiServiceRuleFix } from './rules/issues/apis/noReferenceApiServiceRule'
|
|
29
32
|
import type { UnknownApiServiceRuleFix } from './rules/issues/apis/unknownApiServiceRule'
|
|
@@ -66,6 +69,7 @@ type Code =
|
|
|
66
69
|
| 'no-reference component workflow'
|
|
67
70
|
| 'no-reference component'
|
|
68
71
|
| 'no-reference event'
|
|
72
|
+
| 'no-reference global css variable'
|
|
69
73
|
| 'no-reference node'
|
|
70
74
|
| 'no-reference project action'
|
|
71
75
|
| 'no-reference project formula'
|
|
@@ -81,6 +85,7 @@ type Code =
|
|
|
81
85
|
| 'required extension'
|
|
82
86
|
| 'required meta tag'
|
|
83
87
|
| 'image without dimension'
|
|
88
|
+
| 'unknown action argument'
|
|
84
89
|
| 'unknown api input'
|
|
85
90
|
| 'unknown api'
|
|
86
91
|
| 'unknown api service'
|
|
@@ -288,6 +293,16 @@ type ActionModelNode<A = ActionModel> = {
|
|
|
288
293
|
component: ToddleComponent<Function>
|
|
289
294
|
} & Base
|
|
290
295
|
|
|
296
|
+
type CustomActionModelArgumentNode = {
|
|
297
|
+
nodeType: 'action-custom-model-argument'
|
|
298
|
+
value: {
|
|
299
|
+
action: CustomActionModel
|
|
300
|
+
argument: CustomActionArgument
|
|
301
|
+
argumentIndex: number
|
|
302
|
+
}
|
|
303
|
+
component: ToddleComponent<Function>
|
|
304
|
+
} & Base
|
|
305
|
+
|
|
291
306
|
type ComponentContext = {
|
|
292
307
|
nodeType: 'component-context'
|
|
293
308
|
value: {
|
|
@@ -314,6 +329,14 @@ type ProjectThemeNode = {
|
|
|
314
329
|
value: Theme
|
|
315
330
|
} & Base
|
|
316
331
|
|
|
332
|
+
type ProjectThemePropertyNode = {
|
|
333
|
+
nodeType: 'project-theme-property'
|
|
334
|
+
value: {
|
|
335
|
+
key: CustomPropertyName
|
|
336
|
+
value: CustomPropertyDefinition
|
|
337
|
+
}
|
|
338
|
+
} & Base
|
|
339
|
+
|
|
317
340
|
type ProjectConfigNode = {
|
|
318
341
|
nodeType: 'project-config'
|
|
319
342
|
value: unknown
|
|
@@ -349,6 +372,7 @@ export type NodeType =
|
|
|
349
372
|
| ComponentNodeNode
|
|
350
373
|
| ComponentVariableNode
|
|
351
374
|
| ComponentWorkflowNode
|
|
375
|
+
| CustomActionModelArgumentNode
|
|
352
376
|
| FormulaNode
|
|
353
377
|
| ProjectActionNode
|
|
354
378
|
| ProjectApiService
|
|
@@ -356,6 +380,7 @@ export type NodeType =
|
|
|
356
380
|
| ProjectFormulaNode
|
|
357
381
|
| ProjectRoute
|
|
358
382
|
| ProjectThemeNode
|
|
383
|
+
| ProjectThemePropertyNode
|
|
359
384
|
| StyleNode
|
|
360
385
|
| StyleVariantNode
|
|
361
386
|
|
|
@@ -375,6 +400,7 @@ type FixType =
|
|
|
375
400
|
| NoReferenceProjectFormulaRuleFix
|
|
376
401
|
| NoReferenceVariableRuleFix
|
|
377
402
|
| NoStaticNodeConditionRuleFix
|
|
403
|
+
| UnknownActionArgumentRuleFix
|
|
378
404
|
| UnknownApiServiceRuleFix
|
|
379
405
|
| UnknownComponentAttributeRuleFix
|
|
380
406
|
|