Here is a few feedbacks I got using the component validator of UI Patterns 2.
I hope it would be useful.
Missing attribute variable
Default attributes object is always injected in template and expected for alteration (adding contextual accessibility attributes, adding data for site building tools, style overrides of the component...)
It is missing from:
Other missing variables (from definition or from template)
Every slot or prop from the component definition must be used in templates. Every slot or prop used in the template must be present in the component definition (except the mandatory default ones: attributes, componentMetadata...)
Declared in definition or in template but not used:
- alert component: display
- navs component: key
- toasts component: content, image, meta, prefix, title
Used but not declared:
- alert component: title_ids
- menu component: alignment
- modal component: modal, title
- breadcrumb component: breadcrumb_divider
- pills component: alignment, classes, id
- tabs component: classes, id
- figure component: caption_alignment
Unexpected raw
Twig filter
Twig templates escape special characters to prevent potential hacking. Twig raw puts out the data without escaping it, meaning that if it is user-supplied data, it's insecure and could be used for hacking.
With Drupal Render API, there is no reason to use this filter.
It may be the signal some props must be slots instead.
- pills component: it seems a
pill
component is missing to replace items
- tabs component: it seems a
tab
component is missing to replace items
- accordion component: it seems a
accordion_item
component is missing to replace items
Incorrect JSON schema
In pills
, dropdown
and many others components, item
must be items
:
type: array
title: Items
item: >> items
type: object
https://json-schema.org/understanding-json-schema/reference/array#items
Avoid PHP namespaces in JSON schema
Using Drupal\Core\Menu\MenuLinkInterface
is "tolerated" by SDC because the validation is skipped, but its is not a good practice because invalid in JSON schema. It is better to avoid this Drupalism and replace this by a proper schema definition: