Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Repro
{"rules": {"@typescript-eslint/no-confusing-void-expression": ["warn", {ignoreArrowShorthand: true}, ], }}
// setState return void, this is ok and shorter<ModalonClose={()=>setState(undefined)}/>// We are returning a number to a void callback. This is probably a mistake<CounteronChange={(value)=>Math.abs(value)}/>
Expected Result
Warn in the second case.
I would like the rule to report on return type mismatch likeno-misused-promises
, while keeping the the possibility to use arrow function when callback returns nothing. Would an option for this be accepted? I can work on it next week if I have a green light
We could also change the default behaviour of ignoreArrowShorthand, but it would be a breaking change
Actual Result
Warn in both cases by default, non with{ ignoreArrowShorthand: true }
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 4.14.1 |
@typescript-eslint/parser | 4.14.1 |
TypeScript | 4.0.5 |
ESLint | 7.19.0 |
node | 4.13.1 |