How to solve "semi-colon expected" warnings (css-semicolonexpected) How to solve "semi-colon expected" warnings (css-semicolonexpected) vue.js vue.js

How to solve "semi-colon expected" warnings (css-semicolonexpected)


There is no built-in way to solve this within VS Code. The recommended way to solve this is by making use of the Stylelint extension to handle your CSS linting (& SCSS and/or Less, etc.). It's very powerful and likely will improve your stylesheets beyond removing these errors for you.

  1. You need to add the styleint dependencies to your project. Run:
npm install --save-dev stylelint stylelint-config-standardyarn add -D stylelint stylelint-config-standard
  1. Create a stylelint.config.js in the root of your project. (same location where your package.json is stored)

Place this snippet into it:

module.exports = {  extends: ["stylelint-config-standard"],  rules: {    "at-rule-no-unknown": [      true,      {        ignoreAtRules: [          "tailwind",          "apply",          "variants",          "responsive",          "screen",        ],      },    ],    "declaration-block-trailing-semicolon": null,    "no-descending-specificity": null,  },};
  1. Install these extensions to your VS Code setup:
  1. Last but not least, adjust your local or global VS Code settings.json file to include:
"css.validate": false,"less.validate": false,"scss.validate": false,

This way you will have the native linting "disabled", but are still ensuring it is linted using the Tailwind IntelliSense plugin.


Disable Vetur's style validation

Such CSS warnings may originate from the Vetur extension, which may very well be the case if the warning's icon (as seen in VSCode's "Problems" pane) is a Vue logo.

By disabling Vetur's style validation, you may lose other benefits. Although, in the long-run, it's probably better to rely on a more full-featured validator/linter than this extension.

  1. Go to the Vetur extension settings and uncheck the option for style validation.

--- or ---

  1. Set the option per-project, in a .vscode/settings.json file in the project root, with the following:

    "vetur.validation.style": false


Vetur warnings look something like:

vetur is the guilty one here


I found another solution Usage of Tailwind with nuxt lead to weird @apply issue #300

Just add lang="postcss" to style tag and with this fix, I haven't any error.

<style lang="postcss" scoped>  .title {      @apply text-purple-600 font-bold;  }</style>