Code Linting

Install Master CSS ESLint in Svelte

Guide to installing Master CSS ESLint in your Svelte project.

Installation

Install the plugin and parser into your project via package managers.

npm install -D @master/eslint-config-css@rc eslint-plugin-svelte eslint

Set up your config

Create .eslintrc.json if you don't have one.

  • Add @master/css to the extends section.
  • Add plugin:svelte/recommended to the extends section.
{
"extends": [
"@master/css",
"plugin:svelte/recommended"
]
}

Add VS Code settings

Add the eslint.validate option of the extension to validate .svelte files because the extension targets only *.js or *.jsx files by default.

Check out the Visual Studio Code guide if you haven't installed the ESLint extension yet.

{
"eslint.validate": [
"javascript",
"javascriptreact",
"svelte"
]
}

Start linting your code

npx eslint *.svelte
© Aoyue Design LLC.