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!
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.
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"
}