@nordcraft/search 1.0.66 → 1.0.68
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 +4 -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/actions/unknownActionEventRule.js +26 -0
- package/dist/rules/issues/actions/unknownActionEventRule.js.map +1 -0
- package/dist/rules/issues/actions/unknownActionEventRule.test.js +281 -0
- package/dist/rules/issues/actions/unknownActionEventRule.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 +65 -0
- package/dist/searchProject.js.map +1 -1
- package/dist/util/helpers.js.map +1 -1
- package/package.json +3 -3
- package/src/rules/issues/actions/actionRules.index.ts +4 -0
- package/src/rules/issues/actions/unknownActionArgumentRule.test.ts +319 -0
- package/src/rules/issues/actions/unknownActionArgumentRule.ts +51 -0
- package/src/rules/issues/actions/unknownActionEventRule.test.ts +295 -0
- package/src/rules/issues/actions/unknownActionEventRule.ts +35 -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 +68 -0
- package/src/types.d.ts +41 -0
- package/src/util/helpers.ts +2 -4
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,8 @@ 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':
|
|
330
|
+
case 'action-custom-model-event':
|
|
310
331
|
case 'component-api-input':
|
|
311
332
|
case 'component-api':
|
|
312
333
|
case 'component-attribute':
|
|
@@ -320,6 +341,7 @@ function* visitNode({
|
|
|
320
341
|
case 'project-action':
|
|
321
342
|
case 'project-config':
|
|
322
343
|
case 'project-theme':
|
|
344
|
+
case 'project-theme-property':
|
|
323
345
|
case 'style-declaration':
|
|
324
346
|
case 'style-variant':
|
|
325
347
|
break
|
|
@@ -561,6 +583,52 @@ function* visitNode({
|
|
|
561
583
|
state,
|
|
562
584
|
fixOptions: fixOptions as any,
|
|
563
585
|
})
|
|
586
|
+
if (action.type === 'Custom' || action.type === undefined) {
|
|
587
|
+
for (
|
|
588
|
+
let index = 0;
|
|
589
|
+
index < (action.arguments?.length ?? 0);
|
|
590
|
+
index++
|
|
591
|
+
) {
|
|
592
|
+
const arg = action.arguments?.[index]
|
|
593
|
+
if (arg) {
|
|
594
|
+
yield* visitNode({
|
|
595
|
+
args: {
|
|
596
|
+
nodeType: 'action-custom-model-argument',
|
|
597
|
+
value: { action, argument: arg, argumentIndex: index },
|
|
598
|
+
path: [...path, ...actionPath, 'arguments', index],
|
|
599
|
+
rules,
|
|
600
|
+
files,
|
|
601
|
+
pathsToVisit,
|
|
602
|
+
useExactPaths,
|
|
603
|
+
memo,
|
|
604
|
+
component,
|
|
605
|
+
},
|
|
606
|
+
state,
|
|
607
|
+
fixOptions: fixOptions as any,
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const actionEvents = action.events ?? {}
|
|
612
|
+
for (const eventName in actionEvents) {
|
|
613
|
+
if (!Object.hasOwn(actionEvents, eventName)) continue
|
|
614
|
+
const event = actionEvents[eventName]
|
|
615
|
+
yield* visitNode({
|
|
616
|
+
args: {
|
|
617
|
+
nodeType: 'action-custom-model-event',
|
|
618
|
+
value: { action, event, eventName },
|
|
619
|
+
path: [...path, ...actionPath, 'events', eventName],
|
|
620
|
+
rules,
|
|
621
|
+
files,
|
|
622
|
+
pathsToVisit,
|
|
623
|
+
useExactPaths,
|
|
624
|
+
memo,
|
|
625
|
+
component,
|
|
626
|
+
},
|
|
627
|
+
state,
|
|
628
|
+
fixOptions: fixOptions as any,
|
|
629
|
+
})
|
|
630
|
+
}
|
|
631
|
+
}
|
|
564
632
|
}
|
|
565
633
|
break
|
|
566
634
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -5,8 +5,11 @@ import type {
|
|
|
5
5
|
import type {
|
|
6
6
|
ComponentEvent as _ComponentEvent,
|
|
7
7
|
ActionModel,
|
|
8
|
+
ActionModelActions,
|
|
8
9
|
Component,
|
|
9
10
|
ComponentNodeModel,
|
|
11
|
+
CustomActionArgument,
|
|
12
|
+
CustomActionModel,
|
|
10
13
|
ElementNodeModel,
|
|
11
14
|
NodeModel,
|
|
12
15
|
StyleVariant,
|
|
@@ -24,6 +27,8 @@ import type {
|
|
|
24
27
|
} from '@nordcraft/ssr/dist/ssr.types'
|
|
25
28
|
import type { LegacyActionRuleFix } from './rules/issues/actions/legacyActionRule'
|
|
26
29
|
import type { NoReferenceProjectActionRuleFix } from './rules/issues/actions/noReferenceProjectActionRule'
|
|
30
|
+
import type { UnknownActionArgumentRuleFix } from './rules/issues/actions/unknownActionArgumentRule'
|
|
31
|
+
import type { UnknownActionEventRuleFix } from './rules/issues/actions/unknownActionEventRule'
|
|
27
32
|
import type { NoReferenceApiRuleFix } from './rules/issues/apis/noReferenceApiRule'
|
|
28
33
|
import type { NoReferenceApiServiceRuleFix } from './rules/issues/apis/noReferenceApiServiceRule'
|
|
29
34
|
import type { UnknownApiServiceRuleFix } from './rules/issues/apis/unknownApiServiceRule'
|
|
@@ -66,6 +71,7 @@ type Code =
|
|
|
66
71
|
| 'no-reference component workflow'
|
|
67
72
|
| 'no-reference component'
|
|
68
73
|
| 'no-reference event'
|
|
74
|
+
| 'no-reference global css variable'
|
|
69
75
|
| 'no-reference node'
|
|
70
76
|
| 'no-reference project action'
|
|
71
77
|
| 'no-reference project formula'
|
|
@@ -81,6 +87,8 @@ type Code =
|
|
|
81
87
|
| 'required extension'
|
|
82
88
|
| 'required meta tag'
|
|
83
89
|
| 'image without dimension'
|
|
90
|
+
| 'unknown action argument'
|
|
91
|
+
| 'unknown action event'
|
|
84
92
|
| 'unknown api input'
|
|
85
93
|
| 'unknown api'
|
|
86
94
|
| 'unknown api service'
|
|
@@ -288,6 +296,26 @@ type ActionModelNode<A = ActionModel> = {
|
|
|
288
296
|
component: ToddleComponent<Function>
|
|
289
297
|
} & Base
|
|
290
298
|
|
|
299
|
+
type CustomActionModelArgumentNode = {
|
|
300
|
+
nodeType: 'action-custom-model-argument'
|
|
301
|
+
value: {
|
|
302
|
+
action: CustomActionModel
|
|
303
|
+
argument: CustomActionArgument
|
|
304
|
+
argumentIndex: number
|
|
305
|
+
}
|
|
306
|
+
component: ToddleComponent<Function>
|
|
307
|
+
} & Base
|
|
308
|
+
|
|
309
|
+
type CustomActionModelEventNode = {
|
|
310
|
+
nodeType: 'action-custom-model-event'
|
|
311
|
+
value: {
|
|
312
|
+
action: CustomActionModel
|
|
313
|
+
event: ActionModelActions
|
|
314
|
+
eventName: string
|
|
315
|
+
}
|
|
316
|
+
component: ToddleComponent<Function>
|
|
317
|
+
} & Base
|
|
318
|
+
|
|
291
319
|
type ComponentContext = {
|
|
292
320
|
nodeType: 'component-context'
|
|
293
321
|
value: {
|
|
@@ -314,6 +342,14 @@ type ProjectThemeNode = {
|
|
|
314
342
|
value: Theme
|
|
315
343
|
} & Base
|
|
316
344
|
|
|
345
|
+
type ProjectThemePropertyNode = {
|
|
346
|
+
nodeType: 'project-theme-property'
|
|
347
|
+
value: {
|
|
348
|
+
key: CustomPropertyName
|
|
349
|
+
value: CustomPropertyDefinition
|
|
350
|
+
}
|
|
351
|
+
} & Base
|
|
352
|
+
|
|
317
353
|
type ProjectConfigNode = {
|
|
318
354
|
nodeType: 'project-config'
|
|
319
355
|
value: unknown
|
|
@@ -349,6 +385,8 @@ export type NodeType =
|
|
|
349
385
|
| ComponentNodeNode
|
|
350
386
|
| ComponentVariableNode
|
|
351
387
|
| ComponentWorkflowNode
|
|
388
|
+
| CustomActionModelArgumentNode
|
|
389
|
+
| CustomActionModelEventNode
|
|
352
390
|
| FormulaNode
|
|
353
391
|
| ProjectActionNode
|
|
354
392
|
| ProjectApiService
|
|
@@ -356,6 +394,7 @@ export type NodeType =
|
|
|
356
394
|
| ProjectFormulaNode
|
|
357
395
|
| ProjectRoute
|
|
358
396
|
| ProjectThemeNode
|
|
397
|
+
| ProjectThemePropertyNode
|
|
359
398
|
| StyleNode
|
|
360
399
|
| StyleVariantNode
|
|
361
400
|
|
|
@@ -375,6 +414,8 @@ type FixType =
|
|
|
375
414
|
| NoReferenceProjectFormulaRuleFix
|
|
376
415
|
| NoReferenceVariableRuleFix
|
|
377
416
|
| NoStaticNodeConditionRuleFix
|
|
417
|
+
| UnknownActionArgumentRuleFix
|
|
418
|
+
| UnknownActionEventRuleFix
|
|
378
419
|
| UnknownApiServiceRuleFix
|
|
379
420
|
| UnknownComponentAttributeRuleFix
|
|
380
421
|
|
package/src/util/helpers.ts
CHANGED
|
@@ -85,13 +85,11 @@ interface BaseInteractiveContent {
|
|
|
85
85
|
tag: string
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
interface InteractiveContentWithAttributeRequirement
|
|
89
|
-
extends BaseInteractiveContent {
|
|
88
|
+
interface InteractiveContentWithAttributeRequirement extends BaseInteractiveContent {
|
|
90
89
|
whenAttributeIsPresent: string
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
interface InteractiveContentWithNegativeAttributeRequirement
|
|
94
|
-
extends BaseInteractiveContent {
|
|
92
|
+
interface InteractiveContentWithNegativeAttributeRequirement extends BaseInteractiveContent {
|
|
95
93
|
whenAttributeIsNot: { attribute: string; value: string }
|
|
96
94
|
}
|
|
97
95
|
|