SQLFluff #33771
Replies: 3 comments
|
Hey, thanks for opening! |
I know it's not needed, it will just be a nice to have. I know supabase mentions some formatting recommendations in the docs. Having the ability to auto-format to follow these would just be convenient. |
|
Great suggestion, and SQLFluff is genuinely one of the better SQL linting and formatting tools available right now, especially with its VSCode extension and dialect-aware rules. A Supabase-recommended A starting point for a Supabase-flavored config targeting PostgreSQL might look like this: [sqlfluff]
dialect = postgres
templater = raw
max_line_length = 120
exclude_rules = RF02
[sqlfluff:indentation]
indent_unit = space
tab_space_size = 4
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper
[sqlfluff:rules:capitalisation.identifiers]
capitalisation_policy = lower
[sqlfluff:rules:capitalisation.functions]
capitalisation_policy = upper
[sqlfluff:rules:convention.select_trailing_comma]
select_clause_trailing_comma = forbidThis enforces uppercase keywords, lowercase identifiers, and PostgreSQL dialect, which aligns with the style used in most Supabase documentation and generated migration files. If the team is open to it, a good home for this would be the Would be happy to put together a more complete config and open a PR or discussion in the main repo if that is the preferred path forward. |
Uh oh!
There was an error while loading. Please reload this page.
This is by far the best SQL formatter I've tried (that works with VSCode). Since Supabase already includes linting suggestions in their documentation and AI prompts, why not release a recommended sqlfluff config which will let us easily auto-format our SQL files!
https://sqlfluff.com/
All reactions