How to Setup VS Code + Prettier + ESLint

preview_player
Показать описание
A quick video on how I solved my config issues with VS Code, ESLint and Prettier
Рекомендации по теме
Комментарии
Автор

still saving frustrated by prettier lives in 2020 on the verge of 2021! thank You!

shollymore
Автор

What is 'prettier' and 'prettier/react'? Are these VSCode extensions? Some dev dependencies that need to be installed? There are many extensions called 'prettier' .. and 'beautifier' to add to the confusion. Thanks!

michaelconnor
Автор

How are you able to even open these files? I'm only able to open the settings.json file, which doesn't look anything like what I see in your video.

SansPur
Автор

Thanks for this video! It didn't work on a fresh install. As of today (July 2020), it seems you have to add:
```
"editor.codeActionsOnSave": {
"source.fixAll": true
}
```
in your configuration as well.

JonathanPetitcolas
Автор

I'm so confused. Don't we have to install *ESLint* via *npm* too for live code formatting/debugging to work ?

MrSushant
Автор

several hours before this video I was searching exactly for this. Wes is cool indeed.

monolizm
Автор

This still works today. Between your video and some of the comments that show a simpler way, this is a great resource. Thanks to you and some in the comments

UrbanBDKNY
Автор

I dont understand how to configure prettier for styles (do I need have stylelintrc for that)? Can you provide all configs include package.json with necessary plugins? Thanks

bibblebabl
Автор

Hi, how can one access the .eslintrc file directly from VSCode? I would like to add prettier to the "extends" array in the file. Thank you in advance.

piriyakantong
Автор

I'm confused about the prettier/prettier rules section if my eslintrc file is a JS file (.elsintrc.js) that exports modules - like this:

module.exports = {
env: {
browser: true,
node: true,
es6: true,
},
extends: ['airbnb', 'prettier', prettier / react],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
},
rules: {},
"prettier/prettier": [
{
"doubleQuotes": true
}
],
scripts: { "eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check" },
plugins: [
"prettier"
],
};

Things do not seem to work :(

dazecm
Автор

I have a doubt. Why are we doing this in user.settings.json,


“[javascript]”: {
“editor.formatOnSave”: false,
},
“prettier.disableLanguages”: [
“js”
]


Why to disable format on save for JS files? Wouldn’t it be tiresome to manually format every time?

regiwiz
Автор

Helpful as always. More of these please <3

infiniteeyelashes
Автор

Thanks Wes. This will probably help me with a few issues I'm having with my VSCode configuration.

DW-lrmn
Автор

Awesome!! short but great thing you talk about but where is the config file??

spasmdesign
Автор

Which operating system have you installed VS Code? is it MAC? or any Linux distro?

UCBCteam
Автор

This was really helpful, thanks! I had the Prettier's VSCode extensions and other wrong settings in my user config. Now it formats as it should! 🎉
legend! :)

gianpaj
Автор

Hey Wes, thanx for your video. Could you tell me please, which plugin do you use to achieve cursive font when you comment in vscode?

ruslanogarkov
Автор

I did exactly what he said but mine isn't fixing or formatting on save. I did also set auto to Settings -> Communly used -> Files: Auto save to OFF as I read online that should help, but unfortunately not.

MikeBertelsenDK
Автор

So, how did you setup ESlint and prettier? I'm sure your setup fixes everything but how do you actually set it up? I downloaded the eslint extention and... I'm stuck! What now (forgive me, I I'm rather new to all this and may just be stupid). What is that eslintrc-file and where is it? Do you create that yourself, and if so, where do you place the file? Could you please maybe do a little more thorough video? Keep up the good work and thanks for a useful channel :)

nielslytzdk
Автор

Video was about how to set up eslint. Why you are showing the things after set up.

souravpanda