Better error message for missing number exponent after "e"
See original GitHub issueFeature Request
Is your feature request related to a problem? Consider this (invalid) code:
12.3e
It 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
, …).
⚠️ SPOLIER (it’s here, but first try finding it yourself!)
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 build
whenever you change a file) - ~Add a test~ We probably already have tests for this with the “bad” error message
- Update the code!
yarn jest babel-parser
to run the tests- If some test outputs don’t match but the new results are correct, you can delete the bad
output.json
files and run the tests again - If you prefer, you can run
OVERWRITE=true yarn jest babel-parser
and 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 test
to run all the tests - Run
git push
and open a PR!
If you need any help, feel free to reply here or write me on slack!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Latex long calculation error: "Missing number, treated as zero"
so it uses TeX's plain assignment \register1=\register2 , omitting the optional = sign. Your code then does, after the expansion of \setlength :...
Read more >SyntaxError: missing ) after argument list - JavaScript | MDN
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be...
Read more >How to avoid broken formulas - Microsoft Support
Start by selecting OK or press ESC to close the error message. You'll return to the cell with the broken formula, which will...
Read more >Missing number, treated as zero - Overleaf, Online LaTeX Editor
The most basic way this error can be generated is if you have forgotten to include a number in a command where a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
An edge case: Currently Babel throwsfor
1.e
, which should have thrownMissing exponent after 'e' in floating-point number
. Apparently I thought of Chromium console as Babel.It’s your! If you need any help feel free to ask.