coc-svelte icon indicating copy to clipboard operation
coc-svelte copied to clipboard

What's the trick to getting eslint to work with svelte files?

Open groovy9 opened this issue 4 years ago • 3 comments

I have coc intellisense working fine in svelte files, and coc eslint working fine in .js files, but no eslint in svelte files. Is this known to work? If so, what configuration is necessary?

I have no coc-specific stuff in my init.vim other than loading the coc plugin and having :CocInstall'd coc-svelte, coc-eslint and coc-tserver. I'm loading evanleck/vim-svelte and setting filetype to svelte. Here's my eslintrc.json:

{ "env": { "browser": true, "es6": true }, "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 2019, "sourceType": "module" }, "plugins": ["svelte3"], "extends": ["eslint:recommended"], "overrides": [ { "files": ["**/*.svelte"], "processor": "svelte3/svelte3" } ], "rules": { "indent": ["error", 2], "semi": ["error", "never"], "quotes": ["error", "single"] } }

groovy9 avatar Jul 05 '20 03:07 groovy9

There is no eslint support by this extension.

iamcco avatar Jul 05 '20 03:07 iamcco

This is old, but @groovy9 maybe this will help:

I have the following in coc-settings.json:

  "eslint.filetypes": ["javascript", "typescript", "svelte"],
  "coc.preferences.formatOnSaveFiletypes": [
    "javascript",
    "typescript",
    "typescriptreact",
    "json",
    "javascriptreact",
    "typescript.tsx",
    "graphql",
    "svelte"
  ]

Eslint works fine for me in .svelte files.

Jayphen avatar Aug 18 '20 17:08 Jayphen

At the time of writing, I am using the following coc-settings.json to get ESLint to work:

{
	"eslint.probe": [
		"javascript",
		"javascriptreact",
		"typescript",
		"typescriptreact",
		"html",
		"vue",
		"markdown",
		"svelte"
	],
	"eslint.options": {
		"ignorePath": ".gitignore"
	},
	"eslint.lintTask.options": ["--ignore-path", ".gitignore", "."],
	"eslint.validate": ["svelte"]
}

The most important item is eslint.validate. You probably also want eslint.validate.

Gelio avatar Mar 28 '21 13:03 Gelio