-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: give token types and etc to plugins #870
Conversation
@adrianheine @RReverser What do you think? This is a bit kludgey, but seems low-impact, and would allow plugins to migrate to it conditionally ( I'd add |
I'm glad if this advanced. |
Thank you very much! I have sent acornjs/acorn-jsx#102 to use this feature in |
@marijnh Should we backport this to 6.x? Looks like it's still causing issues: acornjs/acorn-jsx#103 |
Ugh, what a mess. I guess back-porting would at least make this less painful. I'd be okay with that. |
What would be needed to get the fix backported to 6.x.? I'm facing this issue through react-styleguidist too and would be happy to help. :) |
@mysticatea Do you want to make the backport PR? |
@RReverser Sorry, I don't think I can, because |
I've set up a |
@mysticatea Would you still be willing to work on that PR? I can try but I'm not familiar with this library at all so it would take some time. |
I can also help with PR. Although not too familiar with the codebase I will participate to make it reality. |
See #887 |
Hello.
Since the installation problem has re-raised due to 7.0.0, I want to revisit #824.
Context:
Issue is eslint/eslint#12119.
espree
, the default parser of ESLint, depends onacorn
andacorn-jsx
.This expected to work fine because the peer dependency requirement of
acorn-jsx
satisfies. But, in fact,npm
guarantees the peer dependency requirements satisfy, but doesn't guarantee theacorn
thatespree
imports and theacorn
thatacorn-jsx
imports are the same one.For example, if an end-user installed webpack as well...
Then
npm
can dedupe those...OK, the peer dependency requirement of the
acorn-jsx
still satisfies. It's a right installation. But broken. Theacorn-jsx
imports Webpack'sacorn
. Theespree
imports ownacorn
. Soacorn.tokTypes
gets different instances.Here, please mind two
acorn
s are not used at the same time. One is used by Webpack. One is used by ESLint. End users cannot solve this problem. They only can choose to break either ESLint or Webpack or give up the use of new features of those.There are a lot of packages that depend on
acorn
. It means that people can depend onacorn
indirectly easily, thenacorn
's plugins are very fragile.A solution:
I think that the root cause is acorn's plugins cannot get the applied
acorn
entity. The peer dependencies functionality doesn't guaranteeacorn
entity is unique because of indirect dependencies.This PR lets plugins access
tokTypes
and etc viaParser.acorn.tokTypes
and other members. TheParser
is theacorn
entity that the plugin was applied.Maybe there are other solutions, but this is an idea. Would you consider to solve this problem?