Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Commit

Permalink
prettier formatting on examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Abbott committed Jan 26, 2019
1 parent 933a5fc commit 17cf548
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.vscode-test
/dist
/test/**/*.d.ts
/test/**/*.js
/test/**/*.js
/src/**/*.js
46 changes: 28 additions & 18 deletions syntaxes/firerules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"//": "https://manual.macromates.com/en/language_grammars",
"comment": "Firestore Rules Syntax: version 1.1",
"scopeName": "source.firerules",
"fileTypes": [
"rule",
"rules"
],
"fileTypes": ["rule", "rules"],
"firstLineMatch": "^service\\scloud\\.firestore\\s{",
"foldingStartMarker": "^\\{\\s*$",
"foldingStopMarker": "^\\s*\\}",
Expand All @@ -14,24 +11,29 @@
{
"match": "\\b(\\d+)\\b",
"name": "constant.numeric"
}, {
},
{
"match": "\\/\\/.*",
"name": "comment"
}, {
},
{
"comment": "Basic types",
"match": "\\b(request|math|user|duration|string|int|cloud)\\b",
"name": "support.type"
}, {
},
{
"comment": "Strings",
"match": "[\\\"\\'].*?[\\\"\\']",
"name": "string.quoted"
}, {
},
{
"comment": "Function name",
"match": "[\\.\\s\\(]([a-zA-Z]+)(?=\\()",
"captures": {
"1": { "name": "support.function" }
}
}, {
},
{
"comment": "Function parameters",
"begin": "\\(",
"end": "\\)",
Expand All @@ -45,45 +47,53 @@
"name": "string.quoted"
}
]
}, {
},
{
"comment": "Path match literal",
"match": "\\/([a-zA-Z0-9_]+)(?=[\\s\\/])",
"captures": {
"1": { "name": "string.unquoted" }
}
}, {
},
{
"comment": "Path match variable",
"match": "\\/({[^}]+})(?=[\\s\\/])",
"captures": {
"1": { "name": "variable.parameter" }
}
}, {
},
{
"comment": "Global functions without parentheses",
"match": "^\\s*(service|match|allow)(?=\\s)",
"captures": {
"1": { "name": "support.function" }
}
}, {
},
{
"match": "\\b(if|return|is)\\b",
"name": "keyword.control"
}, {
},
{
"comment": "Access control",
"match": "\\s(get|list|read|create|update|delete|write)[,:;]",
"captures": {
"1": { "name": "storage.modifier" }
}
}, {
},
{
"match": "(=|!|>|<|\\||&)",
"name": "keyword.operator"
}, {
},
{
"match": "\\b(true|false|null|in|function)\\b",
"name": "constant.language"
}, {
},
{
"comment": "Type member",
"match": "\\.([a-zA-Z0-9_]+)",
"captures": {
"1": { "name": "variable.parameter" }
}
}
]
}
}
32 changes: 8 additions & 24 deletions syntaxes/index.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"description": "The collection group ID to which this index applies."
},
"queryScope": {
"enum": [
"COLLECTION",
"COLLECTION_GROUP"
],
"enum": ["COLLECTION", "COLLECTION_GROUP"],
"description": "The query scope to which this index applies."
},
"fields": {
Expand All @@ -26,20 +23,15 @@
"properties": {
"fieldPath": {
"type": "string",
"pattern": "^[a-zA-Z0-9_\/\.]+$",
"pattern": "^[a-zA-Z0-9_/.]+$",
"description": "The path of the field. Special field paths __name__, __type__, and __scatter__ may be used."
},
"order": {
"enum": [
"ASCENDING",
"DESCENDING"
],
"enum": ["ASCENDING", "DESCENDING"],
"description": "The order determines how a field is indexed."
},
"arrayConfig": {
"enum": [
"CONTAINS"
],
"enum": ["CONTAINS"],
"description": "The arrayConfig determines how an array field is indexed."
}
},
Expand All @@ -65,7 +57,7 @@
},
"fieldPath": {
"type": "string",
"pattern": "^[a-zA-Z0-9_\/\.]+$",
"pattern": "^[a-zA-Z0-9_/.]+$",
"description": "The field path to which this field override applies."
},
"indexes": {
Expand All @@ -74,23 +66,15 @@
"type": "object",
"properties": {
"queryScope": {
"enum": [
"COLLECTION",
"COLLECTION_GROUP"
],
"enum": ["COLLECTION", "COLLECTION_GROUP"],
"description": "The query scope to which this index applies."
},
"order": {
"enum": [
"ASCENDING",
"DESCENDING"
],
"enum": ["ASCENDING", "DESCENDING"],
"description": "The order determines how a field is indexed."
},
"arrayConfig": {
"enum": [
"CONTAINS"
],
"enum": ["CONTAINS"],
"description": "The arrayConfig determines how an array field is indexed."
}
},
Expand Down
8 changes: 3 additions & 5 deletions syntaxes/sample.indexes.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"indexes": [
{
"collectionGroup": "widgets",
Expand All @@ -13,9 +13,7 @@
{
"collectionGroup": "widgets",
"fieldPath": "baz",
"indexes": [
{ "order": "ASCENDING", "queryScope": "COLLECTION" }
]
"indexes": [{ "order": "ASCENDING", "queryScope": "COLLECTION" }]
}
]
}
}

0 comments on commit 17cf548

Please sign in to comment.