{"id":20341,"library":"prettier-plugin-bq","title":"Prettier Plugin for BigQuery SQL","description":"A prettier plugin for formatting GoogleSQL (BigQuery dialect) files. Supports pipe syntax, procedural language (BigQuery Scripting), and experimental Jinja template handling. v1.0.5 is current with a moderate release cadence. Requires prettier ^3.2.4 as a peer dependency. Ship TypeScript types. Differentiator vs other SQL formatters: specifically targets GoogleSQL, not generic or MySQL/PostgreSQL dialects. Active development, community-driven.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install prettier-plugin-bq","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-bq","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-bq","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to work","package":"prettier","optional":false}],"imports":[{"note":"Plugin is not a JavaScript module to import; it's discovered via prettier's plugin resolution. Use .prettierrc or CLI --plugin flag.","wrong":"const plugin = require('prettier-plugin-bq')","symbol":"prettier-plugin-bq","correct":"import {} from 'prettier-plugin-bq' // no export, plugin auto-detected"},{"note":"Prettier 3 is ESM-only; use import syntax or dynamic import.","wrong":"const prettier = require('prettier')","symbol":"prettier","correct":"import prettier from 'prettier'"},{"note":"For programming usage, use ES module import. CommonJS require will fail in prettier 3.","wrong":"const prettier = require('prettier')","symbol":"default (prettier instance)","correct":"import * as prettier from 'prettier'"}],"quickstart":{"code":"npm install --save-dev prettier prettier-plugin-bq\necho \"SELECT\n    name,\n    SUM(salary) AS total_salary\nFROM\n    employees\nWHERE\n    department = 'Engineering'\nGROUP BY\n    name\nHAVING\n    total_salary > 100000\nORDER BY\n    total_salary DESC;\" > query.sql\nnpx prettier --write query.sql --plugin=prettier-plugin-bq","lang":"javascript","description":"Install prettier and the plugin, create a SQL file, format it using the CLI with --plugin flag."},"warnings":[{"fix":"Update prettier to v3.2.4 or later: npm install prettier@latest --save-dev","message":"Plugin does not work with prettier v2; requires prettier ^3.2.4. If you have prettier v2 installed, the plugin will not be loaded and no formatting will occur.","severity":"gotcha","affected_versions":"<1.0.0 or prettier <3.2.4"},{"fix":"Use printKeywordsInUpperCase instead of printPseudoColumnsInUpperCase.","message":"Option printPseudoColumnsInUpperCase was merged into printKeywordsInUpperCase. Using the old name may be ignored or cause errors in future versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure Jinja tags wrap valid SQL expressions; avoid placing statements like WHERE or JOIN entirely inside Jinja conditionals.","message":"Jinja template support is experimental and may produce incorrect formatting or errors if Jinja statements do not contain valid SQL expressions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review formatting output and adjust options (e.g., printKeywordsInUpperCase) to match preferred style.","message":"The plugin does not follow any famous style guides; it formats according to its own heuristics, which may differ from expectations of BigQuery style guides.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install prettier@latest prettier-plugin-bq --save-dev and add \"plugins\": [\"prettier-plugin-bq\"] to .prettierrc","cause":"The plugin is not installed or not resolved by prettier. Usually because prettier v2 is installed, or the plugin is not listed in .prettierrc.","error":"Cannot find module 'prettier-plugin-bq'"},{"fix":"Do not import the plugin directly; configure it via .prettierrc or CLI.","cause":"Using require('prettier-plugin-bq') and trying to call it as a function. The plugin is not a module to import programmatically.","error":"TypeError: Cannot read properties of undefined (reading 'format')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}