Refer to the CLI section of the docs.
The CLI can also be used from within npm run scripts to use a non-global installation of stylelint.
lint-staged is a NodeJS script that supports running stylelint against Git staged files.
The stylelint community maintains a handful of plugins for popular task runners, including ones for gulp, webpack, Broccoli and Grunt. Refer to their individual READMEs to get started.
If there isn't a dedicated stylelint plugin for your task runner of choice, you can use stylelint as a PostCSS plugin and make use of PostCSS's numerous task runner plugins.
There are also examples of using the PostCSS plugin via the PostCSS JS API within the docs.
However, using stylelint as a PostCSS plugin limits your reporting options to postcss-reporter. We recommend using the stylelint CLI or Node API, instead, for better reporting.
The stylelint community also maintains a handful of plugins for popular editors. Refer to their individual READMEs to get started.
stylelint can parse any the following non-standard syntaxes: SCSS, Less and SugarSS. Refer to the docs on how to configure stylelint to parse one of these syntaxes.
Should I lint before or after processing my stylesheets through PostCSS plugins or other processors?
We recommend linting your source files before any transformations.
stylelint can extract and lint any styles within <style> tags. This can be done via the Node API and the CLI.
stylefmt supports stylelint configuration files and can automatically fix a number of stylistic warnings.
Each rule stands alone, so sometimes it's possible to configure rules such that they conflict with one another. For example, you could turn on two conflicting blacklist and whitelist rules, e.g. unit-blacklist and unit-whitelist.
It's your responsibility as the configuration author to resolve these conflicts.
Rules focus on standard css and aim to be valuable to the majority of users. Whereas plugins are rules and sets of rules built by the community that support methodologies, toolsets, non-standard CSS features, or very specific use cases.
Yes, you can either use the message secondary option or write your own formatter.
You'll want to make use of the stylelint-selector-bem-pattern plugin.
You can also take advantage of selector-* rules to ban certain categories of selectors (e.g. id selectors) and control specificity.
If you're using SUITCSS, you'll probably want to use their shareable config.
Use the defaultSeverity configuration option.