loading...
SinnerSchrader Engineers

ESLint not working in VS CODE?

pixari profile image Raffaele Pizzari Updated on ・1 min read

Hi Raffaele,

this a note from your old self.

I know that ESLint is not working in VS Code.
You have already installed all the plugins, probably reinstalled VSCode, checked your VSCode Settings and double-checked your .eslintrc several times and perhaps you are sitting in a corner thinking about quitting your job.

I know how you feel, you have already been there but you won't die on this hill.

Just open VSCode Settings (./vscode/settings.json) and add this:

"eslint.validate":[  
    {  
        "language":"vue",
        "autoFix":true
    },
    {  
        "language":"html",
        "autoFix":true
    },
    {  
        "language":"javascript",
        "autoFix":true
    },
    {  
        "language":"typescript",
        "autoFix":true
    }
]

Restart VSCode and enjoy.

Sincerely yours,
You.

Posted on by:

pixari profile

Raffaele Pizzari

@pixari

Front-End Developer based in Munich, Germany.

SinnerSchrader Engineers

We believe two heads are always better than one and a whole team of heads is even better. That’s how we work. With no alpha leaders and no beta teams! Thoughts are our own.

Discussion

pic
Editor guide
 

I got this warning, Auto Fix is enabled by default. Use the single string form.

So, I changed it to,

"eslint.validate": [
        "vue",
        "html",
        "javascript",
        "typescript",
        "javascriptreact",
        "typescriptreact"
    ]

However, according to github.com/Microsoft/vscode-eslint..., mixed form or autofix: false should work as well.

Also, my .eslintignore, for extra fun!

!**/.eslintrc*
node_modules*
dist
*.svg
*.ico
*.json
.gitignore
*.md
*.log
*.lock
 

this helped me too, tks!

 

Nice one, this hint is going the right direction.

I'd just add check your user settings.json before blindly sticking the same eslint.validate JSON config in each workspace individually.

 
 

The Dollyrots' "Because I'm Awesome" was definitely inspired by you. Thanks.

 

Thank you so so much

 

Can we chat more with ttelegram?
@blackhorse518

 

Nice hint bro! Saved my life!

 

Thank you! This is so helpful!

 

I am getting End of file expected. error on pasting below in settings.json

"eslint.validate":[

{

"language":"vue",
"autoFix":true
},
{

"language":"html",
"autoFix":true
},
{

"language":"javascript",
"autoFix":true
},
{

"language":"typescript",
"autoFix":true
}
]

 

should the settings be added to ./vscode/settings.json or .vscode/settings.json? is it possible that this is an error in your post because it only worked for me with the latter.

 
 

Life saver! 🧡

 

Future not to me: install the ESLint plugin too. :-)

 
 

Thanks. this helped me!

 

tks a lot man, saved my life