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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃搸 Implement lint/useNumberNamespace - eslint-unicorn/prefer-number-properties #1228

Closed
Conaclos opened this issue Dec 17, 2023 · 3 comments 路 Fixed by #1314
Closed

馃搸 Implement lint/useNumberNamespace - eslint-unicorn/prefer-number-properties #1228

Conaclos opened this issue Dec 17, 2023 · 3 comments 路 Fixed by #1314
Assignees
Labels
A-Linter Area: linter good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@Conaclos
Copy link
Member

Conaclos commented Dec 17, 2023

Description

Implement prefer-number-properties

Biome already provides noGlovalIsFinite and noGlobalIsNan because the global and Number-namespaced functions have not the same semantic. Thus, the new rule should ignore these two functions.

The new rule could provide a safe fix.

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.

Suggested names: useNumberNamespace, useNumberProperties

Implementation notes

Take a look at the implementations of noGlovalIsFinite and noGlobalIsNan.

@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project good first issue Good for newcomers labels Dec 17, 2023
@seitarof
Copy link
Contributor

Hi! I'd like to try on this.

@ematipico
Copy link
Member

I wonder why this should fail

const {parseInt} = Number;
const foo = parseInt('10', 2);

@Conaclos
Copy link
Member Author

I wonder why this should fail

const {parseInt} = Number;
const foo = parseInt('10', 2);

Same here. I think we should only take global references into account. This example should pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants