Home

Awesome

stylelint-scss

npm version Build Status Coverage Status contributions welcome Downloads per month

A collection of SCSS-specific linting rules for Stylelint (in a form of a plugin).

Purpose

Stylelint by itself supports SCSS syntax very well (as well as other preprocessors' syntaxes). Moreover, it introduces some specific rules that can be used to lint SCSS, e.g. to limit nesting, control the way @-rules are written. Yet Stylelint is in general focused on standard CSS.

stylelint-scss introduces rules specific to SCSS syntax. That said, the rules from this plugin can be used with other syntaxes, like Less or some PostCSS syntaxes. That's why the rules' names are not tied to SCSS only (at-function-pattern instead of scss-function-pattern).

The plugin follows Stylelint's guidelines (about rule names, testing and so on).

Installation and usage

This plugin is used in the stylelint-config-standard-scss shared config. We recommend using that shared config, rather than installing this plugin directly.

However, the plugin can still be used in you're crafting a config from the ground up. First, install stylelint-scss (and stylelint, if you haven't done so yet) via npm:

npm install stylelint stylelint-scss

Create the .stylelintrc.json config file (or open the existing one), add stylelint-scss to the plugins array and the rules you need to the rules list. All rules from stylelint-scss need to be namespaced with scss.

{
  "plugins": ["stylelint-scss"],
  "rules": {
    // recommended rules
    "at-rule-no-unknown": null,
    "scss/at-rule-no-unknown": true,
    // ...
    // any other rules you'd want to change e.g.
    "scss/dollar-variable-pattern": "^foo",
    "scss/selector-no-redundant-nesting-selector": true
  }
}

Please refer to Stylelint docs for detailed info on using this linter.

List of rules

Here are stylelint-scss' rules, grouped by the thing they apply to (just like in Stylelint).

Please also see the example configs for special cases.

@-each

@-else

@-extend

@-function

@-if

@-import

@-mixin

@-rule

@-use

$-variable

%-placeholder

//-comment

Block

Comment

Declaration

Dimension

Function

Map

Media feature

Operator

Partial

Property

Selector

Load

General / Sheet

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.

Help out

The work on the plugin's rules is still in progress, so if you feel like it, you're welcome to help out with any of these (the plugin follows Stylelint guidelines so most of this is based on its docs):

We communicate via issues and pull requests.

There is also StackOverflow, which would be the preferred QA forum.

Contributors

Thanks goes to these wonderful people:

