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. | ✅ | 🔧 |
Media feature
media-feature-name-allowed-listSpecify a list of allowed media feature names. | ||
media-feature-name-disallowed-listSpecify a list of disallowed media feature names. | ||
media-feature-name-no-vendor-prefixDisallow vendor prefixes for media feature names. | ✅ | 🔧 |
media-feature-name-unit-allowed-listSpecify a list of allowed name and unit pairs within media features. | ||
media-feature-name-value-allowed-listSpecify a list of allowed media feature name and value pairs. |
Property
property-allowed-listSpecify a list of allowed properties. | ||
property-disallowed-listSpecify a list of disallowed properties. | ||
property-no-vendor-prefixDisallow vendor prefixes for properties. | ✅ | 🔧 |
Rule
rule-selector-property-disallowed-listSpecify a list of disallowed properties for selectors within rules. |
Selector
selector-attribute-name-disallowed-listSpecify a list of disallowed attribute names. | ||
selector-attribute-operator-allowed-listSpecify a list of allowed attribute operators. | ||
selector-attribute-operator-disallowed-listSpecify a list of disallowed attribute operators. | ||
selector-combinator-allowed-listSpecify a list of allowed combinators. | ||
selector-combinator-disallowed-listSpecify a list of disallowed combinators. | ||
selector-disallowed-listSpecify a list of disallowed selectors. | ||
selector-no-qualifying-typeDisallow qualifying a selector by type. | ||
selector-no-vendor-prefixDisallow vendor prefixes for selectors. | ✅ | 🔧 |
selector-pseudo-class-allowed-listSpecify a list of allowed pseudo-class selectors. | ||
selector-pseudo-class-disallowed-listSpecify a list of disallowed pseudo-class selectors. | ||
selector-pseudo-element-allowed-listSpecify a list of allowed pseudo-element selectors. | ||
selector-pseudo-element-disallowed-listSpecify a list of disallowed pseudo-element selectors. |
Unit
unit-allowed-listSpecify a list of allowed units. | ||
unit-disallowed-listSpecify a list of disallowed units. |
Value
value-no-vendor-prefixDisallow vendor prefixes for values. | ✅ | 🔧 |
Case
Specify lowercase or uppercase for words with these case rules.
function-name-caseSpecify lowercase or uppercase for function names. | ✅ | 🔧 |
selector-type-caseSpecify lowercase or uppercase for type selectors. | ✅ | 🔧 |
value-keyword-caseSpecify lowercase or uppercase for keywords values. | ✅ | 🔧 |
Empty lines
Enforce or disallow empty lines before constructs with these empty-line-before rules.
at-rule-empty-line-beforeRequire or disallow an empty line before at-rules. | ✅ | 🔧 |
comment-empty-line-beforeRequire or disallow an empty line before comments. | ✅ | 🔧 |
custom-property-empty-line-beforeRequire or disallow an empty line before custom properties. | ✅ | 🔧 |
declaration-empty-line-beforeRequire or disallow an empty line before declarations. | ✅ | 🔧 |
rule-empty-line-beforeRequire or disallow an empty line before rules. | ✅ | 🔧 |
Max & min
Apply limits with these max and min rules.
declaration-block-single-line-max-declarationsLimit the number of declarations within a single-line declaration block. | ✅ | |
declaration-property-max-valuesLimit the number of values for a list of properties within declarations. | ||
max-nesting-depthLimit the depth of nesting. | ||
number-max-precisionLimit the number of decimal places allowed in numbers. | ✅ | |
selector-max-attributeLimit the number of attribute selectors in a selector. | ||
selector-max-classLimit the number of classes in a selector. | ||
selector-max-combinatorsLimit the number of combinators in a selector. | ||
selector-max-compound-selectorsLimit the number of compound selectors in a selector. | ||
selector-max-idLimit the number of ID selectors in a selector. | ||
selector-max-pseudo-classLimit the number of pseudo-classes in a selector. | ||
selector-max-specificityLimit the specificity of selectors. | ||
selector-max-typeLimit the number of type selectors in a selector. | ||
selector-max-universalLimit the number of universal selectors in a selector. | ||
time-min-millisecondsLimit the minimum number of milliseconds for time values. |
Notation
Enforce one representation of things that have multiple with these notation (sometimes implicit) rules.
alpha-value-notationSpecify percentage or number notation for alpha-values. | ✅ | 🔧 |
color-function-notationSpecify modern or legacy notation for color-functions. | ✅ | 🔧 |
color-hex-lengthSpecify short or long notation for hex colors. | ✅ | 🔧 |
font-weight-notationSpecify numeric or named notation for font weights. | 🔧 | |
hue-degree-notationSpecify number or angle notation for degree hues. | ✅ | 🔧 |
import-notationSpecify string or URL notation for @import rules. | ✅ | 🔧 |
keyframe-selector-notationSpecify keyword or percentage notation for keyframe selectors. | ✅ | 🔧 |
lightness-notationSpecify number or percentage notation for lightness. | ✅ | 🔧 |
media-feature-range-notationSpecify context or prefix notation for media feature ranges. | ✅ | 🔧 |
selector-not-notationSpecify simple or complex notation for :not() pseudo-class selectors. | ✅ | 🔧 |
selector-pseudo-element-colon-notationSpecify single or double colon notation for applicable pseudo-element selectors. | ✅ | 🔧 |
Pattern
Enforce naming conventions with these pattern rules.
comment-patternSpecify a pattern for comments. | ||
custom-media-patternSpecify a pattern for custom media query names. | ✅ | |
custom-property-patternSpecify a pattern for custom properties. | ✅ | |
keyframes-name-patternSpecify a pattern for keyframe names. | ✅ | |
selector-class-patternSpecify a pattern for class selectors. | ✅ | |
selector-id-patternSpecify a pattern for ID selectors. | ✅ | |
selector-nested-patternSpecify a pattern for the selectors of rules nested within rules. |
Quotes
Require or disallow quotes with these quotes rules.
font-family-name-quotesRequire or disallow quotes for font family names. | ✅ | 🔧 |
function-url-quotesRequire or disallow quotes for urls. | ✅ | 🔧 |
selector-attribute-quotesRequire or disallow quotes for attribute values. | ✅ | 🔧 |
Redundant
Disallow redundancy with these no-redundant rules.
declaration-block-no-redundant-longhand-propertiesDisallow redundant longhand properties within declaration-block. | ✅ | 🔧 |
shorthand-property-no-redundant-valuesDisallow redundant values within shorthand properties. | ✅ | 🔧 |
Whitespace inside
Require or disallow whitespace on the inside with this whitespace-inside rule.
comment-whitespace-insideRequire or disallow whitespace on the inside of comment markers. | ✅ | 🔧 |