💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
Another error I ran into while fixing #14123, and the fix for that will include a fix for this too. Compare the following runs of the parser, one with errorRecovery set to false, the other to true:
require("@babel/parser").parse("0b111199", { errorRecovery: true }).errors
require("@babel/parser").parse("0b111199", { errorRecovery: false })
See it here: https://runkit.com/tolmasky/incorrect-missingsemicolon-syntaxerror-when-errorrecover-set-to-false
You'll see the first gives you the error you expect: Expected number in radix 2. (1:6), while the second gives you an erroneous error of Missing semicolon. (1:6).
Configuration file name
No response
Configuration
No response
Current and expected behavior
Explained above.
Environment
Possible solution
No response
Additional context
No response
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
Another error I ran into while fixing #14123, and the fix for that will include a fix for this too. Compare the following runs of the parser, one with
errorRecoveryset tofalse, the other totrue:See it here: https://runkit.com/tolmasky/incorrect-missingsemicolon-syntaxerror-when-errorrecover-set-to-false
You'll see the first gives you the error you expect:
Expected number in radix 2. (1:6), while the second gives you an erroneous error ofMissing semicolon. (1:6).Configuration file name
No response
Configuration
No response
Current and expected behavior
Explained above.
Environment
Possible solution
No response
Additional context
No response