Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
stylelint
Advanced tools
Stylelint is a powerful, modern linter that helps you avoid errors and enforce consistent conventions in your stylesheets. It is configurable and supports the latest CSS syntax as well as CSS-like syntaxes, such as SCSS.
Linting CSS files
This command will lint all CSS files in the 'src' directory and its subdirectories. It will check for errors and code quality issues based on the rules defined in the configuration.
"stylelint 'src/**/*.css'"
Fixing CSS files
This command will not only lint the CSS files but also attempt to fix any fixable issues, such as formatting inconsistencies, automatically.
"stylelint 'src/**/*.css' --fix"
Custom configuration
This JSON represents a custom Stylelint configuration object where specific rules are defined, such as disallowing invalid hex colors, setting indentation preferences, and enforcing no leading zero for numbers.
{ "rules": { "color-no-invalid-hex": true, "indentation": [2, { "except": ["block"] }], "number-leading-zero": "never" } }
Extending configurations
This JSON represents a Stylelint configuration that extends a shared configuration, in this case, 'stylelint-config-standard', which is a popular set of rules that enforce common stylistic conventions.
{ "extends": "stylelint-config-standard" }
Using plugins
This JSON represents a Stylelint configuration that includes a plugin, 'stylelint-scss', which adds SCSS-specific linting rules to Stylelint. The configuration then enables a rule from that plugin to disallow unknown at-rules in SCSS.
{ "plugins": ["stylelint-scss"], "rules": { "scss/at-rule-no-unknown": true } }
ESLint is a static code analysis tool for identifying problematic patterns in JavaScript code. It is similar to Stylelint in its extensibility and plugin ecosystem but is focused on JavaScript rather than stylesheets.
Prettier is an opinionated code formatter that supports many languages, including CSS. Unlike Stylelint, which can both lint and fix code, Prettier is solely focused on code formatting and does not provide linting functionalities.
Sass-lint is a node-only Sass linter for both sass and scss syntax. It is similar to Stylelint when working with SCSS files but does not support plain CSS or other CSS-like syntaxes.
CSSLint is a tool that helps to point out problems with your CSS code. It is less configurable than Stylelint and has a smaller set of rules and plugins, but it serves a similar purpose in linting CSS files.
A mighty, modern CSS linter that helps you enforce consistent conventions and avoid errors in your stylesheets.
With stylelint, it's easy to start linting your CSS:
stylelint-config-standard
. It includes over 80 of stylelint's rules with sensible defaults. (You can always override specific rules after extending the config.) We update the config with each new release of stylelint. Alternately, you can search for a community config and extend that instead.null
) the rules that you don't care to enforce.You'll find more detailed information on using stylelint and tailoring it to your needs in our guides:
If you're looking for help or have a support question, then check out our FAQ first. If the answer to your problem isn't there, then go to stackoverflow. stackoverflow is a huge Question and Answer community, and tagging your post there with "stylelint" will catch the stylelint team's attention.
If you think you've found a bug or if you have feature request, then create a new GitHub issue. Be sure to follow the issue template, answering each question, as this helps us greatly in understanding your problem or request.
Upgrading? Please read our CHANGELOG to learn what changes to expect in the latest version, whether that's new features, bug fixes, renamed rules, or whatever else.
There is always a lot of work to do, and already well over 150 rules to maintain. So please help out in any way that you can:
7.8.0
block-no-single-line
. Use block-opening-brace-newline-after
and block-closing-brace-newline-before
rules with the option "always"
instead.declaration-block-properties-order
. Use the stylelint-order
plugin pack instead.rule-nested-empty-line-before
and rule-non-nested-empty-line-before
. Use the new rule-empty-line-before
rule instead.time-no-imperceptible
. Use the new time-min-milliseconds
rule with 100
as its primary option.media-feature-no-missing-punctuation
.selector-no-empty
.no-browser-hacks
no-indistinguishable-colors
no-unsupported-browser-features
custom-property-no-outside-root
root-no-standard-properties
selector-root-no-composition
.stylelint-disable-reason
could not enforce providing a reason.declaration-block-no-ignored-properties
could not reliably account for replaced elements."all-nested"
option for at-rule-empty-line-before
. Use the "inside-block"
option instead."blockless-group"
option for at-rule-empty-line-before
. Use the "blockless-after-blockless"
option instead."between-comments"
option for comment-empty-line-before
. Use the "after-comment"
option instead."at-rules-without-declaration-blocks"
option for max-nesting-depth
. Use the "blockless-at-rules"
option instead.time-min-milliseconds
rule, to replace time-no-imperceptible
(#2289).except: ["after-same-name"]
option to at-rule-empty-line-before
(#2225).configOverrides
now work with extends
(#2295).max-line-length
no longer reports incorrect column positions for lines with url()
or import
(#2287).selector-pseudo-class-no-unknown
no longer warns for proprietary webkit pseudo-classes (#2264).unit-no-unknown
accepts fr
units (#2308).FAQs
A mighty CSS linter that helps you avoid errors and enforce conventions.
The npm package stylelint receives a total of 3,849,733 weekly downloads. As such, stylelint popularity was classified as popular.
We found that stylelint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.