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/useSimpleNumberKeys): ignore comments #957

Merged

Conversation

kalleep
Copy link
Contributor

@kalleep kalleep commented Nov 29, 2023

Summary

When checking if a key is a complex number we check the token value without trivia.

Minimal reproducible example: https://biomejs.dev/playground/?code=KAB7AAoAIAAgAC8ALwBuAAoAIAAgADEAOgAgADEACgB9ACkA

This also fixes another issue where we get a false positive on multiline binary, hex and octal numbers:
https://biomejs.dev/playground/?code=KAB7AAoAIAAgADAAYgAxADEAOgAgADEACgB9ACkAOwAKACgAewAKACAAIAAwAHgAMQA6ACAAMQAKAH0AKQA7AAoAKAB7AAoAIAAgADAAbwAxADoAIAAxAAoAfQApADsACgAKACgAewAwAGIAMQAxADoAIAAxAH0AKQA7AAoAKAB7ADAAeAAxADoAIAAxAH0AKQA7AAoAKAB7ADAAbwAxADoAIAAxAH0AKQA7AA%3D%3D

Closes: #918

Test Plan

Updated snapshot test

@github-actions github-actions bot added A-Linter Area: linter A-Website Area: website L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Nov 29, 2023
Copy link
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An effective fix! Thanks!

@Conaclos Conaclos changed the title fix(lint): useSimpleNumberKeys should ignore comments fix(lint/useSimpleNumberKeys): ignore comments Nov 29, 2023
@Conaclos Conaclos merged commit 2baec67 into biomejs:main Nov 29, 2023
14 checks passed
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those things are so easy to miss! Thank you

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 A-Website Area: website L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 useSimpleNumberKeys doesn't ignore comments
3 participants