Documented CSS parts
exposed part="…" elements are documented with @csspart.
undocumented-part — run only this rule with
banira lint src/*.ts --rules undocumented-part.A part="…" attribute is a styling contract: it lets consumers target inner elements with
::part(). Document each exposed part with a class-level @csspart tag so the contract is
discoverable. banira mounts the element and flags any rendered part name that isn't documented.
export class MyButton extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' }).innerHTML =
'<button part="button"><slot></slot></button>';
}
}
customElements.define('my-button', MyButton);/**
* @csspart button - the inner native button
*/
export class MyButton extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' }).innerHTML =
'<button part="button"><slot></slot></button>';
}
}
customElements.define('my-button', MyButton);