question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error message for missing number exponent after "e"

See original GitHub issue

Feature 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)

  1. Write a comment there to let other possible contributors know that you are working on this bug.
  2. Fork the repo
  3. Run git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel
  4. Run yarn && make bootstrap
  5. Wait ⏳
  6. Run make watch (or make build whenever you change a file)
  7. ~Add a test~ We probably already have tests for this with the “bad” error message
  8. Update the code!
  9. 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.
  10. If it is working, run make test to run all the tests
  11. 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JLHwungcommented, Sep 17, 2020

An edge case: Currently Babel throws

Invalid or unexpected token

for 1.e, which should have thrown Missing exponent after 'e' in floating-point number. Apparently I thought of Chromium console as Babel.

1reaction
nicolo-ribaudocommented, Sep 17, 2020

It’s your! If you need any help feel free to ask.

Read more comments on GitHub >

github_iconTop Results From Across the Web

missing exponent - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found