Replies: 1 comment
|
For the auto-formatting side, the current maintained combo is
{
"plugins": [
"prettier-plugin-embed",
"prettier-plugin-sql"
],
"embeddedSqlTags": ["sql"],
"language": "postgresql",
"keywordCase": "upper"
}Before / after on a // before
const rows = await sql`select u.id,u.email,count(o.id) as orders from users u left join orders o on o.user_id=u.id where u.created_at>${cutoff} group by u.id order by orders desc limit ${limit}`;
// after
const rows = await sql`
SELECT u.id, u.email, count(o.id) AS orders
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > ${cutoff}
GROUP BY u.id
ORDER BY orders DESC
LIMIT ${limit}
`;Placeholders ( Editor integration For VS Code syntax highlighting on the string itself, install Skip Pre-commit lint (optional) If you also want lint, not just formatting: // package.json
"lint-staged": {
"*.{ts,tsx}": [
"prettier --write",
"sqlfluff lint --dialect postgres --templater raw"
]
}Scope |
Uh oh!
There was an error while loading. Please reload this page.
I've been doing it by hand, but just wanted to know if there was an automated solution.
https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html
seems to change syntax highlighting (which doesn't help me much personally)
but is sadly an archived project
anyone using anything else?
All reactions