eslint-plugin-firebase-functions
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

eslint-plugin-firebase-functions

An eslint plugin that provides utilty rules for working with firebase functions.

Install

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:

module.exports = {
	plugins: ['firebase-functions'],
	rules: {
		// Example enabling a rule
		'firebase-functions/<rule>': 'error',
	},
};

Rules:

safe-function-exports — Ensures that firebase functions defined in a file are exported inline as a named export
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) => {
	//
});

Package Sidebar

Install

npm i eslint-plugin-firebase-functions

Weekly Downloads

215

Version

1.0.14

License

MIT

Unpacked Size

5.09 kB

Total Files

4

Last publish

Collaborators

  • aabbccsmith