forked from firebase/firebase-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for eslint when initializing cloud functions (firebase#242)
* added .eslintrc file, lint option in package.json, and lint rules in eslint.json
- Loading branch information
Showing
4 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"parserOptions": { | ||
// Required for certain syntax usages | ||
"ecmaVersion": 6 | ||
}, | ||
"plugins": [ | ||
"promise" | ||
], | ||
"rules": { | ||
// Warn against comparing against -0 | ||
"no-compare-neg-zero": 1, | ||
|
||
// Warn against assignment operators in conditional expressions | ||
"no-cond-assign": 1, | ||
|
||
// Warn against comma operators | ||
"no-sequences": 1, | ||
|
||
// Warn against constant expressions in conditions | ||
"no-constant-condition": 1, | ||
|
||
// Warn against control characters in regular expressions | ||
"no-control-regex": 1, | ||
|
||
// Warn against duplicate arguments in function definitions | ||
"no-dupe-args": 1, | ||
|
||
// Warn against duplicate keys in object literals | ||
"no-dupe-keys": 1, | ||
|
||
// Warn against duplicate case labels | ||
"no-duplicate-case": 1, | ||
|
||
// Warn against empty block statements | ||
"no-empty": 1, | ||
|
||
// Warn against empty character classes in regular expressions | ||
"no-empty-character-class": 1, | ||
|
||
// Warn against reassigning exceptions in catch clauses | ||
"no-ex-assign": 1, | ||
|
||
// Warn against unnecessary boolean casts | ||
"no-extra-boolean-cast": 1, | ||
|
||
// Warn against unnecessary semicolons | ||
"no-extra-semi": 1, | ||
|
||
// Warn against reassigning function declarations | ||
"no-func-assign": 1, | ||
|
||
// Warn against variable or function declarations in nested blocks | ||
"no-inner-declarations": 1, | ||
|
||
// Warn against invalid regular expression strings in RegExp constructors | ||
"no-invalid-regexp": 1, | ||
|
||
// Warn against irregular whitespace outside of strings and comments | ||
"no-irregular-whitespace": 1, | ||
|
||
// Warn against calling global object properties as functions | ||
"no-obj-calls": 1, | ||
|
||
// Warn against confusing multiline expressions | ||
"no-unexpected-multiline": 1, | ||
|
||
// Warn against unreachable code after return, throw, continue, and break statements | ||
"no-unreachable": 1, | ||
|
||
// Warn against reassigning function parameters | ||
"no-param-reassign": 1, | ||
|
||
// Return inside each then() to create readable and reusable Promise chains. | ||
"promise/always-return": 2, | ||
|
||
// Prefer async/await to the callback pattern | ||
"promise/prefer-await-to-callbacks": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "functions", | ||
"description": "Cloud Functions for Firebase", | ||
"scripts": { | ||
"lint": "./node_modules/.bin/eslint .", | ||
"serve": "firebase serve --only functions", | ||
"shell": "firebase experimental:functions:shell", | ||
"start": "npm run shell", | ||
"deploy": "firebase deploy --only functions", | ||
"logs": "firebase functions:log" | ||
}, | ||
"dependencies": { | ||
"firebase-admin": "~5.4.2", | ||
"firebase-functions": "^0.7.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.12.0", | ||
"eslint-plugin-promise": "^3.6.0" | ||
}, | ||
"private": true | ||
} |
File renamed without changes.