stylelint-scss

A collection of SCSS specific linting rules for Stylelint

Showing:

Popularity

Downloads/wk

1M

GitHub Stars

740

Maintenance

Last Commit

1mo ago

Contributors

56

Package

Dependencies

5

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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 the 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

  • at-each-key-value-single-line: This is a rule that checks for situations where users have done a loop using map-keys and grabbed the value for that key inside of the loop.

@-else

@-extend

@-function

@-if

@-import

@-mixin

@-rule

$-variable

%-placeholder

//-comment

Comment

Declaration

Dimension

Function

Map

Media feature

Operator

Partial

Selector

General / Sheet

Help out

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

  • Create, enhance, and debug rules (see stylelint's guide to "Working on rules").
  • Improve documentation.
  • Chime in on any open issue or pull request.
  • Open new issues about your ideas on new rules, or for how to improve the existing ones, and pull requests to show us how your idea works.
  • Add new tests to absolutely anything.
  • Work on improving performance of rules.
  • Contribute to stylelint
  • Spread the word.

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:

kristerkari dryoma rambleraptor XhmikosR Eugeno joseph118
kristerkari dryoma rambleraptor XhmikosR Eugeno joseph118
niksy kaysonwu srawlins pipopotamasu ybiquitous OriR
niksy kaysonwu srawlins pipopotamasu ybiquitous OriR
ntwb ricardogobbosouza jeddy3 bjankord kevindew thibaudcolas
ntwb ricardogobbosouza jeddy3 bjankord kevindew thibaudcolas
AndyOGo alexander-akait vseventer SterlingVix Calme1709 Deimos
AndyOGo alexander-akait vseventer SterlingVix Calme1709 Deimos
diego-codes EvanHahn guoyunhe jantimon stormwarning keegan-lillo
diego-codes EvanHahn guoyunhe jantimon stormwarning keegan-lillo
manovotny paulgv sajadtorkamani YozhikM chalkygames123 AM-77
manovotny paulgv sajadtorkamani YozhikM chalkygames123 AM-77
YodaDaCoda freezy-sk
YodaDaCoda freezy-sk

Important documents

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial