Closed frederikhors closed 5 years ago
Do you have a minimal reproduction of this somewhere that can be cloned?
Have you tried running ESLint from the command line? That is - Is this an ESLint issue or an editor configuration and integration issue?
Reproduction project: https://github.com/frederikhors/svelte3-vscode-eslint
I'm using extension https://github.com/UnwrittenFun/svelte-vscode in VS Code.
Using this in command line: npx eslint --fix .\src\*
works good, it changes App.svelte
and main.js
as I want: following standard.js
rules.
VS Code doesn't follow standard.js
rules on format command (on saving also).
If running eslint
from the command line is working, there's nothing wrong with this plugin, and the issue is somewhere in your editor config.
Are you using a vscode extension that adds Svelte syntax highlighting to *.svelte
files? If so, you need to instruct the ESLint extension to lint "language": "svelte"
instead of "language": "html"
. I recently updated the INTEGRATIONS.md doc about this.
@Conduitry thanks a lot for your answer.
Unfortunately it doesn't work. I'm following INTEGRATIONS.ms config but VSCode doesn't format my code using .eslintrc.js
with and without Prettier
extension.
I tried very hard.
I think I'm very tired now, I think I'll wait for you or some good soul on this road (reproduction project: https://github.com/frederikhors/svelte3-vscode-eslint).
This is going to depend on your own vscode settings, so what you checked in isn't going to be enough to reproduce this. You haven't shown me the relevant parts of your user-level vscode settings.json file.
I'm personally getting red squiggles from eslint in vscode. Are you not getting these?
I don't think the dbaeumer.vscode-eslint
extension provides a 'formatter' for ESLint to use like the Prettier extension does. In any case, in the only formatter I see configured in your project-specific configuration file is for Prettier.
The ESLint extension has its own eslint.autoFixOnSave
setting, and if I enable this in your project, I do get .js and .svelte files to format (using eslint) on save.
You haven't shown me the relevant parts of your user-level vscode settings.json file.
Is empty.
The ESLint extension has its own eslint.autoFixOnSave setting, and if I enable this in your project, I do get .js and .svelte files to format (using eslint) on save.
Now it works for me. But two problems:
Format document
it change all the file to NON-standard.js default and then if I save obviously back to standard.js using .eslintrc.js
; this behaviour because in settings.json
I need to disable "svelte.plugin.svelte.format.enable": false
Fixed everything. Thanks @Conduitry!
I have
(which comes from https://github.com/standard/eslint-config-standard#usage) in my
.eslintrc.js
and I'm wondering why this doesn't work in<script></script>
part of my.svelte
files.What rules is this plugin following?
I' using https://github.com/UnwrittenFun/svelte-vscode. Can I have
standard.js
style in my js code?