Registry / gcp / prettier-plugin-bq

prettier-plugin-bq

JSON →
library1.0.5jsnpmunverified

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.

npm install prettier-plugin-bq
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-BQ
P
prettier-plugin-bq
gcpjavascriptv1.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

prettier-plugin-bq
import {} from 'prettier-plugin-bq' // no export, plugin auto-detected
const plugin = require('prettier-plugin-bq')
Plugin is not a JavaScript module to import; it's discovered via prettier's plugin resolution. Use .prettierrc or CLI --plugin flag.
prettier
import prettier from 'prettier'
const prettier = require('prettier')
Prettier 3 is ESM-only; use import syntax or dynamic import.
default (prettier instance)
import * as prettier from 'prettier'
const prettier = require('prettier')
For programming usage, use ES module import. CommonJS require will fail in prettier 3.

Install prettier and the plugin, create a SQL file, format it using the CLI with --plugin flag.

npm install --save-dev prettier prettier-plugin-bq echo "SELECT name, SUM(salary) AS total_salary FROM employees WHERE department = 'Engineering' GROUP BY name HAVING total_salary > 100000 ORDER BY total_salary DESC;" > query.sql npx prettier --write query.sql --plugin=prettier-plugin-bq
prettier --version
Debug
Known issues
gotchaPlugin 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.
fix
Update prettier to v3.2.4 or later: npm install prettier@latest --save-dev
affects: <1.0.0 or prettier <3.2.4
deprecatedOption printPseudoColumnsInUpperCase was merged into printKeywordsInUpperCase. Using the old name may be ignored or cause errors in future versions.
fix
Use printKeywordsInUpperCase instead of printPseudoColumnsInUpperCase.
affects: >=1.0.0
gotchaJinja template support is experimental and may produce incorrect formatting or errors if Jinja statements do not contain valid SQL expressions.
fix
Ensure Jinja tags wrap valid SQL expressions; avoid placing statements like WHERE or JOIN entirely inside Jinja conditionals.
affects: >=1.0.0
gotchaThe plugin does not follow any famous style guides; it formats according to its own heuristics, which may differ from expectations of BigQuery style guides.
fix
Review formatting output and adjust options (e.g., printKeywordsInUpperCase) to match preferred style.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-bq'
The plugin is not installed or not resolved by prettier. Usually because prettier v2 is installed, or the plugin is not listed in .prettierrc.
fix
npm install prettier@latest prettier-plugin-bq --save-dev and add "plugins": ["prettier-plugin-bq"] to .prettierrc
TypeError: Cannot read properties of undefined (reading 'format')
Using require('prettier-plugin-bq') and trying to call it as a function. The plugin is not a module to import programmatically.
fix
Do not import the plugin directly; configure it via .prettierrc or CLI.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
prettierrequiredpeer dependency required for plugin to work
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Resources
prettier-plugin-bq — npm install prettier-plugin-bq · libregistry