[Fixed] Is there a config in prettier to keep line breaks?

Issue

have a problem with prettier extension in VS Code,
When I write this:

const result = await pool
      .request()
      .query('select NumberPlate, ID, TimeStamp from RESULTS order by ID');

and save the file, it turns into a single line like this:

const result = await pool.request().query('select NumberPlate, ID, TimeStamp from RESULTS order by ID');

with the following config in prettier:

{
    "git.confirmSync": false,
    "editor.minimap.enabled": false,
    "window.zoomLevel": 0,
    "liveServer.settings.donotShowInfoMsg": true,
    "workbench.startupEditor": "newUntitledFile",
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "editor.formatOnSave": true,
    "prettier.printWidth": 200,
    "prettier.singleQuote": true,
    "prettier.arrowParens": "always",
    "editor.tabSize": 2,
    "editor.tabCompletion": "on"
}

Is there a way to avoid this from happening?

Thanks!

Solution

If you open VSC and go into settings then Extentions and click on “prettier” there’s a check box ticked under Prettier: ‘Require Config’. If that’s unchecked it will break your lines automatically
enter image description here

Leave a Reply

(*) Required, Your email will not be published