Open andrewcharnley opened 8 years ago
Good idea but not sure if this is really possible. May be eslint/espree does it. Are you willing to submit a pull request?
Why's it not possible? Just add e.fileName = filename;
Reason: the api.parse() takes a dataset and doesn't provide the specific item Acorn threw, instead just passing the Acorn error through.
I doubt linters are using Acorn? so potentially they can throw different errors.
Well that's true. I was a bit busy so didn't think long on this before replying. I'd much prefer the parser do this itself and Espree may be doing it. I'm already planning to switch to Espree sometime soon since it helps with handling comments so would simplify our code here.
So if you have the time I'd look into switching the parser to Espree instead of adding this try-catch block.