CleverCloud / clever-components

Collection of Web Components by Clever Cloud
https://www.clever-cloud.com/doc/clever-components/
Apache License 2.0
221 stars 20 forks source link

Property / attribute names: avoid clashes with native #1125

Open florian-sanders-cc opened 4 months ago

florian-sanders-cc commented 4 months ago

Context

We have faced several cases with prop names that clashed with native properties / attributes.

For instance, exposing a prop title on a web component is not a good idea because it will generate a tooltip (native title behavior).

Disabled prop resets the focus when set to true with Chrome (see #1124).

Decision

It only forbids usage of "global" attributes so disabled is ok, which is a good thing because we want to use it for form control components.

hsablonniere commented 3 months ago

I agree on this!

I had a look at this project https://github.com/43081j/eslint-plugin-wc and I don't see such a rule. I wonder how we will list and maintain all forbidden names.

florian-sanders-cc commented 1 month ago

@hsablonniere when working on eslint upgrade I found this one: https://github.com/43081j/eslint-plugin-lit/blob/master/docs/rules/no-native-attributes.md

It's great so I've included it within our config :wink: