Home > Mobile >  VS Code: How do I stop Prettier from adding a new line at the end of my JS file?
VS Code: How do I stop Prettier from adding a new line at the end of my JS file?

Time:01-26

I installed Prettier and changed the settings to format on save. I ran Firebase deploy and now I'm getting an error:

172:6 error Newline not allowed at end of file eol-last

I see that when I format on save, it's adding a new line at the end. How do I force Prettier to not do this?

CodePudding user response:

You can configure the Prettier extension to not add a new line at the end of file by setting the "insertFinalNewLine" option to "false" in your prettier configuration file. Like this:

  {
    "insertFinalNewLine": "false"
  }

Or you can set "proseWrap" to "never" to disable automatic line-wrapping and to not add newline at the end of file. Like this:

{
 "proseWrap": "never"
}

Hope this helps.

CodePudding user response:

 "eol-last": 0,
 "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],

  • Related