Skip to content

Support for NumericLiteralSeparator, Stage 1 feature#5793

Merged
hzoo merged 2 commits intobabel:7.0from
rwaldron:5783
May 31, 2017
Merged

Support for NumericLiteralSeparator, Stage 1 feature#5793
hzoo merged 2 commits intobabel:7.0from
rwaldron:5783

Conversation

@rwaldron
Copy link
Copy Markdown
Contributor

@rwaldron rwaldron commented May 30, 2017

Not ready for merge

Signed-off-by: Rick Waldron waldron.rick@gmail.com

Q A
Patch: Bug Fix? no
Major: Breaking Change? no
Minor: New Feature? yes
Deprecations? no
Spec Compliancy? yes
Tests Added/Pass? yes
Fixed Tickets Fixes #5783
License MIT
Doc PR
Dependency Changes yes

Adds support for Numeric Separator

@mention-bot
Copy link
Copy Markdown

@rwaldron, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo to be a potential reviewer.

@codecov
Copy link
Copy Markdown

codecov bot commented May 30, 2017

Codecov Report

Merging #5793 into 7.0 will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              7.0    #5793      +/-   ##
==========================================
+ Coverage   84.81%   84.82%   +0.01%     
==========================================
  Files         282      283       +1     
  Lines        9875     9877       +2     
  Branches     2777     2776       -1     
==========================================
+ Hits         8375     8378       +3     
+ Misses        991      990       -1     
  Partials      509      509
Impacted Files Coverage Δ
packages/babel-preset-stage-1/src/index.js 100% <ø> (ø) ⬆️
...babel-plugin-syntax-numeric-separator/src/index.js 100% <100%> (ø)
packages/babel-cli/src/babel-node.js 47.82% <0%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3783429...47b676e. Read the comment docs.

@rwaldron
Copy link
Copy Markdown
Contributor Author

@hzoo ready for an initial review!

@@ -0,0 +1,35 @@
# babel-plugin-syntax-numeric-separator


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To be consistent across package READMEs, could you add there a description:

# babel-plugin-syntax-numeric-separator

> Transforms blablabla

## Installation
[...]

We should maybe add this to the spec implementor documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, absolutely

@xtuc xtuc added PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Spec Compliance 👓 A type of pull request used for our changelog categories labels May 31, 2017
@xtuc
Copy link
Copy Markdown
Member

xtuc commented May 31, 2017

Nice job @rwaldron.

Do we want to backport that to 6.x?

@hzoo
Copy link
Copy Markdown
Member

hzoo commented May 31, 2017

I'd like to not have to backport features, especially if it's a proposal?

@rwaldron
Copy link
Copy Markdown
Contributor Author

@xtuc PR updated with amended commit; now includes: https://github.com/babel/babel/pull/5793/files#diff-921c1523bfcb64eefcc009dba96e1a3bR3

@xtuc
Copy link
Copy Markdown
Member

xtuc commented May 31, 2017

Thanks @rwaldron. I just nit'ed cd8f6e0, you might want to squash it

# babel-plugin-syntax-numeric-separator

Allow parsing of Numeric Literals (Decimal, Binary, Hex and Octal) that contain a _NumericLiteralSeparator_.
> Allow parsing of Numeric Literals (Decimal, Binary, Hex and Octal) that contain a _NumericLiteralSeparator_.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially typed this as well (my transform plugin has >) but then looked at README.md files in other babel-plugin-syntax-* packages and the ones I looked at didn't have this, eg. https://github.com/babel/babel/tree/7.0/packages/babel-plugin-syntax-async-functions

I'll open an issue and do the work to update them all, if you'd like

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, that's correct. I can update them as well if you'd like.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Already done :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hzoo
Copy link
Copy Markdown
Member

hzoo commented May 31, 2017

@rwaldron I assume the test failures are because it doesn't have your patch yet? I published 7.0.0-beta.12 yesterday so just have to update the 3 deps to use it - can just grep for "babylon":

https://github.com/babel/babylon/releases/tag/v7.0.0-beta.12

@rwaldron
Copy link
Copy Markdown
Contributor Author

@hzoo all deps updated to 7.0.0-beta.12, and patch rebased


`boolean`, defaults to `false`.

By default, this plugin will only remove the separators, printing Decimal, Binary, Hex and Octal number representations. Enabling this option will convert them all to a Decimal value.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

extra space here?

We do have a http://babeljs.io/docs/plugins/transform-es2015-literals/ to deal with this already so in the ideal case this plugin would defer to that for the transformation. Not sure how that fits but interesting in relation to #5735. I'm ok with doing this atm though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This section has been removed.

@rwaldron rwaldron force-pushed the 5783 branch 2 times, most recently from 2f98ebc to 94f029f Compare May 31, 2017 16:39
commit cd8f6e0
Author: Sven SAULEAU <xtuc@users.noreply.github.com>
Date:   Wed May 31 16:14:15 2017 +0200

    docs: update README [skip ci]

commit cf013e3
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Tue May 30 14:51:20 2017 -0400

    Support for NumericLiteralSeparator, Stage 1 feature

    Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Copy link
Copy Markdown
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

looks good, I added a note about using a preset instead of an individual plugin

Copy link
Copy Markdown
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

👍

@hzoo hzoo merged commit 5393a49 into babel:7.0 May 31, 2017
@hzoo
Copy link
Copy Markdown
Member

hzoo commented May 31, 2017

Thanks a lot @rwaldron! (had to fix a failing issue but CI is being weird, it's 1d7d090)

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Spec Compliance 👓 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants