eslint-plugin-web-components-doctor 0.3.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/LICENSE +191 -0
- package/README.md +309 -0
- package/dist/adapters/jsx-adapter.d.ts +20 -0
- package/dist/adapters/jsx-adapter.d.ts.map +1 -0
- package/dist/adapters/jsx-adapter.js +150 -0
- package/dist/adapters/jsx-adapter.js.map +1 -0
- package/dist/adapters/lit-adapter.d.ts +19 -0
- package/dist/adapters/lit-adapter.d.ts.map +1 -0
- package/dist/adapters/lit-adapter.js +145 -0
- package/dist/adapters/lit-adapter.js.map +1 -0
- package/dist/adapters/utils.d.ts +36 -0
- package/dist/adapters/utils.d.ts.map +1 -0
- package/dist/adapters/utils.js +58 -0
- package/dist/adapters/utils.js.map +1 -0
- package/dist/core/rule-factory.d.ts +44 -0
- package/dist/core/rule-factory.d.ts.map +1 -0
- package/dist/core/rule-factory.js +443 -0
- package/dist/core/rule-factory.js.map +1 -0
- package/dist/core/types.d.ts +103 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +13 -0
- package/dist/core/types.js.map +1 -0
- package/dist/descriptors/components.d.ts +21 -0
- package/dist/descriptors/components.d.ts.map +1 -0
- package/dist/descriptors/components.js +249 -0
- package/dist/descriptors/components.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/accessible-component.d.ts +13 -0
- package/dist/rules/accessible-component.d.ts.map +1 -0
- package/dist/rules/accessible-component.js +15 -0
- package/dist/rules/accessible-component.js.map +1 -0
- package/dist/rules/no-deprecated.d.ts +13 -0
- package/dist/rules/no-deprecated.d.ts.map +1 -0
- package/dist/rules/no-deprecated.js +15 -0
- package/dist/rules/no-deprecated.js.map +1 -0
- package/dist/rules/required-attributes.d.ts +13 -0
- package/dist/rules/required-attributes.d.ts.map +1 -0
- package/dist/rules/required-attributes.js +15 -0
- package/dist/rules/required-attributes.js.map +1 -0
- package/dist/rules/valid-attribute-values.d.ts +13 -0
- package/dist/rules/valid-attribute-values.d.ts.map +1 -0
- package/dist/rules/valid-attribute-values.js +15 -0
- package/dist/rules/valid-attribute-values.js.map +1 -0
- package/dist/rules/valid-slot-children.d.ts +13 -0
- package/dist/rules/valid-slot-children.d.ts.map +1 -0
- package/dist/rules/valid-slot-children.js +15 -0
- package/dist/rules/valid-slot-children.js.map +1 -0
- package/dist/rules/valid-slot-names.d.ts +13 -0
- package/dist/rules/valid-slot-names.d.ts.map +1 -0
- package/dist/rules/valid-slot-names.js +15 -0
- package/dist/rules/valid-slot-names.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { extractElementsFromTemplate } from '../adapters/lit-adapter.js';
|
|
13
|
+
import { extractElementFromJSX } from '../adapters/jsx-adapter.js';
|
|
14
|
+
/**
|
|
15
|
+
* An attribute is considered "present" if it exists in the map at all
|
|
16
|
+
* (including boolean attributes with empty string values).
|
|
17
|
+
*/
|
|
18
|
+
function hasOneOf(element, attrs) {
|
|
19
|
+
return attrs.some((attr) => element.attributes.has(attr));
|
|
20
|
+
}
|
|
21
|
+
function hasAll(element, attrs) {
|
|
22
|
+
return attrs.every((attr) => element.attributes.has(attr));
|
|
23
|
+
}
|
|
24
|
+
function matchesCondition(element, condition) {
|
|
25
|
+
if (condition.hasAttribute) {
|
|
26
|
+
if (!element.attributes.has(condition.hasAttribute))
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (condition.hasAttributes) {
|
|
30
|
+
for (const attr of condition.hasAttributes) {
|
|
31
|
+
if (!element.attributes.has(attr))
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (condition.attributeEquals) {
|
|
36
|
+
for (const [attr, expected] of Object.entries(condition.attributeEquals)) {
|
|
37
|
+
const val = element.attributes.get(attr);
|
|
38
|
+
if (!val || val.value !== expected)
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates the `accessible-component` rule that checks all components
|
|
46
|
+
* against their accessibility descriptors.
|
|
47
|
+
*/
|
|
48
|
+
export function createAccessibleComponentRule(descriptors) {
|
|
49
|
+
return {
|
|
50
|
+
meta: {
|
|
51
|
+
type: 'suggestion',
|
|
52
|
+
docs: {
|
|
53
|
+
description: 'Require accessible attributes on Spectrum Web Components based on component descriptors.',
|
|
54
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#accessible-component',
|
|
55
|
+
},
|
|
56
|
+
messages: {
|
|
57
|
+
missingOneOf: '<{{tagName}}> requires at least one of: {{attributes}} for accessibility.',
|
|
58
|
+
missingAll: '<{{tagName}}> requires the following attributes: {{attributes}}.',
|
|
59
|
+
conditionalViolation: '{{message}}',
|
|
60
|
+
},
|
|
61
|
+
schema: [],
|
|
62
|
+
},
|
|
63
|
+
create(context) {
|
|
64
|
+
function check(node, elements) {
|
|
65
|
+
for (const element of elements) {
|
|
66
|
+
const descriptor = descriptors[element.tagName];
|
|
67
|
+
if (!descriptor?.accessibility)
|
|
68
|
+
continue;
|
|
69
|
+
const a11y = descriptor.accessibility;
|
|
70
|
+
if (a11y.requireOneOf && !hasOneOf(element, a11y.requireOneOf)) {
|
|
71
|
+
context.report({
|
|
72
|
+
node,
|
|
73
|
+
messageId: 'missingOneOf',
|
|
74
|
+
data: {
|
|
75
|
+
tagName: element.tagName,
|
|
76
|
+
attributes: a11y.requireOneOf
|
|
77
|
+
.map((a) => `\`${a}\``)
|
|
78
|
+
.join(', '),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (a11y.requireAll && !hasAll(element, a11y.requireAll)) {
|
|
83
|
+
const missing = a11y.requireAll.filter((a) => !element.attributes.has(a));
|
|
84
|
+
context.report({
|
|
85
|
+
node,
|
|
86
|
+
messageId: 'missingAll',
|
|
87
|
+
data: {
|
|
88
|
+
tagName: element.tagName,
|
|
89
|
+
attributes: missing.map((a) => `\`${a}\``).join(', '),
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (a11y.conditionalRules) {
|
|
94
|
+
for (const rule of a11y.conditionalRules) {
|
|
95
|
+
if (!matchesCondition(element, rule.when))
|
|
96
|
+
continue;
|
|
97
|
+
if (rule.requireOneOf && !hasOneOf(element, rule.requireOneOf)) {
|
|
98
|
+
context.report({
|
|
99
|
+
node,
|
|
100
|
+
messageId: rule.message
|
|
101
|
+
? 'conditionalViolation'
|
|
102
|
+
: 'missingOneOf',
|
|
103
|
+
data: rule.message
|
|
104
|
+
? { message: rule.message }
|
|
105
|
+
: {
|
|
106
|
+
tagName: element.tagName,
|
|
107
|
+
attributes: rule.requireOneOf
|
|
108
|
+
.map((a) => `\`${a}\``)
|
|
109
|
+
.join(', '),
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (rule.requireAll && !hasAll(element, rule.requireAll)) {
|
|
114
|
+
context.report({
|
|
115
|
+
node,
|
|
116
|
+
messageId: rule.message
|
|
117
|
+
? 'conditionalViolation'
|
|
118
|
+
: 'missingAll',
|
|
119
|
+
data: rule.message
|
|
120
|
+
? { message: rule.message }
|
|
121
|
+
: {
|
|
122
|
+
tagName: element.tagName,
|
|
123
|
+
attributes: rule.requireAll
|
|
124
|
+
.map((a) => `\`${a}\``)
|
|
125
|
+
.join(', '),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
TaggedTemplateExpression(node) {
|
|
135
|
+
check(node, extractElementsFromTemplate(node));
|
|
136
|
+
},
|
|
137
|
+
JSXElement(node) {
|
|
138
|
+
check(node, extractElementFromJSX(node));
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Creates the `no-deprecated` rule that flags deprecated attributes
|
|
146
|
+
* and attribute values across all described components.
|
|
147
|
+
*/
|
|
148
|
+
export function createNoDeprecatedRule(descriptors) {
|
|
149
|
+
return {
|
|
150
|
+
meta: {
|
|
151
|
+
type: 'suggestion',
|
|
152
|
+
docs: {
|
|
153
|
+
description: 'Disallow deprecated attributes and attribute values on Spectrum Web Components.',
|
|
154
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#no-deprecated',
|
|
155
|
+
},
|
|
156
|
+
messages: {
|
|
157
|
+
deprecatedValue: '{{message}}',
|
|
158
|
+
deprecatedAttribute: '{{message}}',
|
|
159
|
+
deprecatedSlotContent: '{{message}}',
|
|
160
|
+
},
|
|
161
|
+
hasSuggestions: true,
|
|
162
|
+
schema: [],
|
|
163
|
+
},
|
|
164
|
+
create(context) {
|
|
165
|
+
function check(node, elements) {
|
|
166
|
+
for (const element of elements) {
|
|
167
|
+
const descriptor = descriptors[element.tagName];
|
|
168
|
+
if (!descriptor?.deprecations)
|
|
169
|
+
continue;
|
|
170
|
+
const dep = descriptor.deprecations;
|
|
171
|
+
if (dep.attributes) {
|
|
172
|
+
for (const attrDep of dep.attributes) {
|
|
173
|
+
if (attrDep.deprecatedValues) {
|
|
174
|
+
const attrVal = element.attributes.get(attrDep.attribute);
|
|
175
|
+
if (!attrVal || attrVal.isDynamic)
|
|
176
|
+
continue;
|
|
177
|
+
const match = attrDep.deprecatedValues.find((d) => d.value === attrVal.value);
|
|
178
|
+
if (match) {
|
|
179
|
+
context.report({
|
|
180
|
+
node,
|
|
181
|
+
messageId: 'deprecatedValue',
|
|
182
|
+
data: { message: match.message },
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if (attrDep.message) {
|
|
187
|
+
if (element.attributes.has(attrDep.attribute)) {
|
|
188
|
+
context.report({
|
|
189
|
+
node,
|
|
190
|
+
messageId: 'deprecatedAttribute',
|
|
191
|
+
data: { message: attrDep.message },
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (dep.warnOnTextContent && element.hasTextContent) {
|
|
198
|
+
context.report({
|
|
199
|
+
node,
|
|
200
|
+
messageId: 'deprecatedSlotContent',
|
|
201
|
+
data: { message: dep.warnOnTextContent.message },
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
TaggedTemplateExpression(node) {
|
|
208
|
+
check(node, extractElementsFromTemplate(node));
|
|
209
|
+
},
|
|
210
|
+
JSXElement(node) {
|
|
211
|
+
check(node, extractElementFromJSX(node));
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Creates the `required-attributes` rule.
|
|
219
|
+
*/
|
|
220
|
+
export function createRequiredAttributesRule(descriptors) {
|
|
221
|
+
return {
|
|
222
|
+
meta: {
|
|
223
|
+
type: 'suggestion',
|
|
224
|
+
docs: {
|
|
225
|
+
description: 'Require specific attributes on Spectrum Web Components for correct behavior.',
|
|
226
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#required-attributes',
|
|
227
|
+
},
|
|
228
|
+
messages: {
|
|
229
|
+
missingRequired: '<{{tagName}}> should have an explicit "{{attribute}}" attribute set.',
|
|
230
|
+
},
|
|
231
|
+
schema: [],
|
|
232
|
+
},
|
|
233
|
+
create(context) {
|
|
234
|
+
function check(node, elements) {
|
|
235
|
+
for (const element of elements) {
|
|
236
|
+
const descriptor = descriptors[element.tagName];
|
|
237
|
+
if (!descriptor?.requiredAttributes)
|
|
238
|
+
continue;
|
|
239
|
+
for (const attr of descriptor.requiredAttributes) {
|
|
240
|
+
if (!element.attributes.has(attr)) {
|
|
241
|
+
context.report({
|
|
242
|
+
node,
|
|
243
|
+
messageId: 'missingRequired',
|
|
244
|
+
data: {
|
|
245
|
+
tagName: element.tagName,
|
|
246
|
+
attribute: attr,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
TaggedTemplateExpression(node) {
|
|
255
|
+
check(node, extractElementsFromTemplate(node));
|
|
256
|
+
},
|
|
257
|
+
JSXElement(node) {
|
|
258
|
+
check(node, extractElementFromJSX(node));
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Creates the `valid-attribute-values` rule.
|
|
266
|
+
*/
|
|
267
|
+
export function createValidAttributeValuesRule(descriptors) {
|
|
268
|
+
return {
|
|
269
|
+
meta: {
|
|
270
|
+
type: 'problem',
|
|
271
|
+
docs: {
|
|
272
|
+
description: 'Disallow invalid attribute values on Spectrum Web Components.',
|
|
273
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#valid-attribute-values',
|
|
274
|
+
},
|
|
275
|
+
messages: {
|
|
276
|
+
invalidValue: '"{{value}}" is not a valid value for "{{attribute}}" on <{{tagName}}>. Allowed values: {{allowed}}.',
|
|
277
|
+
},
|
|
278
|
+
schema: [],
|
|
279
|
+
},
|
|
280
|
+
create(context) {
|
|
281
|
+
function check(node, elements) {
|
|
282
|
+
for (const element of elements) {
|
|
283
|
+
const descriptor = descriptors[element.tagName];
|
|
284
|
+
if (!descriptor?.validAttributeValues)
|
|
285
|
+
continue;
|
|
286
|
+
for (const [attr, allowedValues] of Object.entries(descriptor.validAttributeValues)) {
|
|
287
|
+
const attrVal = element.attributes.get(attr);
|
|
288
|
+
if (!attrVal || attrVal.isDynamic || attrVal.value === null)
|
|
289
|
+
continue;
|
|
290
|
+
if (!allowedValues.includes(attrVal.value)) {
|
|
291
|
+
context.report({
|
|
292
|
+
node,
|
|
293
|
+
messageId: 'invalidValue',
|
|
294
|
+
data: {
|
|
295
|
+
tagName: element.tagName,
|
|
296
|
+
attribute: attr,
|
|
297
|
+
value: attrVal.value,
|
|
298
|
+
allowed: allowedValues
|
|
299
|
+
.map((v) => `"${v}"`)
|
|
300
|
+
.join(', '),
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return {
|
|
308
|
+
TaggedTemplateExpression(node) {
|
|
309
|
+
check(node, extractElementsFromTemplate(node));
|
|
310
|
+
},
|
|
311
|
+
JSXElement(node) {
|
|
312
|
+
check(node, extractElementFromJSX(node));
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Resolve which slot a child element targets based on its `slot` attribute.
|
|
320
|
+
* Returns '' (empty string) for the default slot.
|
|
321
|
+
*/
|
|
322
|
+
function getChildSlotName(child) {
|
|
323
|
+
const slotAttr = child.attributes.get('slot');
|
|
324
|
+
if (!slotAttr || slotAttr.isDynamic)
|
|
325
|
+
return '';
|
|
326
|
+
return slotAttr.value ?? '';
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Creates the `valid-slot-names` rule that checks children aren't placed
|
|
330
|
+
* into non-existent slots.
|
|
331
|
+
*/
|
|
332
|
+
export function createValidSlotNamesRule(descriptors) {
|
|
333
|
+
return {
|
|
334
|
+
meta: {
|
|
335
|
+
type: 'problem',
|
|
336
|
+
docs: {
|
|
337
|
+
description: 'Disallow placing children into slots that a Spectrum Web Component does not define.',
|
|
338
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#valid-slot-names',
|
|
339
|
+
},
|
|
340
|
+
messages: {
|
|
341
|
+
invalidSlot: '<{{childTag}}> uses slot="{{slotName}}" but <{{parentTag}}> does not have a "{{slotName}}" slot. Valid slots: {{validSlots}}.',
|
|
342
|
+
},
|
|
343
|
+
schema: [],
|
|
344
|
+
},
|
|
345
|
+
create(context) {
|
|
346
|
+
function checkElement(node, elements) {
|
|
347
|
+
for (const element of elements) {
|
|
348
|
+
const descriptor = descriptors[element.tagName];
|
|
349
|
+
if (!descriptor?.slots)
|
|
350
|
+
continue;
|
|
351
|
+
const validSlotNames = new Set(descriptor.slots.map((s) => s.name));
|
|
352
|
+
for (const child of element.children) {
|
|
353
|
+
const slotName = getChildSlotName(child);
|
|
354
|
+
if (slotName === '' && validSlotNames.has(''))
|
|
355
|
+
continue;
|
|
356
|
+
if (validSlotNames.has(slotName))
|
|
357
|
+
continue;
|
|
358
|
+
context.report({
|
|
359
|
+
node,
|
|
360
|
+
messageId: 'invalidSlot',
|
|
361
|
+
data: {
|
|
362
|
+
childTag: child.tagName,
|
|
363
|
+
slotName,
|
|
364
|
+
parentTag: element.tagName,
|
|
365
|
+
validSlots: [...validSlotNames]
|
|
366
|
+
.map((s) => (s === '' ? '(default)' : `"${s}"`))
|
|
367
|
+
.join(', '),
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
TaggedTemplateExpression(node) {
|
|
375
|
+
checkElement(node, extractElementsFromTemplate(node));
|
|
376
|
+
},
|
|
377
|
+
JSXElement(node) {
|
|
378
|
+
checkElement(node, extractElementFromJSX(node));
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Creates the `valid-slot-children` rule that checks a child element's tag
|
|
386
|
+
* is accepted in the slot it targets.
|
|
387
|
+
*/
|
|
388
|
+
export function createValidSlotChildrenRule(descriptors) {
|
|
389
|
+
return {
|
|
390
|
+
meta: {
|
|
391
|
+
type: 'problem',
|
|
392
|
+
docs: {
|
|
393
|
+
description: 'Disallow placing elements into slots that do not accept their tag name.',
|
|
394
|
+
url: 'https://github.com/Rajdeepc/eslint-plugin-web-components-doctor#valid-slot-children',
|
|
395
|
+
},
|
|
396
|
+
messages: {
|
|
397
|
+
invalidChild: '<{{childTag}}> is not accepted in the {{slotLabel}} of <{{parentTag}}>. Accepted children: {{accepted}}.',
|
|
398
|
+
},
|
|
399
|
+
schema: [],
|
|
400
|
+
},
|
|
401
|
+
create(context) {
|
|
402
|
+
function checkElement(node, elements) {
|
|
403
|
+
for (const element of elements) {
|
|
404
|
+
const descriptor = descriptors[element.tagName];
|
|
405
|
+
if (!descriptor?.slots)
|
|
406
|
+
continue;
|
|
407
|
+
const slotMap = new Map(descriptor.slots.map((s) => [s.name, s]));
|
|
408
|
+
for (const child of element.children) {
|
|
409
|
+
const slotName = getChildSlotName(child);
|
|
410
|
+
const slotDef = slotMap.get(slotName);
|
|
411
|
+
if (!slotDef || !slotDef.acceptedChildren)
|
|
412
|
+
continue;
|
|
413
|
+
if (!slotDef.acceptedChildren.includes(child.tagName)) {
|
|
414
|
+
context.report({
|
|
415
|
+
node,
|
|
416
|
+
messageId: 'invalidChild',
|
|
417
|
+
data: {
|
|
418
|
+
childTag: child.tagName,
|
|
419
|
+
slotLabel: slotName === ''
|
|
420
|
+
? 'default slot'
|
|
421
|
+
: `"${slotName}" slot`,
|
|
422
|
+
parentTag: element.tagName,
|
|
423
|
+
accepted: slotDef.acceptedChildren
|
|
424
|
+
.map((t) => `<${t}>`)
|
|
425
|
+
.join(', '),
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
TaggedTemplateExpression(node) {
|
|
434
|
+
checkElement(node, extractElementsFromTemplate(node));
|
|
435
|
+
},
|
|
436
|
+
JSXElement(node) {
|
|
437
|
+
checkElement(node, extractElementFromJSX(node));
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=rule-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-factory.js","sourceRoot":"","sources":["../../src/core/rule-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;GAGG;AACH,SAAS,QAAQ,CAAC,OAAsB,EAAE,KAAe;IACvD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,MAAM,CAAC,OAAsB,EAAE,KAAe;IACrD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAsB,EACtB,SAAkC;IAElC,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC;YAAE,OAAO,KAAK,CAAC;IACpE,C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CAAC;gBAClD,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Normalized representation of an HTML element extracted from any template syntax.
|
|
14
|
+
* This is the intermediate format that adapters produce and rules consume.
|
|
15
|
+
*/
|
|
16
|
+
export interface ParsedElement {
|
|
17
|
+
tagName: string;
|
|
18
|
+
attributes: Map<string, AttributeValue>;
|
|
19
|
+
children: ParsedElement[];
|
|
20
|
+
hasTextContent: boolean;
|
|
21
|
+
loc?: ElementLocation;
|
|
22
|
+
}
|
|
23
|
+
export interface AttributeValue {
|
|
24
|
+
/** The raw string value, or null for dynamic expressions */
|
|
25
|
+
value: string | null;
|
|
26
|
+
/** Whether the value comes from a dynamic expression (e.g. ${expr}) */
|
|
27
|
+
isDynamic: boolean;
|
|
28
|
+
/** Lit-style binding prefix: '.' for property, '?' for boolean, '@' for event */
|
|
29
|
+
bindingType?: '.' | '?' | '@' | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface ElementLocation {
|
|
32
|
+
startOffset: number;
|
|
33
|
+
endOffset: number;
|
|
34
|
+
startLine: number;
|
|
35
|
+
startCol: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Accessibility descriptor for a single component.
|
|
39
|
+
*/
|
|
40
|
+
export interface AccessibilityDescriptor {
|
|
41
|
+
/** At least one of these attributes must be present */
|
|
42
|
+
requireOneOf?: string[];
|
|
43
|
+
/** All of these attributes are individually required */
|
|
44
|
+
requireAll?: string[];
|
|
45
|
+
/** Conditional rules that apply based on other attribute states */
|
|
46
|
+
conditionalRules?: ConditionalRule[];
|
|
47
|
+
}
|
|
48
|
+
export interface ConditionalRule {
|
|
49
|
+
when: {
|
|
50
|
+
hasAttribute?: string;
|
|
51
|
+
hasAttributes?: string[];
|
|
52
|
+
attributeEquals?: Record<string, string>;
|
|
53
|
+
};
|
|
54
|
+
requireOneOf?: string[];
|
|
55
|
+
requireAll?: string[];
|
|
56
|
+
message?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Deprecation descriptor for attribute values or entire attributes.
|
|
60
|
+
*/
|
|
61
|
+
export interface DeprecationDescriptor {
|
|
62
|
+
attributes?: DeprecatedAttributeDescriptor[];
|
|
63
|
+
warnOnTextContent?: {
|
|
64
|
+
message: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface DeprecatedAttributeDescriptor {
|
|
68
|
+
attribute: string;
|
|
69
|
+
deprecatedValues?: DeprecatedValueDescriptor[];
|
|
70
|
+
message?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface DeprecatedValueDescriptor {
|
|
73
|
+
value: string;
|
|
74
|
+
message: string;
|
|
75
|
+
replacement?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defines an accepted slot on a component.
|
|
79
|
+
*/
|
|
80
|
+
export interface SlotDescriptor {
|
|
81
|
+
/** Slot name. Use '' for the default (unnamed) slot. */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Tag names accepted in this slot. Omit to accept any element. */
|
|
84
|
+
acceptedChildren?: string[];
|
|
85
|
+
/** If true, at least one child must fill this slot. */
|
|
86
|
+
required?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Full component descriptor combining all rule metadata for one element.
|
|
90
|
+
*/
|
|
91
|
+
export interface ComponentDescriptor {
|
|
92
|
+
tagName: string;
|
|
93
|
+
accessibility?: AccessibilityDescriptor;
|
|
94
|
+
deprecations?: DeprecationDescriptor;
|
|
95
|
+
requiredAttributes?: string[];
|
|
96
|
+
slots?: SlotDescriptor[];
|
|
97
|
+
validAttributeValues?: Record<string, string[]>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The complete descriptor set loaded by the plugin.
|
|
101
|
+
*/
|
|
102
|
+
export type ComponentDescriptorMap = Record<string, ComponentDescriptor>;
|
|
103
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,WAAW,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACx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C,EAAE,MAAM,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import type { ComponentDescriptorMap } from '../core/types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Component descriptors encoding accessibility requirements, deprecations,
|
|
15
|
+
* required attributes, and valid values for Spectrum Web Components.
|
|
16
|
+
*
|
|
17
|
+
* To add a new component: add an entry keyed by its tag name.
|
|
18
|
+
* No new rule code is needed — the rule factory picks it up automatically.
|
|
19
|
+
*/
|
|
20
|
+
export declare const componentDescriptors: ComponentDescriptorMap;
|
|
21
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/descriptors/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,sBA+PlC,CAAC"}
|