Skip to main content

no-useless-return

Disallows redundant return statements.

This is the exact same thing as the ESLint no-useless-return rule, except the auto-fixer is disabled.

Rule Details

This version of the rule without an auto-fixer is useful because it is common during development to comment out code after an early return. In these cases, the auto-fixer is harmful, since it would require us to manually go put the return statement back after uncommenting the code.

Gotchas

If you use this rule, make sure to turn off the vanilla ESLint rule, like this:

{
"rules": {
"no-useless-return": "off"
}
}

Otherwise, the two rules will conflict with each other.

Note that if you use the recommended config that comes with this plugin, then the vanilla ESLint rule will be turned off automatically.

Options and Defaults

{
"rules": {
"complete/no-useless-return": "error"
}
}

This rule is not configurable. (All of the unsafe options from the original have been removed.)

Resources