stylelint
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@csstools/css-parser-algorithms | 2.6.1 | 44.46 kB | MIT | prod peer | |
@csstools/css-tokenizer | 2.2.4 | 60.21 kB | MIT | prod peer | |
@csstools/media-query-list-parser | 2.1.9 | 109.82 kB | MIT | prod | |
@csstools/selector-specificity | 3.0.3 | 9.93 kB | MIT-0 | prod | |
balanced-match | 2.0.0 | 2.66 kB | MIT | prod | |
colord | 2.9.3 | 31.95 kB | MIT | prod | |
cosmiconfig | 8.3.6 | 18.95 kB | MIT | prod | |
css-functions-list | 3.2.1 | 5.93 kB | MIT | prod | |
css-tree | 2.3.1 | 272.24 kB | MIT | prod | 1 |
debug | 4.3.4 | 12.94 kB | MIT | prod | |
fast-glob | 3.3.2 | 24.37 kB | MIT | prod | |
fastest-levenshtein | 1.0.16 | 5.96 kB | MIT | prod | |
file-entry-cache | 6.0.1 | 7.61 kB | MIT | prod | |
global-modules | 2.0.0 | 2.71 kB | MIT | prod | |
globby | 11.1.0 | 6.23 kB | MIT | prod | |
globjoin | 0.1.4 | 2.25 kB | MIT | prod | |
html-tags | 3.3.1 | 2.58 kB | MIT | prod | |
ignore | 5.3.1 | 14.1 kB | MIT | prod | |
import-lazy | 4.0.0 | 2.17 kB | MIT | prod | |
imurmurhash | 0.1.4 | 4.21 kB | MIT | prod | |
is-plain-object | 5.0.0 | 3.33 kB | MIT | prod | |
known-css-properties | 0.28.0 | 7.09 kB | MIT | prod | |
mathml-tag-names | 2.1.3 | 3.03 kB | MIT | prod | |
meow | 10.1.5 | 7.57 kB | MIT | prod | 1 2 |
micromatch | 4.0.5 | 14.09 kB | MIT | prod | |
normalize-path | 3.0.0 | 3.48 kB | MIT | prod | |
picocolors | 1.0.0 | 2.35 kB | ISC | prod | |
postcss-resolve-nested-selector | 0.1.1 | 1.88 kB | MIT | prod | 1 |
postcss-safe-parser | 6.0.0 | 2.54 kB | MIT | prod | |
postcss-selector-parser | 6.0.16 | 181.61 kB | MIT | prod peer | |
postcss-value-parser | 4.2.0 | 7.81 kB | MIT | prod | |
postcss | 8.4.38 | 193.21 kB | MIT | prod peer | |
resolve-from | 5.0.0 | 2.28 kB | MIT | prod | |
string-width | 4.2.3 | 2.33 kB | MIT | prod | |
strip-ansi | 6.0.1 | 1.99 kB | MIT | prod | |
style-search | 0.1.0 | 5.49 kB | ISC | prod | |
supports-hyperlinks | 3.0.0 | 3.21 kB | MIT | prod | |
svg-tags | 1.0.0 | 2.65 kB | MIT | prod | |
table | 6.8.2 | 326.88 kB | BSD-3-Clause | prod | |
write-file-atomic | 5.0.1 | 4.3 kB | ISC | prod |
Stylelint is a robust and customizable CSS linter that aids in the prevention of errors and enforcement of conventions in your stylesheets. With over 100 built-in rules for modern CSS syntax and features, Stylelint ensures your code is not only valid but also consistent and adheres to best practices. It even possesses the capability to fix problems automatically when possible. Extensible through plugins, Stylelint caters to bespoke requirements and supports languages like SCSS, Sass, Less, and SugarSS. With its emphasis on conventions, Stylelint can help disallow specific units, enforce naming patterns, set limits like the number of ID selectors, and specify notations for modern color functions.
To start using Stylelint, you'll need to first install it in your project. Use npm or yarn to add it as a development dependency:
// with npm
npm install stylelint --save-dev
// with yarn
yarn add stylelint --dev
Once installed, create a configuration file (.stylelintrc
) in your project root. This file will contain rules that Stylelint will enforce:
// .stylelintrc
{
"rules": {
"block-no-empty": true,
"color-no-invalid-hex": true,
// add more rules as per your requirement
}
}
You can lint your stylesheet files using the Stylelint command followed by the file or directory path:
// Lint a single file
npx stylelint "path/to/file.css"
// Lint an entire directory
npx stylelint "path/to/directory/*.css"
Stylelint can also be integrated with build systems like Gulp, Grunt, and webpack through respective plugins. Moreover, many popular text editors have Stylelint plugins that provide linting inside the editor itself.
The complete documentation for Stylelint can be found on their GitHub repository under the "docs" directory. The documentation is comprehensive, offering guidance on getting started, customizing, configuring, and detailed information about all the rules. There are also guides for ignoring code, using the CLI, and for the Node.js API. Overall, the docs serve as an in-depth resource for everything you need to know about Stylelint.