Closed martypdx closed 10 months ago
We don’t expose Acorn related functionality because using Acorn id an implementation that could potentially change in the future. We’ve discussed this before.
https://github.com/eslint/espree/issues/542#issuecomment-1094469829
I'm building an eslint custom parser extension and wanted to leverage the espree parser as an acorn extension to take advantage of the esprima compatible translation that already exist for tokens and comments (and template differences).
Running into some issues with the structure of
espree
:Extension function not exposed
The acorn factory extension method is not currently exposed as an package export. Would be great to be able to import espreeAcornPlugin as a composable acorn plugin.
Changed option key for locations and ranges
Minor issue in that the keys for locations and ranges options differs (unnecessarily?) from acorn options. New options are fine but would be good to allow
locations
andranges
as input options.Token and Context TypesThis is a broader acorn plugin ecosystem issue, but the token types in espree are hard coded for only coreacorn
andacorn-jsx
. I followed theacorn-jsx
example and added a custom namespace as well, but that approach doesn't really work in a composable plugin system. Not sure what the answer is. Have some hacks in mind, will update with more info when I try them.EDIT: Not sure what the answer is for this. I ended up injecting new tokens into the base Parser. Opened this issue on acorn.