Skip to main content

stylelint

Supported VersionLanguageWebsite
8.3.0+ (default: 13.13.1)CSS and flavors (e.g. Sass)https://stylelint.io

stylelint is a pluggable linter to help you avoid errors and enforce conventions for CSS and CSS-like languages. It provides many core rules and third-party rules by the community.

Getting Started#

To start using stylelint, enable it in your repository settings.

If you want to use a version except for the Sider default version or use some plugins or shareable configurations, install it into your repository as follows:

$ npm install stylelint --save-dev
$ npm install stylelint-config-standard --save-dev

Sider supports styelint plugins and configurations that are provided as npm packages.

If you need more customization, use the standard stylelint configuration files. For example, use .stylelintrc.yaml to customize rules, and .stylelintignore to ignore files and directories.

Default Configuration for stylelint#

If you have no custom configurations, Sider uses the default configuration.

In the same way, Sider users the default ignore file if not exist.

Configuration#

Here is an example configuration via sider.yml:

linter:  stylelint:    target: "**/*.{css,scss}"    config: my_stylelintrc.yaml    syntax: sugarss    ignore-path: .gitignore    ignore-disables: true    report-needless-disables: true    quiet: true

You can use the following options to fine-tune stylelint to your project.

NameTypeDefault
root_dirstring-
dependenciesstring[], map[]-
npm_installboolean, string-
targetstring, string[]**/*.{css,less,sass,scss,sss}
configstring-
syntaxstring-
ignore-pathstring-
ignore-disablesbooleanfalse
report-needless-disablesbooleanfalse
quietbooleanfalse

See also the official document for details about each option.

target#

This option allows you to specify files or directories to be analyzed. Glob patterns are available.

alias: glob

config#

This option allows you to specify a configuration file you want. See also the --config option.

syntax#

This option allows you to specify a syntax you want. If omitted, stylelint automatically infers the syntaxes. See also the --syntax option.

ignore-path#

This option allows you to specify a ignore file. See also the --ignore-path option.

ignore-disables#

This option allows you to ignore all the disable-comments, e.g. /* stylelint-disable block-no-empty */. See also the --ignore-disables option.

report-needless-disables#

This option allows you to select whether reporting unused stylelint-disable comments or not. See also the --report-needless-disables option.

quiet#

This option allows you to select whether ignoring warnings and reporting only errors. See also the --quiet option.