Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alii/eslint-plugin-firebase-functions
eslint-plugin-firebase-functions
https://github.com/alii/eslint-plugin-firebase-functions
eslint firebase plugin
Last synced: 24 days ago
JSON representation
eslint-plugin-firebase-functions
- Host: GitHub
- URL: https://github.com/alii/eslint-plugin-firebase-functions
- Owner: alii
- Created: 2022-02-16T23:43:20.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-14T10:12:16.000Z (over 2 years ago)
- Last Synced: 2024-10-06T07:42:31.409Z (about 1 month ago)
- Topics: eslint, firebase, plugin
- Language: TypeScript
- Homepage: https://npm.im/eslint-plugin-firebase-functions
- Size: 986 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# eslint-plugin-firebase-functions
An eslint plugin that provides utilty rules for working with firebase functions.
### Install
```sh
yarn add eslint-plugin-firebase-functions --dev
```And add the plugin to your `.eslintrc.js` and make sure you enable the rules you want to use:
```js
module.exports = {
plugins: ['firebase-functions'],
rules: {
// Example enabling a rule
'firebase-functions/': 'error',
},
};
```### Rules:
safe-function-exports
—
Ensures that firebase functions defined in a file are exported inline as a named export```ts
import * as functions from 'firebase-functions';/////////////////////
// Incorrect usage //
/////////////////////const bad = functions
.runWith({timeoutSeconds: 2000})
.https.onRequest((req, res) => {
//
});const bad2 = functions.https.onRequest((req, res) => {
//
});// Fails because not inline
export {bad};///////////////////
// Correct usage //
///////////////////export const good = functions
.runWith({timeoutSeconds: 2000})
.https.onRequest((req, res) => {
//
});export const good2 = functions.https.onRequest((req, res) => {
//
});
```