<table> <thead> <tr> <th align="center"><a href="https://github.com/kristerkari"><img alt="kristerkari" src="https://avatars.githubusercontent.com/u/993108?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/dryoma"><img alt="dryoma" src="https://avatars.githubusercontent.com/u/11942776?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/rambleraptor"><img alt="rambleraptor" src="https://avatars.githubusercontent.com/u/1325798?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/XhmikosR"><img alt="XhmikosR" src="https://avatars.githubusercontent.com/u/349621?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/ybiquitous"><img alt="ybiquitous" src="https://avatars.githubusercontent.com/u/473530?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/pamelalozano16"><img alt="pamelalozano16" src="https://avatars.githubusercontent.com/u/30474787?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/kristerkari">kristerkari</a></td> <td align="center"><a href="https://github.com/dryoma">dryoma</a></td> <td align="center"><a href="https://github.com/rambleraptor">rambleraptor</a></td> <td align="center"><a href="https://github.com/XhmikosR">XhmikosR</a></td> <td align="center"><a href="https://github.com/ybiquitous">ybiquitous</a></td> <td align="center"><a href="https://github.com/pamelalozano16">pamelalozano16</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/Eugeno"><img alt="Eugeno" src="https://avatars.githubusercontent.com/u/23382920?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/joseph118"><img alt="joseph118" src="https://avatars.githubusercontent.com/u/6863655?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/stof"><img alt="stof" src="https://avatars.githubusercontent.com/u/439401?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/niksy"><img alt="niksy" src="https://avatars.githubusercontent.com/u/389286?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/kaysonwu"><img alt="kaysonwu" src="https://avatars.githubusercontent.com/u/14865584?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/srawlins"><img alt="srawlins" src="https://avatars.githubusercontent.com/u/103167?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/Eugeno">Eugeno</a></td> <td align="center"><a href="https://github.com/joseph118">joseph118</a></td> <td align="center"><a href="https://github.com/stof">stof</a></td> <td align="center"><a href="https://github.com/niksy">niksy</a></td> <td align="center"><a href="https://github.com/kaysonwu">kaysonwu</a></td> <td align="center"><a href="https://github.com/srawlins">srawlins</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/jhae-de"><img alt="jhae-de" src="https://avatars.githubusercontent.com/u/28291021?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/FloEdelmann"><img alt="FloEdelmann" src="https://avatars.githubusercontent.com/u/202916?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/pipopotamasu"><img alt="pipopotamasu" src="https://avatars.githubusercontent.com/u/14048211?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/OriR"><img alt="OriR" src="https://avatars.githubusercontent.com/u/2384068?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/ntwb"><img alt="ntwb" src="https://avatars.githubusercontent.com/u/1016458?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/ricardogobbosouza"><img alt="ricardogobbosouza" src="https://avatars.githubusercontent.com/u/13064722?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/jhae-de">jhae-de</a></td> <td align="center"><a href="https://github.com/FloEdelmann">FloEdelmann</a></td> <td align="center"><a href="https://github.com/pipopotamasu">pipopotamasu</a></td> <td align="center"><a href="https://github.com/OriR">OriR</a></td> <td align="center"><a href="https://github.com/ntwb">ntwb</a></td> <td align="center"><a href="https://github.com/ricardogobbosouza">ricardogobbosouza</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/jeddy3"><img alt="jeddy3" src="https://avatars.githubusercontent.com/u/808227?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/evilebottnawi"><img alt="evilebottnawi" src="https://avatars.githubusercontent.com/u/23334705?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/kevindew"><img alt="kevindew" src="https://avatars.githubusercontent.com/u/282717?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/thibaudcolas"><img alt="thibaudcolas" src="https://avatars.githubusercontent.com/u/877585?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/chimurai"><img alt="chimurai" src="https://avatars.githubusercontent.com/u/655241?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/vseventer"><img alt="vseventer" src="https://avatars.githubusercontent.com/u/638323?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/jeddy3">jeddy3</a></td> <td align="center"><a href="https://github.com/evilebottnawi">evilebottnawi</a></td> <td align="center"><a href="https://github.com/kevindew">kevindew</a></td> <td align="center"><a href="https://github.com/thibaudcolas">thibaudcolas</a></td> <td align="center"><a href="https://github.com/chimurai">chimurai</a></td> <td align="center"><a href="https://github.com/vseventer">vseventer</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/xboy2012"><img alt="xboy2012" src="https://avatars.githubusercontent.com/u/7540144?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/chalkygames123"><img alt="chalkygames123" src="https://avatars.githubusercontent.com/u/5608239?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/bjankord"><img alt="bjankord" src="https://avatars.githubusercontent.com/u/633148?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/AndyOGo"><img alt="AndyOGo" src="https://avatars.githubusercontent.com/u/914443?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/qmhc"><img alt="qmhc" src="https://avatars.githubusercontent.com/u/40221744?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/freezy-sk"><img alt="freezy-sk" src="https://avatars.githubusercontent.com/u/661637?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/xboy2012">xboy2012</a></td> <td align="center"><a href="https://github.com/chalkygames123">chalkygames123</a></td> <td align="center"><a href="https://github.com/bjankord">bjankord</a></td> <td align="center"><a href="https://github.com/AndyOGo">AndyOGo</a></td> <td align="center"><a href="https://github.com/qmhc">qmhc</a></td> <td align="center"><a href="https://github.com/freezy-sk">freezy-sk</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/YodaDaCoda"><img alt="YodaDaCoda" src="https://avatars.githubusercontent.com/u/365349?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/wlewis-formative"><img alt="wlewis-formative" src="https://avatars.githubusercontent.com/u/91909230?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/kersh"><img alt="kersh" src="https://avatars.githubusercontent.com/u/621330?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/AM-77"><img alt="AM-77" src="https://avatars.githubusercontent.com/u/18232579?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/YozhikM"><img alt="YozhikM" src="https://avatars.githubusercontent.com/u/27273025?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/sajadtorkamani"><img alt="sajadtorkamani" src="https://avatars.githubusercontent.com/u/9380313?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/YodaDaCoda">YodaDaCoda</a></td> <td align="center"><a href="https://github.com/wlewis-formative">wlewis-formative</a></td> <td align="center"><a href="https://github.com/kersh">kersh</a></td> <td align="center"><a href="https://github.com/AM-77">AM-77</a></td> <td align="center"><a href="https://github.com/YozhikM">YozhikM</a></td> <td align="center"><a href="https://github.com/sajadtorkamani">sajadtorkamani</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/paulgv"><img alt="paulgv" src="https://avatars.githubusercontent.com/u/4895885?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/01taylop"><img alt="01taylop" src="https://avatars.githubusercontent.com/u/727360?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/nlydv"><img alt="nlydv" src="https://avatars.githubusercontent.com/u/39429628?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/manovotny"><img alt="manovotny" src="https://avatars.githubusercontent.com/u/446260?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/keegan-lillo"><img alt="keegan-lillo" src="https://avatars.githubusercontent.com/u/3537963?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/stormwarning"><img alt="stormwarning" src="https://avatars.githubusercontent.com/u/999825?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/paulgv">paulgv</a></td> <td align="center"><a href="https://github.com/01taylop">01taylop</a></td> <td align="center"><a href="https://github.com/nlydv">nlydv</a></td> <td align="center"><a href="https://github.com/manovotny">manovotny</a></td> <td align="center"><a href="https://github.com/keegan-lillo">keegan-lillo</a></td> <td align="center"><a href="https://github.com/stormwarning">stormwarning</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/jantimon"><img alt="jantimon" src="https://avatars.githubusercontent.com/u/4113649?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/guoyunhe"><img alt="guoyunhe" src="https://avatars.githubusercontent.com/u/5836790?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/G-Rath"><img alt="G-Rath" src="https://avatars.githubusercontent.com/u/3151613?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/EvanHahn"><img alt="EvanHahn" src="https://avatars.githubusercontent.com/u/777712?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/lithiumlron"><img alt="lithiumlron" src="https://avatars.githubusercontent.com/u/101921280?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/diego-codes"><img alt="diego-codes" src="https://avatars.githubusercontent.com/u/5973294?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/jantimon">jantimon</a></td> <td align="center"><a href="https://github.com/guoyunhe">guoyunhe</a></td> <td align="center"><a href="https://github.com/G-Rath">G-Rath</a></td> <td align="center"><a href="https://github.com/EvanHahn">EvanHahn</a></td> <td align="center"><a href="https://github.com/lithiumlron">lithiumlron</a></td> <td align="center"><a href="https://github.com/diego-codes">diego-codes</a></td> </tr> </tbody></table> <table> <thead> <tr> <th align="center"><a href="https://github.com/Deimos"><img alt="Deimos" src="https://avatars.githubusercontent.com/u/9033?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/Calme1709"><img alt="Calme1709" src="https://avatars.githubusercontent.com/u/30140939?v=4&s=80" width="80"></a></th> <th align="center"><a href="https://github.com/SterlingVix"><img alt="SterlingVix" src="https://avatars.githubusercontent.com/u/7531113?v=4&s=80" width="80"></a></th> </tr> </thead> <tbody><tr> <td align="center"><a href="https://github.com/Deimos">Deimos</a></td> <td align="center"><a href="https://github.com/Calme1709">Calme1709</a></td> <td align="center"><a href="https://github.com/SterlingVix">SterlingVix</a></td> </tr> </tbody></table>

Important documents