Giter Site home page Giter Site logo

chflick / prettier-plugin-firestore-rules Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 2.0 71.6 MB

Format your firestore security rules using prettier.

License: MIT License

JavaScript 0.32% TypeScript 99.68%
prettier-plugin prettier firebase firestore firestore-rules autoformat

prettier-plugin-firestore-rules's Introduction

CI MIT-License Dependencies DevDependencies npmVersion

prettier-plugin-firestore-rules

A plugin for prettier to enable autoformatting for Cloud Firestore Security Rules.

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 <path/to/file>

Using yarn berry

yarn prettier -w <path/to/file>

Example Usage

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.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.