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

Update: support numeric separators (refs #13568) #13581

Merged
merged 3 commits into from Aug 29, 2020
Merged

Conversation

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Aug 18, 2020

Prerequisites checklist

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

[X] Other, please explain:

refs #13568

Adds support for numeric separators (along with PR #13574).

What changes did you make? (Give an overview)

  • Updated the regex used by astUtils.isDecimalInteger and isDecimalIntegerNumericToken. Also added tests for these helpers and some tests for rules that are using them.
  • Added tests for prefer-numeric-literals and quote-props rules.

In total, this is one line of code + tests and comments.

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

  • package.json should be updated before merging.
  • The other part of the changes for numeric separators is in #13574. I think these two PRs cover all that should be updated for numeric separators in this repository, but it would be good to double-check that.
@anikethsaha
Copy link
Member

@anikethsaha anikethsaha commented Aug 18, 2020

  • package.json should be updated before merging.

I suppose that would be in a separate PR #13568 (comment)

const DECIMAL_INTEGER_PATTERN = /^(0|[1-9]\d*)$/u;
const DECIMAL_INTEGER_PATTERN = /^(0|[1-9](?:_?\d)*)$/u;
Comment on lines -40 to +40

This comment has been minimized.

@mdjermanovic

mdjermanovic Aug 18, 2020
Author Member

This actually had a bug: it doesn't recognize NonOctalDecimalIntegerLiteral literals, like 08.

I think we can fix this later since it's an existing edge-case bug that isn't related to numeric separators and requires a non-trivial change.

This comment has been minimized.

@kaicataldo

kaicataldo Aug 18, 2020
Member

Mind making an issue?

This comment has been minimized.

@mdjermanovic

mdjermanovic Aug 18, 2020
Author Member

Opened #13588

@mdjermanovic mdjermanovic force-pushed the numeric-separators branch from 1c10aa7 to 785a7cc Aug 24, 2020
Copy link
Member

@btmills btmills left a comment

LGTM. The additional tests you added are very thorough.

},
{

// this would be indeed the same as `0x0_0`, but there's no need to autofix this edge case that looks more like a mistake.

This comment has been minimized.

@btmills

btmills Aug 28, 2020
Member

Agreed that we don't need to handle this, and I appreciate that you noticed the edge case exists and added an explicit test for it 👍

Copy link
Member

@kaicataldo kaicataldo left a comment

LGTM, thanks!

@kaicataldo kaicataldo merged commit 0003dc0 into master Aug 29, 2020
13 checks passed
13 checks passed
Verify Files
Details
Test (ubuntu-latest, 14.x)
Details
Test (ubuntu-latest, 13.x)
Details
Test (ubuntu-latest, 12.x)
Details
Test (ubuntu-latest, 10.x)
Details
Test (ubuntu-latest, 10.12.0)
Details
Test (windows-latest, 12.x)
Details
Test (macOS-latest, 12.x)
Details
Browser Test
Details
commit-message PR title follows commit message guidelines
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
wip This PR is no longer a work in progress
Details
@kaicataldo kaicataldo deleted the numeric-separators branch Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.