You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're encountering an issue in ESLint where acorn throws an error when two different versions of espree are loaded at the same time.
The tl;dr of the issue is that espree works by adds a plugin to acorn (i.e. setting acorn.plugins.espree), and exposing an interface that invokes acorn with the espree plugin enabled. If there are multiple versions of espree that depend on the same version of acorn, they can inadvertently override each others' plugins since they're both setting acorns.plugins.espree. The result is that invoking one version of espree might end up calling the parser methods of a different version of espree, which causes a crash because the second version of espree wasn't expecting its parser methods to be called.
In other words, the root cause of the issue is that it's not currently possible to use a plugin without modifying shared global state.
What would you think about adding a function that returns a "fresh" copy of the acorn library, which would be guaranteed to not have been touched by any other package consumers? Bluebird has something like this with Promise.getNewLibraryCopy.
Another possible way to resolve the issue would be to update the plugin interface so that it returns a wrapper module that auto-applies the given plugins (along the lines of request.defaults), but this seems like it could cause compatibility issues.
The text was updated successfully, but these errors were encountered:
This should be fixed in version 6.0 (to be released this week), via patch 7a20d80 . The downside, of course, is that plugins will have to be upgraded before you'll be able to use them with 6.0. If you need help porting a given plugin for which I haven't already submitted a pull request, let me know.
We're encountering an issue in ESLint where
acorn
throws an error when two different versions ofespree
are loaded at the same time.The tl;dr of the issue is that
espree
works by adds a plugin toacorn
(i.e. settingacorn.plugins.espree
), and exposing an interface that invokesacorn
with theespree
plugin enabled. If there are multiple versions ofespree
that depend on the same version ofacorn
, they can inadvertently override each others' plugins since they're both settingacorns.plugins.espree
. The result is that invoking one version ofespree
might end up calling the parser methods of a different version ofespree
, which causes a crash because the second version ofespree
wasn't expecting its parser methods to be called.In other words, the root cause of the issue is that it's not currently possible to use a plugin without modifying shared global state.
What would you think about adding a function that returns a "fresh" copy of the
acorn
library, which would be guaranteed to not have been touched by any other package consumers? Bluebird has something like this withPromise.getNewLibraryCopy
.Another possible way to resolve the issue would be to update the plugin interface so that it returns a wrapper module that auto-applies the given plugins (along the lines of
request.defaults
), but this seems like it could cause compatibility issues.The text was updated successfully, but these errors were encountered: