Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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.
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.
With stylelint, it's easy to start linting your CSS:
.stylelintrc
file) by either crafting your own config or extending a pre-written, shared config.
stylelint-config-standard
, which includes over 80 of stylelint's rules with sensible defaults. (You can always override specific rules after extending a config.)Be sure to specify the syntax if you're using non-standard syntax (e.g. SCSS, SugarSS or Less).
You'll find more detailed information on using stylelint and tailoring it to your needs in our guides:
There is always a lot of work to do, and already well over 100 rules to maintain. So please help out in any way that you can:
We communicate via issues and pull requests.
There is also stackoverflow, which is our preferred QA forum. Tag your post with "stylelint".
6.5.1
"emptyLineBefore"
option for declaration-block-properties-order
. If you use this option, please consider creating a plugin for the community."single-where-required"
, "single-where-recommended"
, "single-unless-keyword"
, "double-where-required"
, "double-where-recommended"
and "double-unless-keyword"
options for font-family-name-quotes
. Instead, use the "always-unless-keyword"
, always-where-recommended
or always-where-required
options together with the string-quotes
rule."single"
, "double"
and "none"
options for function-url-quotes
. Instead, use the "always"
or "never"
options together with the string-quotes
rule."hierarchicalSelectors"
option for indentation
. If you use this option, please consider creating a plugin for the community.selector-list-comma-*
rules now ignore Less mixins.selector-max-compound-selectors
no longer errors on Less mixins.selector-type-no-unknown
now ignores all An+B notation and linguistic pseudo-classes.selector-type-no-unknown
now ignores obsolete HTML tags and <hgroup>
.FAQs
A mighty CSS linter that helps you avoid errors and enforce conventions.
The npm package stylelint receives a total of 2,831,923 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.