1

I'm using prettier & eslint on vs code and i would like to stop it from formatting my .env file on save.

It adds semi-colons to the end of every variable, which is obviously not good.

Adri
  • 127
  • 4
  • 10

3 Answers3

1

Under the project folder, create a subfolder .vscode, then touch a settings.json file under the subfolder, paste the following config into the setting.json. It would stop auto-formatting on env file.

{
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "[dotenv]": {
    "editor.formatOnSave": false
  }
}
Jerry
  • 329
  • 1
  • 4
  • 13
0

You'll have to configure ESlint and Prettier separately.

Check this answers for instructions on how to configure ESLint, and this one for instructions on how to force Prettier to ignore files.

Dorin Botan
  • 1,224
  • 8
  • 19
0

Add to a .prettierignore .env*. That did the trick for me.

697
  • 321
  • 4
  • 16