Replies: 2 comments 1 reply
-
I don't use any kind of auto formatter, I do it all by hand, that way it ends up just how I like it I do think it would be really cool to be able to lint the sql written though, so that is a bit along the lines of autoformatting and syntax highlighting it. Curious to see what you come up with, |
Beta Was this translation helpful? Give feedback.
-
No, by linter I meant something that checks for syntax errors :) We could look into using Postgres.js itself to connect to the database and use SQLFluff also looks nice - probably not a bad idea. |
Beta Was this translation helpful? Give feedback.
-
I'm currently using prettier to autoformat my js/ts files. This works quite nice when using a query builder. Unfortunately my code gets quite messy when using sql template literals. What are your workflows to format your literals? Is there some tool or prettier plugin available? I was only able to find prettier plugins for plain sql files.
I wish there was some plugin for prettier available which autoformats the literals like it formats objects (see here for an example). Also, there is this library available to autoformat SQL strings. I've just tested it and it works great.
If no-one knows of a good solution, I'd look into prettier plugins and see if I could implement it myself.
Beta Was this translation helpful? Give feedback.
All reactions