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

Change proposal: prefer-numeric-literals should also disallow Number.parseInt #8913

Closed
kirly-af opened this issue Jul 10, 2017 · 2 comments
Closed
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@kirly-af
Copy link

kirly-af commented Jul 10, 2017

What rule do you want to change?
prefer-numeric-literals

Does this change cause the rule to produce more or fewer warnings?
More.

How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior.

Please provide some example code that this change will affect:

/*eslint prefer-numeric-literals: "error"*/

Number.parseInt("111110111", 2) === 503;
Number.parseInt("767", 8) === 503;
Number.parseInt("1F7", 16) === 255;

What does the rule currently do for this code?
Nothing.

What will the rule do after it's changed?
Same behavior as the way parseInt() is handled:
Disallow Number.parseInt() if it is called with two arguments: a string and a radix option of 2 (binary), 8 (octal), or 16 (hexadecimal).

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 10, 2017
@platinumazure platinumazure added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jul 10, 2017
@platinumazure platinumazure self-assigned this Jul 10, 2017
@platinumazure
Copy link
Member

Seems reasonable, especially if we already have special logic for global parseInt. I'll champion this enhancement.

@eslint/eslint-team What do you think?

@mysticatea mysticatea added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 11, 2017
@platinumazure
Copy link
Member

Working on this.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants