Rule details
Disallow selectors that duplicate an earlier rule's selector, and repeated selectors within a single selector list.
What type of rule is this?
Warns about a potential problem
Example code
.card {
color: black;
}
/* could be far apart - a copy-paste or merge-conflict artifact */
.card {
color: gray; /* silently wins; editing the first block appears to do nothing */
}
.button,
.button {
padding: 8px;
}
Prior Art
Participation
AI acknowledgment
Additional comments
- The failure mode this catches is the same one as
no-duplicate-imports: the duplicate is valid CSS handled deterministically by the browser, but it usually enters the file unintentionally (copy-paste, merge conflict) and far away from the original, so it survives review. The result is confusing - declarations in the later block silently win ties, so edits to the earlier block appear to have no effect.
- Only selectors in the same context would be compared: an identical selector under a different
@media/@supports/@layer condition or a different nesting parent is not a duplicate. Comparison would be done on normalized selector text (whitespace-insensitive).
- Optional for first implementation: detecting equivalent resolved selectors written differently (
.a .b vs .a { & .b }).
Rule details
Disallow selectors that duplicate an earlier rule's selector, and repeated selectors within a single selector list.
What type of rule is this?
Warns about a potential problem
Example code
Prior Art
Participation
AI acknowledgment
Additional comments
no-duplicate-imports: the duplicate is valid CSS handled deterministically by the browser, but it usually enters the file unintentionally (copy-paste, merge conflict) and far away from the original, so it survives review. The result is confusing - declarations in the later block silently win ties, so edits to the earlier block appear to have no effect.@media/@supports/@layercondition or a different nesting parent is not a duplicate. Comparison would be done on normalized selector text (whitespace-insensitive)..a .bvs.a { & .b }).