Open
Description
Motivation
Hi,
as I am converting an existing codebase to svelte, I encountered some element classes/IDs that no longer do anything have been left over. They were previously used either for stuff like document.getElementById()
or just global CSS that I over time replaced by component styles.
I thought this could be useful to automate by an eslint rule:
Description
The rule would disallow any element class or id attributes unless they are used in the component CSS.
Examples
<!-- ✓ GOOD -->
<div />
<!-- ✓ GOOD -->
<div class="my class" />
<div id="myId" />
<style>
.myClass {}
#myId {}
</style>
<!-- ✗ BAD -->
<div class="myClass" />
<div id="myId" />
Additional comments
Does this make sense to you as a rule? I
Also, I'm not sure about the name. Also also, there should probably be a whitelist :).
And as always, I'm willing to make a PR if you're willing to review and merge it...