English | 简体中文
A Visual Studio Code extension to lint CSS/SCSS/Less with Stylelint.
Ships with Stylelint v15 built-in — install the extension and start linting immediately, no extra setup required.
"stylelint.useLocal": true.Tip: To avoid duplicate diagnostics from VS Code's built-in CSS/SCSS/Less validators, disable them:
"css.validate": false, "less.validate": false, "scss.validate": false
The extension bundles Stylelint v15.11.0, so it works immediately after installation — no need to install Stylelint separately or create a config file. Without a config file, the extension still performs CSS syntax validation to catch basic syntax errors.
Enable stylelint.autoFixOnSave to automatically fix all auto-fixable problems whenever you save a file. This uses the native onWillSaveWaitUntil mechanism, so fixes are applied before the file is written to disk — no need to configure editor.codeActionsOnSave.
{
"stylelint.autoFixOnSave": true
}
Hover over any Stylelint diagnostic and click the light bulb icon, or press Ctrl+. (Cmd+. on Mac):
/* stylelint-disable-next-line */ or /* stylelint-disable-line */ comment to suppress the diagnosticYou can also fix all auto-fixable problems at once using the Stylelint: Fix all auto-fixable problems command from the Command Palette.
Control when linting runs via the stylelint.run setting:
| Mode | Behavior |
|---|---|
"onType" (default) |
Validates as you type, with a 150ms debounce |
"onSave" |
Validates only when the file is saved |
"manual" |
Validates only when you run Stylelint: Validate current file |
Lint all style files across the entire workspace at once:
Ctrl+Shift+P / Cmd+Shift+P)Stylelint: Lint entire workspaceScans files with these extensions: .css, .scss, .less, .sass, .sss, .vue, .svelte, .html, .xml, .xsl, .md, .markdown.
Automatically skips node_modules, .git, dist, build, coverage, .next, .nuxt directories. Files larger than 5MB are skipped.
The extension shows a Language Status item next to the language indicator in the status bar. Click the language name (e.g., "CSS", "SCSS") to see it:
Stylelint+ — bundled v15.11.0 — Using the extension's bundled versionStylelint+ — local v17.0.0 — Using your project's local versionStylelint+ — ⚠ Local not found, using bundled v15.11.0 — Local Stylelint not found, fell back to bundledStylelint+ — Ready — Shown before the first validation completesThe extension supports Stylelint v14, v15, v16, and v17 with automatic version detection.
Bundled version (default):
stylelint.useLocal is false (default)Local version (user-installed):
"stylelint.useLocal": true to use your project's Stylelintimport())Stylelint v17 requires Node.js >= 20.19.0 and uses ESM exclusively.
Upgrade Node.js:
nvm install 20
nvm use 20
Install Stylelint v17 locally:
npm install stylelint@^17 --save-dev
Enable local version:
{
"stylelint.useLocal": true
}
Reload VS Code
The extension activates for the following 21 language identifiers:
css)html)javascript)javascriptreact)less)markdown)source.markdown.math)postcss)sass)scss)source.css.styled)styled-css)sugarss)svelte)typescript)typescriptreact)vue, vue-html, vue-postcss)xml)xsl)All commands are available from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description |
|---|---|
Stylelint: Fix all auto-fixable problems |
Fix all auto-fixable issues in the current file |
Stylelint: Validate current file |
Manually trigger validation (useful in manual mode) |
Stylelint: Lint entire workspace |
Lint all style files in the workspace |
Stylelint: Retry local search |
Re-scan for local Stylelint installation (clears cache) |
Stylelint: Show output channel |
Open the Stylelint+ output panel for debugging |
All settings are under the stylelint. prefix. Though it's recommended to use a Stylelint configuration file in your workspace, the following VS Code settings are also available.
Type: boolean · Default: true
Control whether this extension is enabled or not.
Type: boolean · Default: false
Automatically fix all auto-fixable Stylelint issues when saving a file. Fixes are applied before the file is written to disk via onWillSaveWaitUntil.
Type: "onType" | "onSave" | "manual" · Default: "onType"
Controls when Stylelint validation is triggered. See Validation Trigger Modes for details.
Type: boolean · Default: false
Use the locally installed version of Stylelint from your project's node_modules instead of the bundled version. The extension searches upward from the current file's directory for node_modules/stylelint. If not found, it falls back to the bundled version.
Type: Object · Default: null
Set the Stylelint config option. When this is set, Stylelint will not load configuration files (.stylelintrc, stylelint.config.js, etc.).
{
"stylelint.config": {
"rules": {
"color-no-invalid-hex": true,
"block-no-empty": true
}
}
}
Type: string · Default: ""
Path to a Stylelint configuration file. Relative paths are resolved from the workspace root. When set, this takes precedence over stylelint.config.
{
"stylelint.configFile": ".config/stylelint.config.js"
}
Type: string · Default: ""
Path to a .stylelintignore file. Relative paths are resolved from the workspace root. When empty, the extension auto-discovers .stylelintignore by walking up from the document's directory.
Type: boolean · Default: true
Whether to skip validation for files inside node_modules directories.
Type: boolean · Default: true
Whether to suppress error message popups. When enabled, errors are logged to the output channel but don't show as VS Code notifications.
Type: Array · Default: []
Override the severity of specific Stylelint rules in VS Code diagnostics, without modifying your Stylelint config. Use "off" to suppress a rule entirely.
Each entry has:
rule — The Stylelint rule nameseverity — One of "error", "warning", "information", "hint", or "off"{
"stylelint.rules.customizations": [
{ "rule": "color-named", "severity": "hint" },
{ "rule": "block-no-empty", "severity": "off" }
]
}
Type: Object · Default: { "location": "separateLine" }
Controls where the "Disable rule" code action inserts the stylelint-disable comment.
"separateLine" (default) — Inserts /* stylelint-disable-next-line <rule> */ on the line above"sameLine" — Appends /* stylelint-disable-line <rule> */ at the end of the same line{
"stylelint.codeAction.disableRuleComment": {
"location": "sameLine"
}
}
MIT License © 2019 – 2026 Hex