coc-extensions / coc-svelte

svelte support for (Neo)Vim
MIT License
179 stars 24 forks source link

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

Open groovy9 opened 4 years ago

groovy9 commented 4 years ago

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"] } }

iamcco commented 4 years ago

There is no eslint support by this extension.

Jayphen commented 4 years ago

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.

Gelio commented 3 years ago

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.