Skip to content
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

fix(lint/use_arrow_function): add a trailing comma to single type parameter when JSX is enabled #3300

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

Sec-ant
Copy link
Member

@Sec-ant Sec-ant commented Jun 27, 2024

Summary

When JSX is enabled, the code fix should transform this:

const f1 = function<T> (x: T): T {
	return x;
}

into this:

const f1 = <T,>(x: T): T => x

instead of this:

const f1 = <T>(x: T): T => x

Otherwise the parser will treat <T> as a JSX tag.

Closes #3292

Test Plan

I added test cases.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Jun 27, 2024
Copy link

codspeed-hq bot commented Jun 27, 2024

CodSpeed Performance Report

Merging #3300 will not alter performance

Comparing fix/use-arrow-function (e0c77c2) with main (5cc8a56)

Summary

✅ 90 untouched benchmarks

@Sec-ant Sec-ant merged commit b3ca28e into main Jun 27, 2024
15 checks passed
@Sec-ant Sec-ant deleted the fix/use-arrow-function branch June 27, 2024 06:59
rishabh3112 pushed a commit to rishabh3112/biome that referenced this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 Transform a function with generics to arrow function by biome linter will not safe.
2 participants