-
Notifications
You must be signed in to change notification settings - Fork 533
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
no-duplicate-properties should allow repeat properties when they are directly next to each other #280
Comments
I think this should be an extra option, by default it should disallow completely because I think this waters the rule down a lot. If we had an option such as Do we also think that maybe a whitelist of available duplicates as well as them being unique values would be appreciated? |
Happy for this to be an option. I agree that strictness by default is preferable. It looks like scss-lint doesn't deal with this either. We have whitelists in other rules so that sounds handy for consistency. As most of the time needing fallbacks is for |
Ok I think the whitelist is the way to go then. Checking for unique values may prove too far reaching, Simply adding your properties to an |
If we're going to allow a whitelist for this rule, it needs to be a whitelist on the full declaration ( |
Hmm I don't see that as too practical then really. Font fallbacks for rem's for example is one case where you'd need to whitelist every single pixel size used. This is probably another case where #70 would be useful. If we were to whitelist just the property name but then still raise a warning/error if the duplicate property wasn't on the next line as above I feel that any major user error here would be avoided? // even if border is whitelisted then raise an issue here.
.mybox {
border: 1px solid black;
color: green;
border: 1px solid red;
} Do you think that would be acceptable @Snugug ? |
Agreed that #70 might be a preferable solution to whitelisting explicit properties. This sort of defining fallback properties would probably be done within mixins so people wouldn't have to pepper their entire codebase with the ignore comments. I don't think the whitelist for the full declaration would be feasible, along with @DanPurdy's rem with px fallback, my other most common usage of duplicate properties is for rgba with a hex color fallback which would also require a laundry list of exceptions. |
As long as the whitelist is only if they are right next to each other, that's okay by me for a less restrictive whitelist
|
Agreed |
So... Rather embarrassingly I just went to look at this and there is already an exclusion whitelist option.. It's not as tight an implementation as we just discussed but nonetheless it exists. I will update the documentation with examples and submit a PR to tighten this up. |
Sorry to comment on an old closed issue, but I arrived here after using
I think adding an option that allows properties not because they are in a whitelist but simply because they are right after the other is very convenient and can accomodate many edge-cases (think of |
Hey @mcdado can you open a separate issue up for this please if you'd like to suggest it as a feature. 👍 |
Okay! 😉 #726 |
Duplicating properties is sometimes required - such as when providing fallbacks for unsupported features, e.g. the following is a legitimate usage but currently raises a warning:
Sass-lint should follow CSSLint's lead and allow duplicate properties when they have different values but are immediately next to each other. I.e. the following are warnings:
But the following should be acceptable, and not raise a warning:
The text was updated successfully, but these errors were encountered: