eslint-plugin-max-return-statements-per-function
Version:
ESLint rule to limit the number of return statements in a function
39 lines (25 loc) • 954 B
Markdown
# eslint-plugin-max-return-statements-per-function
[](https://badge.fury.io/js/eslint-plugin-max-return-statements-per-function)
This rule reproduces one of [codeclimate's default checks](https://docs.codeclimate.com/docs/maintainability#checks), `return statements`, with ESLint.
## Installation
### npm
```shell
npm install --save-dev eslint-plugin-max-return-statements-per-function
```
### yarn
```shell
yarn add -D eslint-plugin-max-return-statements-per-function
```
## Usage
The rule takes one option, which is the maximum number of return statements in a function. The default is 4.
You can set the option like this in `.eslintrc.js`:
```js
module.exports = {
plugins: ["max-return-statements-per-function"],
rules: {
"max-return-statements-per-function/max-return-statements-per-function": ["error", 4],
},
};
```
## License
MIT