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

🐛 lint/useNumericLiterals code fix doesn't handle signed numbers #397

Closed
1 task done
Conaclos opened this issue Sep 23, 2023 · 0 comments · Fixed by #398
Closed
1 task done

🐛 lint/useNumericLiterals code fix doesn't handle signed numbers #397

Conaclos opened this issue Sep 23, 2023 · 0 comments · Fixed by #398
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Conaclos
Copy link
Member

Environment information

Playground

What happened?

useNumericLiterals provides an incorrect code fix when the number is signed with + or -.
For example:

- parseInt("-a", 16);
+ 0x-a
- parseInt("+a", 16);
+ 0x+a

Playground.

Expected result

The rule should move the sign. For example:

- parseInt("-a", 16);
+ -0xa
- parseInt("a", 16);
+ 0x+a

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Sep 23, 2023
@Conaclos Conaclos self-assigned this Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant