43081j/eslint-plugin-wc

wc/no-invalid-element-name produces error on valid tag names.

Closed this issue · 4 comments

Currently wc/no-invalid-element-name disallows the usage of polymer-, ng-, x- tags, where there is nothing in the spec against this.

There should be a configuration that allows teams to indicate their preferred namespace to have consistency in a project, and allow namespaces like x-

this is basically from the best practices that were published long ago (by google i think)

we follow the same rules they specified back then, which various npm packages also follow for detecting valid element names.

tbh i would probably just disable this rule if you use x- as a prefix. you could also set the options of it {loose: true} which allows those prefixes but disallows invalid names

and maybe in future have a separate rule like an element-name-allowlist or something. to only allow particular patterns

Could use https://github.com/github/eslint-plugin-custom-elements/blob/main/docs/rules/valid-tag-name.md as an alternative which has a more configurability than this rule.

fwiw {loose: true} achieves what was needed by OP. just in case anyone with a similar issue is reading this

43081j commented

closing this as loose mode achieves it, and the new major version will allow clearer customisation of this behaviour