'Why does my prettier show red color upon saving

enter image description here

So basically I installed prettier in VS Code and enabled the format on paste option in the settings and now I have no clue why these red bars are there in my code..

Thanks



Solution 1:[1]

This just means you have an indentation problem with the prettier config. I think by default prettier expects 2 space indentation. You may want to get into your settings: with command , on MacOS ( not sure the command on other OSs). then search for prettier space and you should see something like this. You can play with the value under the 1 TabWith.

this image

Solution 2:[2]

This problem can be solved by simply re-adjusting the default vscode Tab size configuration. Pressing cmd , (opens User Setting) and then type Tab Size. Set that Tab Size to 2.

This is happening because your default setting is set to 1 Tab = 4 spaces and your prettier is formatting it with 2 spaces.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Claeusdev
Solution 2 Abhijit Misra