Since Espree v3.0.0 is a prerelease version, you’ll need to install it using the
$ npm install espree@next
@latest tag is still on the latest v2.x version of Espree.
Note: We are providing this release to gather feedback. Help out by filing issues if you find a problem.
Here are some highlights of changes in this release.
Based on Acorn
This switch took a lot of time and effort, and huge thanks go to Ingvar Stepanyan for all of his help in making this happen by both contributing code directly to Espree and for helping to fix bugs on Acorn.
AST and Output Differences
Because Acorn works a bit differently than Esprima, there are some changes to the output. These changes are relatively minor and have been verified to not cause problems in ESLint, so we are hopeful that these changes also will have little effect on other consumers.
endproperties on nodes and tokens. Acorn uses these internally as part of the parsing routine and attempts to remove or make them nonenumerable resulted in a performance hit. As such, we decided to just leave these properties. They correspond exactly to the two values in the
- The end of each node is now considered the location of the last token. Esprima and Espree v2.x included trailing whitespace in the range of a node, but Acorn and Espree v3.x don’t.
- Error messages are different. Instead of trying to replicate the error messages from Esprima, Espree v3.x just uses the Acorn messages. The error object formats are the same, it’s just the actual text of the message that is different.
- Fix: (‘…’) should parse #202
- Fix: MetaProperty should have two Identifiers #206
- Fix: generator + computed property method is parsed as none computed. #207
- Fix: parse unicode escapes in identifiers (fixes #181) (Nicholas C. Zakas)
- Fix: Ensure object rest works in destructed arg (fixes #213) (Nicholas C. Zakas)