Ensures that your custom element name is valid, not reserved, and follows standard naming conventions.
More information on custom element naming conventions can be found here.
This rule disallows invalid element names.
The following patterns are considered warnings:
customElements.define('my-App', class extends HTMLElement {});
customElements.define('app', class extends HTMLElement {});
customElements.define('1-app', class extends HTMLElement {});
customElements.define('-app', class extends HTMLElement {});
customElements.define('my-app!', class extends HTMLElement {});
customElements.define('my-app-', class extends HTMLElement {});
customElements.define('my--app', class extends HTMLElement {});
/* disallowNamespaces: true */
customElements.define('font-face', class extends HTMLElement {});
customElements.define('polymer-app', class extends HTMLElement {});
customElements.define('x-app', class extends HTMLElement {});
customElements.define('ng-app', class extends HTMLElement {});
customElements.define('xml-app', class extends HTMLElement {});
The following patterns are not warnings:
customElements.define('my-app', class extends HTMLElement {});
/* disallowNamespaces: false (default) */
customElements.define('polymer-app', class extends HTMLElement {});
onlyAlphanum
(default:false
) can be set to only allow alpha-numeric namesdisallowNamespaces
(default:false
) can be set to disallow well known namespaces (e.g.polymer-
)suffix
(default:[]
) can be set to an array of required suffixes the name must contain one ofprefix
(default:[]
) can be set to an array of required prefixes the name must contain one of
If you wish to allow any names to be used for elements, you should not use this rule.