Add `consistent-return` rule
markelog opened this issue · 5 comments
With treatUndefinedAsUnspecified enabled, see http://eslint.org/docs/rules/consistent-return
Lots of errors with this one on Core
I don't think we can enable this rule, it would require Core API changes. If we disabled treatUndefinedAsUnspecified then perhaps it'd be possible.
I meant treatUndefinedAsUnspecified: true, this, it seems, will adhere to our style a bit better
Yeah, re-read the docs, probably not a good fit, please re-open if you feel differently
Yeah, I agree. I'd expect this rule to have a mode that allows a function to only work in one of two modes:
return somethingis not allowed, barereturnis allowedreturn somethingis allowed but every function execution flow must end with an explicitreturn something
Such a rule could have an option to allow or disallow return undefined which we'd set to "allow".
I'm quite surprised this rule can't be configured to work in such a way. Do you think it could be extended in ESLint?
Yeah, i think it is worth a discussion at least