-
-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💅 Transform a function with generics to arrow function by biome linter will not safe. #3292
Comments
I see two options:
I think we should go with option 1 because JSX can only appear in an |
Sorry my late response. It sounds good idea! |
Environment information
Rule name
lint/complexity/useArrowFunction
Playground link
https://biomejs.dev/playground/?code=CgAKAGMAbwBuAHMAdAAgAHcAaQB0AGgARABlAGYAYQB1AGwAdAAgAD0AIABmAHUAbgBjAHQAaQBvAG4AIAA8AFQAPgAoAHYAYQBsAHUAZQA6ACAAVAAsACAAZABlAGYAYQB1AGwAdABWAGEAbAB1AGUAOgAgAFQAKQAgAHsACgAgACAAcgBlAHQAdQByAG4AIAB2AGEAbAB1AGUAIAA%2FAD8AIABkAGUAZgBhAHUAbAB0AFYAYQBsAHUAZQA7AAoAfQA7AAoACgAvAC8AIABjAG8AbgBzAHQAIAB3AGkAdABoAEQAZQBmAGEAdQBsAHQAIAA9ACAAPABUAD4AKAB2AGEAbAB1AGUAOgAgAFQALAAgAGQAZQBmAGEAdQBsAHQAVgBhAGwAdQBlADoAIABUACkAIAA9AD4AIAB2AGEAbAB1AGUAIAA%2FAD8AIABkAGUAZgBhAHUAbAB0AFYAYQBsAHUAZQA7AAoA
Expected result
Hi there, I discovered some weird behavior with Biome linter, so I want to share it.
When I apply to
biome check --write
to this code below (please don't mind that the functions actual doing.)Biome linter suggest (also will be replaced) to this
However, unfortunately it seems probably wrong. And I actually expect to replace like this (
<T,>
)Here is Typescript playground, and you can see how typescript recognize those code.
https://www.typescriptlang.org/play/?#code/FAehAIGMHsDsGcAu4DuBLRALAIgUwGYCGArgDbIC84+xskiac4APACoB8AFAG6GnG4AXOFYAacABMCJcgDU+A4awCU4AN6gI4beABOuRMV2xwvfrnAB+S5OllE88wG5N4AL4vgMBMnRY8RPYAqrC4AB4ADrj0uBLgVGyiXGaKIuJSgXIKQiKqFOym2VY2GTIO2Z7eSKgYOHbkAKKR0Yix8SwcPNlK6fXl5kp5BSkW1raZ-QIuQA
And also this post said what should suggest to.
https://stackoverflow.com/questions/32308370/what-is-the-syntax-for-typescript-arrow-functions-with-generics
Thanks!
Code of Conduct
The text was updated successfully, but these errors were encountered: