Closed as not planned
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
Description
When given code:
function foo() {
if (cond) return console.log()
}
The error says to move the console.log
before return
and autofix does it automatically, but when ignoreVoidReturningFunctions
is enabled a simpler fix would be to simply add the void annotation to the function return type.
I think it should mention this possibility in every error message and autofix should do whatever requires less changes. For example for arrow functions it could preserve the current behavior and fix by adding braces.
Fail
// no changes
Pass
// no changes
Additional Info
Continued from #8538