This plugin contains lint rules related to function declarations.
-
Add
eslint-plugin-functions
to your devDependencies. -
Add
functions
to theplugins
section of your ESLint configuration.
{
"plugins": ["functions"]
}
- Enable the rule(s) that you want ESLint to enforce.
{
"rules": {
"functions/top-level-fn-decl": "warn"
}
}
There's currently just one lint rule in this package.
top-level-fn-decl
This rule enforces that the all top-level functions should be function declarations.
Example:
// Correct usage (no lint warning)
function foo() {
return;
}
// Incorrect usage (raises lint warning)
const foo = () => {
return;
};