sveltejs / eslint-plugin-svelte3

An ESLint plugin for Svelte v3 components.
MIT License
373 stars 43 forks source link

Unwanted semicolons are added #52

Closed lud closed 4 years ago

lud commented 4 years ago

Hi,

The plugin seem to work fine for me, except from the command line where it chokes on html tags (unexpected '<').

Although, i have this rule to discard all semicolons:

    'semi': [ 'error', 'never' ],

and it works fine for .js files, but has the opposite effect on .svelte files: semicolons are added if not present.

Is it expected behaviour or a bug ?

TehShrike commented 4 years ago

I'm currently using eslint-plugin-svelte3 with "semi": ["warn", "never"] and semicolons are removed from .svelte files when I run eslint with --fix

Conduitry commented 4 years ago

It sounds like it would be a bug, but it's not one I can reproduce either. Do you have a small repo that can be cloned and demonstrate this?

lud commented 4 years ago

Hello,

Thanks, I'll try to provide a shrinked version of my repository. In the meantime I found that the following block was commented out:

  overrides: [
    {
      "files": ["*.svelte"],
      "processor": "svelte3/svelte3"
    }
  ],

But I cannot enable it back as eslint fails with "unexpected top-level property overrides[0].processor".

Conduitry commented 4 years ago

If that's commented out, the plugin's probably not running at all. As of version 2.0.0, this plugin requires ESLint 6, which provides a different interface for linter plugins than 5. Are you still using ESLint 5?

lud commented 4 years ago

I did some tests.

With eslint 6 installed locally and ran from the command line, it works as expected with svelte files. So the problem may be in the vscode eslint plugin only. I use .svelte for extensions so I did not follow the INTEGRATIONS.md guide.

Conduitry commented 4 years ago

👍 See #50 for discussion on how we can make it clearer in the docs what you need to do to set up things in vscode.