Skip to content

Conversation

fasttime
Copy link
Member

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What rule do you want to change?

no-loss-of-precision

What change do you want to make (place an "X" next to just one item)?

[ ] Generate more warnings
[X] Generate fewer warnings
[ ] Implement autofix
[ ] Implement suggestions

How will the change be implemented (place an "X" next to just one item)?

[ ] A new option
[X] A new default behavior
[ ] Other

Please provide some example code that this change will affect:

/* eslint no-loss-of-precision: "error" */

const a = 00000009;
const b = 00192;

Playground link

What does the rule currently do for this code?

Report errors.

What will the rule do after it's changed?

Report no errors.

What changes did you make? (Give an overview)

Non-strict mode JS allows base-10 number literals to be preceded by zeros. This PR patches the rule to account for the case where more than one zero precedes an integer to determine its correct value.

Other cases, such as when an integer is preceded by a single zero, or when a non-integer value is preceded by one or more zeros are already handled correctly.

Is there anything you'd like reviewers to focus on?

@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Sep 29, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Sep 29, 2025
@github-actions github-actions bot added the rule Relates to ESLint's core rules label Sep 29, 2025
Copy link

netlify bot commented Sep 29, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 429913a
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/68da4a7ec8d4630007b66172

@fasttime fasttime marked this pull request as ready for review September 29, 2025 09:25
@fasttime fasttime requested a review from a team as a code owner September 29, 2025 09:25
@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Sep 29, 2025
@mdjermanovic mdjermanovic moved this from Needs Triage to Implementing in Triage Sep 29, 2025
Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Leaving it open for two more days, per our policies.

@mdjermanovic mdjermanovic moved this from Implementing to Merge Candidates in Triage Sep 29, 2025
@mdjermanovic mdjermanovic merged commit a129cce into main Oct 1, 2025
42 of 43 checks passed
@mdjermanovic mdjermanovic deleted the fix-no-loss-of-precision branch October 1, 2025 05:26
@github-project-automation github-project-automation bot moved this from Merge Candidates to Complete in Triage Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants