Why this matters
Operates on the SQL keyword tokens emitted by the parser; identifiers, string literals, and comments are left alone. The `types` option separately controls how built-in type names (`int`, `text`, `varchar`) are cased — defaulting to `skip` so user-defined type names like `ulid` (which the rule cannot touch) don't end up case-mismatched against built-ins.
Examples
Incorrect
select id, name from users where active = true limit 10;Correct
SELECT id, name FROM users WHERE active = TRUE LIMIT 10;Configure it
// eslint.config.js
import postgresql from "eslint-plugin-postgresql";
export default [
{
files: ["**/*.sql"],
languageOptions: {
parser: postgresql.configs.recommended.languageOptions.parser,
},
plugins: { postgresql },
rules: {
"postgresql/prefer-keyword-case": [
"warn",
{
case: "upper",
types: "skip",
},
],
},
},
]; Options
Edit the SQL — only prefer-keyword-case is enabled.
Pre-filled with the first incorrect example. Toggle off in the rule shelf to see how the diagnostic disappears.
Diagnostics
No issues found.
2 rules enabled.
Rule under test
prefer-keyword-case — plus no-syntax-error as a safety net.