SQL Style Lint Specification
ztd query lint --rules leading-comma checks generated or maintained SQL for multiline comma placement without rewriting the file.
Use this rule when a package wants leading commas in multiline SQL lists and wants the check to be enforced by tooling instead of reviewer memory.
Why lint-only
The style check is intentionally lint-only. SQL formatting can change comment placement, and comment round-tripping must be proven separately before automatic style rewrites become safe for generated SQL workflows.
The rule validates that the SQL parses through rawsql-ts first, then reports source locations where a comma remains at the end of a continued line.
Usage
ztd query lint path/to/query.sql --rules leading-commaUse comma-separated rules when combining style and structure checks:
ztd query lint path/to/query.sql --rules join-direction,leading-commaReported pattern
This reports a warning because the comma trails the previous line:
select
id,
email
from public.usersThe preferred leading-comma form is clean:
select
id
, email
from public.usersOne-line lists are not reported:
select id, email from public.usersSuppression
Use a local suppression only when a generated query needs an intentional exception:
-- ztd-lint-disable leading-comma
select
id,
email
from public.usersThe suppression disables only the leading-comma rule for that SQL text.