Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chflick/prettier-plugin-firestore-rules
Format your firestore security rules using prettier.
https://github.com/chflick/prettier-plugin-firestore-rules
autoformat firebase firestore firestore-rules prettier prettier-plugin
Last synced: 14 days ago
JSON representation
Format your firestore security rules using prettier.
- Host: GitHub
- URL: https://github.com/chflick/prettier-plugin-firestore-rules
- Owner: ChFlick
- License: mit
- Created: 2020-02-13T06:58:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-04T18:51:00.000Z (over 1 year ago)
- Last Synced: 2024-10-28T12:29:36.390Z (18 days ago)
- Topics: autoformat, firebase, firestore, firestore-rules, prettier, prettier-plugin
- Language: TypeScript
- Homepage:
- Size: 69.9 MB
- Stars: 20
- Watchers: 3
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![CI](https://github.com/ChFlick/prettier-plugin-firestore-rules/workflows/CI/badge.svg)
![MIT-License](https://img.shields.io/github/license/ChFlick/prettier-plugin-firestore-rules)
![Dependencies](https://img.shields.io/david/ChFlick/prettier-plugin-firestore-rules)
![DevDependencies](https://img.shields.io/david/dev/ChFlick/prettier-plugin-firestore-rules)
![npmVersion](https://img.shields.io/npm/v/prettier-plugin-firestore-rules?color=blue)prettier-plugin-firestore-rules
===============================A plugin for [prettier](https://prettier.io/) to enable autoformatting for [Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/get-started).
A custom built parser for the rules is included.
How to install it
================With npm
```
npm i --save-dev prettier prettier-plugin-firestore-rules
```With yarn
```
yarn add -D prettier prettier-plugin-firestore-rules
```How to install it in the CLI
==========================Generally
```
prettier -w
```Using yarn berry
```
yarn prettier -w
```![Example Usage](./example-usage.gif)
Configuration
=======
Create a `.prettierrc` file and add your preferred configuration options.Configurations are optional.
### Available Options
- `emptyLinesBetweenBlocks`
- Default: `0`
- Adds empty lines between matcher blocks### `.prettierrc` example
```
{
"emptyLinesBetweenBlocks" : 1
}
```For more information see [Prettier documentation](https://prettier.io/docs/en/configuration.html).
To be done
==========- Fix some indentation issues
- Array not correctly indented as function parameter
```
request.resource.data.keys().hasOnly(
['rank', 'name', 'description', 'imageUrl', 'timeSlot']
)
```
- Function parameter in general
```
get(
/databases/$(database)/documents/configurations/someData
).data.values.hasAll(request.resource.data.someData)
```
- if-alignments, sometimes off
```
if hasValue('writeSLots', request.auth.uid, carId)
&& zxcv
&& xcvb
```
- semicolon may be off
```
&& request.resource.data.timeSlot.to > request.resource.data.timeSlot.from
;
```
- Add formatter options:
- && at start or end of the line