0.1.1 • Published 4 years ago

eslint-plugin-no-recursion v0.1.1

Weekly downloads
91
License
ISC
Repository
github
Last release
4 years ago

eslint-plugin-no-recursion Build Status npm

An ESLint plugin for disallowing recursion.

This plugin catches recursion in regular function declarations:

function myFunction(i) {
  return myFunction(i); // error!
}

as well as recursive calls in function expressions and arrow expressions:

let myFunction = function (i) {
  return myFunction(i); // error!
}
let myFunction = i => myFunction(i); // error!

Installation

npm install eslint-plugin-no-recursion

This plugin should work with ESLint version 3.0.0 and higher, and Node.js 8.0.0 and higher.

If you've installed ESLint globally, then you must install this plugin globally as well.

Usage

In your ESLint configuration file, add "no-recursion" to your list of plugins and "no-recursion/no-recursion" to your list of rules. How you do this varies depending on what configuration file format you use. As an example, if you use JSON then your configuration file should look something like this:

"plugins": [
  "no-recursion"
],
"rules": {
  "no-recursion/no-recursion": "error"
}