Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Duplication Rule to StyleLinter #661

Open
llflannery opened this issue Jun 14, 2024 · 0 comments
Open

Add Duplication Rule to StyleLinter #661

llflannery opened this issue Jun 14, 2024 · 0 comments
Labels
css Requires understanding CSS/SCSS enhancement New feature or request good first issue Good for newcomers ux Designing and implementing user experience improvements

Comments

@llflannery
Copy link

Description

In Ally stylelint config, we should add an additional rule that would flag any duplication of properties.

Screenshot 2024-06-14 at 4 23 41 PM

It would involve adding "declaration-block-no-duplicate-properties": true, and ignore: ["consecutive-duplicates-with-different-values"] in the .stylelintrc.json settings.

StyleLinter Documentation found here https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties/

Use Case

When a developer is writing two identical properties in CSS, the linter should warn them that the first property will be overrided and effectively useless. If someone needs a duplicative property for a specific reason, they would have to disable stylelint for that line intentionally.

padding: 20px;
padding: 30px; 

One concern is that it will start to flag css code that looks like:

.thing-that-renders-with-js {
    /* critical:start */
    opacity: 0;
    /* critical:end */
    opacity: 1;
}

Depending on how many errors like that are flagged, we may have to put a pin in this and have a broader discussion.

@llflannery llflannery added enhancement New feature or request good first issue Good for newcomers css Requires understanding CSS/SCSS ux Designing and implementing user experience improvements labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css Requires understanding CSS/SCSS enhancement New feature or request good first issue Good for newcomers ux Designing and implementing user experience improvements
Projects
None yet
Development

No branches or pull requests

1 participant