Feature Request
Is your feature request related to a problem?
Consider this (invalid) code:
It throws this error:
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 (or make 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 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!
Feature Request
Is your feature request related to a problem?
Consider this (invalid) code:
It throws this error:
Describe the solution you'd like
It should throw something like
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
makeandyarnavailable on your machine)git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babelyarn && make bootstrapmake watch(ormake buildwhenever you change a file)Add a testWe probably already have tests for this with the "bad" error messageyarn jest babel-parserto run the testsoutput.jsonfiles and run the tests againOVERWRITE=true yarn jest babel-parserand they will be automatically updated.make testto run all the testsgit pushand open a PR!If you need any help, feel free to reply here or write me on slack!