[callback-return] only accepts callbacks that are by themselves or prefixed with a return
See original GitHub issuecallback-return
only accepts callbacks that are by themselves on a line, or prefixed with return
.
Tell us about your environment
- ESLint Version: 6.8.0
- Node Version: 12.14.1
- npm Version: 6.14.2
What parser (default, Babel-ESLint, etc.) are you using?
@typescript-eslint/parser
Please show your full configuration:
Configuration
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json',
ecmaVersion: 2019,
sourceType: 'module'
},
env: { node: true },
rules: {
'callback-return': 'warn'
}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
const mutate = <TObject extends object, TKey extends keyof TObject>(
obj: TObject,
key: TKey,
callback: (value: TObject[TKey]) => TObject[TKey]
): void => {
obj[key] = callback(obj[key]);
};
eslint . --ext ts
What did you expect to happen?
callback
not to be flagged by callback-return
.
What actually happened? Please include the actual, raw output from ESLint.
callback
is flagged by callback-return
:
16:14 warning Expected return with your callback function callback-return
Are you willing to submit a pull request to fix this bug? Maybe - looking at the source code & documentation, it might be tough to implement a sound fix.
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (17 by maintainers)
Top GitHub Comments
I’m clearly a bit scattered, because this is one of the rules we just ported over to
eslint-plugin-node
. Since we are deprecating this rule, I would suggest closing this and moving this discussion to a new issue over in that repository. Sorry for the confusion, all!Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that accepted issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.