All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rules.scsslint.DuplicateProperty.html Maven / Gradle / Ivy

Details

Reports when you define the same property twice in a single rule set.

Bad

h1 {
margin: 10px;
text-transform: uppercase;
margin: 0; // Second declaration
}

Having duplicate properties is usually just an error. However, they can be used as a technique for dealing with varying levels of browser support for CSS properties. In the example below, some browsers might not support the rgba function, so the intention is to fall back to the color #fff.

.box {
background: #fff;
background: rgba(255, 255, 255, .5);
}

In this situation, using duplicate properties is acceptable, but you will have to configure DuplicateProperty with the ignore_consecutive option, so that it won't consider such cases to be lint. ignore_consecutive can be set to true, false (default), or a list of property names to be allowed. For example, to ignore consecutive background and transition properties, as above, you can configure DuplicateProperty with:

DuplicateProperty:
ignore_consecutive:
- background
- transition
Configuration Option Description
ignore_consecutive Whether to ignore consecutive duplicate properties (default false), or a whitelist.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy