Rules
There are over one hundred built-in rules to help you:
We turn on most of the rules in our standard config (✅) and many can be autofixed (🔧).
Avoid errors
You can avoid errors with these no rules.
Descending
Disallow descending things with these no-descending rules.
no-descending-specificityDisallow selectors of lower specificity from coming after overriding selectors of higher specificity. | ✅ |
Duplicate
Disallow duplicates with these no-duplicate rules.
declaration-block-no-duplicate-custom-propertiesDisallow duplicate custom properties within declaration blocks. | ✅ | |
declaration-block-no-duplicate-propertiesDisallow duplicate properties within declaration blocks. | ✅ | 🔧 |
font-family-no-duplicate-namesDisallow duplicate names within font families. | ✅ | 🔧 |
keyframe-block-no-duplicate-selectorsDisallow duplicate selectors within keyframe blocks. | ✅ | |
no-duplicate-at-import-rulesDisallow duplicate @import rules. | ✅ | |
no-duplicate-selectorsDisallow duplicate selectors. | ✅ |
Empty
Disallow empty things with these no-empty rules.
block-no-emptyDisallow empty blocks. | ✅ | |
comment-no-emptyDisallow empty comments. | ✅ | |
no-empty-sourceDisallow empty sources. | ✅ |
Invalid
Disallow invalid syntax with these (sometimes implicit) no-invalid rules.
color-no-invalid-hexDisallow invalid hex colors. | ✅ | |
function-calc-no-unspaced-operatorDisallow invalid unspaced operator within calc functions. | ✅ | 🔧 |
keyframe-declaration-no-importantDisallow invalid !important within keyframe declarations. | ✅ | |
media-query-no-invalidDisallow invalid media queries. | ✅ | |
named-grid-areas-no-invalidDisallow invalid named grid areas. | ✅ | |
no-invalid-double-slash-commentsDisallow invalid double-slash comments. | ✅ | |
no-invalid-position-at-import-ruleDisallow invalid position @import rules. | ✅ | |
string-no-newlineDisallow invalid newlines within strings. | ✅ |
Irregular
Disallow irregular things with these no-irregular rules.
no-irregular-whitespaceDisallow irregular whitespace. | ✅ |
Missing
Disallow missing things with these no-missing rules.
custom-property-no-missing-var-functionDisallow missing var function for custom properties. | ✅ | |
font-family-no-missing-generic-family-keywordDisallow a missing generic family keyword within font families. | ✅ |
Non-standard
Disallow non-standard things with these no-nonstandard rules.
function-linear-gradient-no-nonstandard-directionDisallow non-standard direction values for linear gradient functions. | ✅ |
Overrides
Disallow overrides with these no-overrides rules.
declaration-block-no-shorthand-property-overridesDisallow shorthand properties that override related longhand properties. | ✅ |
Unmatchable
Disallow unmatchable things with these no-unmatchable rules.
selector-anb-no-unmatchableDisallow unmatchable An+B selectors. | ✅ |
Unknown
Disallow unknown things with these no-unknown rules.
annotation-no-unknownDisallow unknown annotations. | ✅ | |
at-rule-no-unknownDisallow unknown at-rules. | ✅ | |
declaration-property-value-no-unknownDisallow unknown values for properties within declarations. | ||
function-no-unknownDisallow unknown functions. | ✅ | |
media-feature-name-no-unknownDisallow unknown media feature names. | ✅ | |
media-feature-name-value-no-unknownDisallow unknown values for media features. | ||
no-unknown-animationsDisallow unknown animations. | ||
no-unknown-custom-mediaDisallow unknown custom media queries. | ||
no-unknown-custom-propertiesDisallow unknown custom properties. | ||
property-no-unknownDisallow unknown properties. | ✅ | |
selector-pseudo-class-no-unknownDisallow unknown pseudo-class selectors. | ✅ | |
selector-pseudo-element-no-unknownDisallow unknown pseudo-element selectors. | ✅ | |
selector-type-no-unknownDisallow unknown type selectors. | ✅ | |
unit-no-unknownDisallow unknown units. | ✅ |
Enforce conventions
You can enforce conventions with these no and list rules. They are powerful rules for making your code consistent. You'll need to configure most of them to suit your needs.
Allowed, disallowed & required
Allow, disallow or require things with these allowed-list, disallowed-list, required-list and no rules.
At-rule
at-rule-allowed-listSpecify a list of allowed at-rules. | ||
at-rule-disallowed-listSpecify a list of disallowed at-rules. | ||
at-rule-no-vendor-prefixDisallow vendor prefixes for at-rules. | ✅ | 🔧 |
at-rule-property-required-listSpecify a list of required properties for an at-rule. |
Color
color-hex-alphaRequire or disallow alpha channel for hex colors. | ||
color-namedRequire (where possible) or disallow named colors. | ||
color-no-hexDisallow hex colors. |
Comment
comment-word-disallowed-listSpecify a list of disallowed words within comments. |
Declaration
declaration-no-importantDisallow !important within declarations. | ||
declaration-property-unit-allowed-listSpecify a list of allowed property and unit pairs within declarations. | ||
declaration-property-unit-disallowed-listSpecify a list of disallowed property and unit pairs within declarations. | ||
declaration-property-value-allowed-listSpecify a list of allowed property and value pairs within declarations. | ||
declaration-property-value-disallowed-listSpecify a list of disallowed property and value pairs within declarations. |
Function
function-allowed-listSpecify a list of allowed functions. | ||
function-disallowed-listSpecify a list of disallowed functions. | ||
function-url-no-scheme-relativeDisallow scheme-relative URLs. | ||
function-url-scheme-allowed-listSpecify a list of allowed URL schemes. | ||
function-url-scheme-disallowed-listSpecify a list of disallowed URL schemes. |
Length
length-zero-no-unitDisallow units for zero lengths. | ✅ | 🔧 |