The `prettier-plugin-firebase-database` package, currently at version 2.0.0, is a specialized Prettier plugin designed to format Firebase Realtime Database Rules. It enforces a consistent code style for `*.rules` files (e.g., `database.rules.json`), ensuring readability and maintainability within development teams working with Firebase. As a Prettier plugin, it integrates into existing Prettier setups via configuration, providing custom parsing and formatting logic tailored to the unique JSON-like syntax of Firebase security rules. The project follows Prettier's major release cadence, with updates typically occurring to maintain compatibility with new Prettier versions or to adapt to changes in Firebase rules syntax. Its key differentiator is providing specific, correct formatting for Firebase rules, which generic JSON formatters often handle incorrectly.
npm install prettier-plugin-firebase-databaseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure Prettier to load the Firebase Database Rules plugin. After installing `prettier` and `prettier-plugin-firebase-database` as dev dependencies, create or update your `prettier.config.js` file with the plugin reference. You can then format `.rules` files using `prettier --write your-file.rules`.
Upgrade Prettier to version 3 or greater by running `npm install prettier@latest` or `yarn add prettier@latest`.
Verify that `plugins: ['prettier-plugin-firebase-database']` is present and correctly spelled in your Prettier config.
Add an `overrides` entry to your Prettier config: `overrides: [{ files: '*.your_extension', options: { parser: 'prettier-plugin-firebase-database' } }]` where `your_extension` is the actual file extension.Ensure `prettier-plugin-firebase-database` is installed as a dev dependency and correctly listed in the `plugins` array of your `prettier.config.js`. If using package managers like Yarn PnP, check plugin resolution.
Install `prettier` version 3 or greater: `npm install --save-dev prettier@latest` or `yarn add --dev prettier@latest`.
Verify the file path and pattern provided to the `prettier --write` command. Ensure the file exists and the glob pattern is correct relative to where you run the command.