eslint-plugin-unicorn
eslint-plugin-unicorn copied to clipboard
Rule proposal: Error when adding a class that begins with a dot`classList.add('.`
Description
Sometimes, we incorrectly try to add a class that begins with a dot, but linters and indeed browsers do not indicate that this is an error.
The error occurs because we use a dot in selectors for classname, but the dot is not part of the actual class name.
Fail
node.classList.add('.table-of-contents');
Pass
node.classList.add('table-of-contents')
Additional Info
No response
It should apply to the other classList methods too.
Accepted
Please suggest a rule name.