Standard Stylelint Config for Vue

1.0.0 · active · verified Sun Apr 19

stylelint-config-standard-vue is a shareable Stylelint configuration tailored for Vue.js projects. Its current stable version is 1.0.0, released in January 2022. As a configuration package, its release cadence is typically tied to updates in Stylelint and its foundational configurations like `stylelint-config-standard` and `stylelint-config-recommended-vue`. This config stands out by combining general CSS best practices with specific adjustments for Vue Single File Components (SFCs), including support for SCSS stylesheets within Vue components. It ensures consistent styling by extending a robust set of rules and requires Stylelint v14 or newer for compatibility, as older versions do not handle non-CSS syntaxes like HTML/Vue natively.

Common errors

Warnings

Install

Imports

Quickstart

Installs the necessary packages, configures Stylelint to use the standard Vue rules, and sets up VS Code for proper linting of `.vue` files.

npm install --save-dev stylelint postcss-html stylelint-config-standard-vue

// .stylelintrc.json
{
  "extends": "stylelint-config-standard-vue",
  "overrides": [
    {
      "files": ["*.vue", "**/*.vue"],
      "rules": {
        // Example: override a rule for Vue files
        "indentation": 2
      }
    }
  ]
}

// .vscode/settings.json (for VS Code integration)
{
  "stylelint.validate": [
    "css",
    "scss",
    "less",
    "postcss",
    "vue" // Add 'vue' language to enable linting in .vue files
  ],
  "css.validate": false, // Optional: disable built-in CSS validation to avoid conflicts
  "scss.validate": false
}

view raw JSON →