-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Better error message for missing number exponent after "e" #12071
Copy link
Copy link
Closed
Labels
claimedgood first issueoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Feature Request
Is your feature request related to a problem?
Consider this (invalid) code:
12.3eIt throws this error:
Invalid number (1:0)
Describe the solution you'd like
It should throw something like
Missing exponent after 'e' in floating-point number
If you are interested in fixing this bug, you should introduce a new error message and use it in the "tokenizer": the part of the parser which takes the input source code as a string and generates a set of corresponding tokens (1.2, foo, +, "baz", var, ...).
If it is the first time that you contribute to Babel, follow these steps: (you need to have make and yarn available on your machine)
- Write a comment there to let other possible contributors know that you are working on this bug.
- Fork the repo
- Run
git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel - Run
yarn && make bootstrap - Wait ⏳
- Run
make watch(ormake buildwhenever you change a file) Add a testWe probably already have tests for this with the "bad" error message- Update the code!
yarn jest babel-parserto run the tests- If some test outputs don't match but the new results are correct, you can delete the bad
output.jsonfiles and run the tests again - If you prefer, you can run
OVERWRITE=true yarn jest babel-parserand they will be automatically updated.
- If some test outputs don't match but the new results are correct, you can delete the bad
- If it is working, run
make testto run all the tests - Run
git pushand open a PR!
If you need any help, feel free to reply here or write me on slack!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
claimedgood first issueoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue