Skip to content

Latest commit

 

History

History
388 lines (271 loc) · 32.9 KB

rules.md

File metadata and controls

388 lines (271 loc) · 32.9 KB

Rules

There are over one hundred built-in rules to help you:

Many of them are turned on in our recommended (Ⓡ) and standard (Ⓢ) configs.

Avoid errors

You can avoid errors with these no rules.

Descending

Disallow descending things with these no-descending rules.

  • no-descending-specificity: Disallow selectors of lower specificity from coming after overriding selectors of higher specificity (Ⓡ & Ⓢ).

Duplicate

Disallow duplicates with these no-duplicate rules.

Empty

Disallow empty things with these no-empty rules.

Invalid

Disallow invalid syntax with these (sometimes implicit) no-invalid rules.

Irregular

Disallow irregular things with these no-irregular rules.

Missing

Disallow missing things with these no-missing rules.

Non-standard

Disallow non-standard things with these no-nonstandard rules.

Overrides

Disallow overrides with these no-overrides rules.

Unknown

Disallow unknown things with these no-unknown rules.

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

Color

Comment

Declaration

Function

Length

Media feature

Property

Rule

Selector

Unit

Value

Case

Specify lowercase or uppercase for words.

  • function-name-case: Specify lowercase or uppercase for function names (Autofixable) (Ⓢ).
  • selector-type-case: Specify lowercase or uppercase for type selectors (Autofixable) (Ⓢ).
  • value-keyword-case: Specify lowercase or uppercase for keywords values (Autofixable) (Ⓢ).

Empty lines

Max & min

Apply limits with these max and min rules.

Notation

Enforce one representation of things that have multiple with these notation (sometimes implicit) rules.

Pattern

Enforce naming conventions with these pattern rules.

Quotes

Require or disallow quotes with these quotes rules.

Redundant

Disallow redundancy with these no-redundant rules.

Whitespace inside

Require or disallow whitespace on the inside.

Deprecated

These rules are deprecated — we won't fix bugs nor add options, and we will remove them in the next major release. We recommend you use a pretty printer (like Prettier) alongside Stylelint rather than these rules.

Color

  • color-hex-case: Specify lowercase or uppercase for hex colors (Autofixable).

Function

Number

String

  • string-quotes: Specify single or double quotes around strings (Autofixable).

Unit

  • unit-case: Specify lowercase or uppercase for units (Autofixable).

Value list

Property

  • property-case: Specify lowercase or uppercase for properties (Autofixable).

Declaration

Declaration block

Block

Selector

Selector list

Media feature

Media query list

At-rule

General / Sheet