Skip to content

arrow-return-shorthand isn't completely compatible with arrow-body-style #345

@Zip753

Description

@Zip753

🐛 Bug Report

  • tslint-to-eslint-config version: 0.5.1
  • ESLint version: 6.8.0
  • Node version: 8.17.0

Actual Behavior

arrow-return-shorthand is converted to arrow-body-style automagically without any warning.

Expected Behavior

Conversion should produce a message about an incompatible use case - when arrow function body is multiline and using curly brackes, but has only one line which returns the result immediately, arrow-return-shorthand doesn't yield an error (unless "multiline" is specified), while arrow-body-style produces an error, suggesting that the result could be returned using the short notation.

I agree that this use case is rather arguable, but in my organization, there's a huge monorepo where such use case is a pattern which is already in place, and it took me a while to figure out what exactly caused the mismatch. Some warning message instead would've been nice 🙂

In my case, I actually commented this rule out, until further development of things (either will refactor the code, or maybe the rule will add compatibility support for this case), but I imagine it would be helpful for others as well.

Reproduction

https://github.com/Zip753/arrow-return-shorthand-migration-repro

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomers; welcome aboard!status: accepting prsPlease, send in a PR to resolve this! ✨type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions