tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

Enable ESLint for .svelte files #24

Closed adrianmroz closed 4 years ago

adrianmroz commented 5 years ago

As I understand, right now in WebStorm you can run eslint only against files with extensions associated with JavaScript. Svelte plugin has separate file type.

If that's the case, it would be nice if we could get option to run eslint against .svelte files. Right now I managed run eslint from command line with https://github.com/sveltejs/eslint-plugin-svelte3 and works great.

tomblachut commented 5 years ago

Yeah I need to get to it. Thanks for reporting!

shirotech commented 4 years ago

I thought this used to be a deal-breaker without having eslint support. But if you add a watcher in settings to automatically run eslint (autofix) every time the file is saved, this becomes less of a problem for now until eslint is properly supported.

tomblachut commented 4 years ago

@shirotech Nice! Personally I run linting during committing and pushing, using a combination of husky and lint-staged.

shirotech commented 4 years ago

@shirotech Nice! Personally I run linting during committing and pushing, using a combination of husky and lint-staged.

Yeah and that too, but also the main advantage of the built-in File Watchers is it allows the IDE to sync the file that was changed. I couldn't find a way to do that with tools running outside of the IDE.

tomblachut commented 4 years ago

@anstarovoyt I wonder if you could take a look at that issue? Last time I've checked (a year ago), there were some file extensions hardcoded into the builtin ESLint code - e.g. .vue - and I didn't notice a way to extend that

anstarovoyt commented 4 years ago

@tomblachut yes, I will try to implement this

tomblachut commented 4 years ago

@anstarovoyt great, thanks

anstarovoyt commented 4 years ago

@adrianmroz

so. Actually you can enable the ESLint integration in the IDE by changing the key in the Registry:

Help - Find Action - Registry

Key:

eslint.additional.file.extensions

Value

svelte

I am searching a better way to do it programmatically but it should work

Screenshot 2020-08-06 at 19 40 56