I work in a large codebase that happens to use lots of magic data attributes to change behavior of things in subtle ways. It can hurt greppability when seeing one of these data attributes used in css, but on the js side the data attribute is accessed via the dataset
property. If you search the codebase for the data-*
attribute you see in css, you won't find its usage on the js side and you have to know to strip the data and camelCase the name to find it.
It'd be nice if there was an inverse of prefer-dom-node-dataset
, or if it took an option to invert the check.
Maybe this is easy enough to set up with no-restricted-syntax?
el.dataset.someLongDataAttribute
el.hasAttribute('data-some-long-data-attribute')
prefer-dom-node-has-attribute
For now I can use no-restricted-syntax with MemberExpression[property.name="dataset"]
, but an autofixer would be nice here.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too