DEV Community

Raffaele Pizzari for Studio M - Song

Posted on • Updated on

ESLint not working in VS CODE?

(check out my blog)

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
    }
]
Enter fullscreen mode Exit fullscreen mode

Restart VSCode and enjoy.

Sincerely yours,
You.

Top comments (17)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

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"
    ]
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
Collapse
 
dutradotdev profile image
lucas

this helped me too, tks!

Collapse
 
dmudro profile image
David Mudro

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.

Collapse
 
frankapiyo profile image
Frankline Apiyo

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.

Collapse
 
frankapiyo profile image
Frankline Apiyo

nice post though.

Collapse
 
dutradotdev profile image
lucas

tks a lot man, saved my life

Collapse
 
crenshaw_dev profile image
Michael Crenshaw

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

Collapse
 
dpagey profile image
Pagey • Edited

Life saver! 🧑

Collapse
 
luisreyes98 profile image
Luis Reyes

Thank you so so much

Collapse
 
johndavidbell profile image
JD Bell

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

Collapse
 
vadikenaladiken profile image
Vadikenaladiken

Nice hint bro! Saved my life!

Collapse
 
kasiriveni profile image
Srinivas Kasiriveni

Nice tip

Collapse
 
stevemu profile image
Qi Mu

Thank you! This is so helpful!

Collapse
 
miteshp030 profile image
Mitesh • Edited

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

Collapse
 
pierrecordier profile image
Pierre Cordier

Alt text of image

Collapse
 
jjoselv profile image
Juanjo Lopez

Holly s*** it worked...
github.com/mdx-js/eslint-mdx/issue...

Collapse
 
amitkum66494760 profile image
Amit Yadav

thanks man