Skip to content
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

New: Enhanced local plugin resolution. (fixes #3458) #4735

Closed
wants to merge 1 commit into from

Conversation

izaakschroeder
Copy link

When writing presets sometimes it is desirable to include plugins as dependencies, since the preset may be explicitly for that dependency and that means one less thing users need to include and it offers an easy way to pin versions of a plugin with your preset. Unfortunately, the default eslint behavior is incapable of loading these local-style plugins for a couple of reasons:

  • require only resolves things relative to local eslint installation,
  • absolute paths are not supported,
  • developers don't want any code in preset definition files.

So with all those caveats in mind, the behavior has been altered to simply start the preset resolution process at the caller's module (i.e. the preset) instead of the callee's module (i.e. eslint).

This fixes #3458.

When writing presets sometimes it is desirable to include plugins as dependencies, since the preset may be explicitly for that dependency and that means one less thing users need to include and it offers an easy way to pin versions of a plugin with your preset. Unfortunately, the default `eslint` behavior is incapable of loading these local-style plugins for a couple of reasons:

 * `require` only resolves things relative to local eslint installation,
 * absolute paths are not supported,
 * developers don't want any code in `preset` definition files.

So with all those caveats in mind, the behavior has been altered to simply start the preset resolution process at the _caller_'s module (i.e. the preset) instead of the _callee_'s module (i.e. `eslint`).
@izaakschroeder izaakschroeder changed the title New: Enhanced local plugin resolution. New: Enhanced local plugin resolution. (fixes #3458) Dec 18, 2015
@lo1tuma
Copy link
Member

lo1tuma commented Dec 18, 2015

This doesn’t address the problem of version conflicts of the same plugin used in multiple shareable configs.

@nzakas nzakas added the do not merge This pull request should not be merged yet label Dec 18, 2015
@nzakas
Copy link
Member

nzakas commented Dec 18, 2015

Thanks @izaakschroeder. As @lo1tuma pointed out, if the problem was simply using different module resolution, we would have already made such a change. As it is, this change would only serve to confuse people in the case of multiple installed plugins with the same name. As such, we cannot merge this. Please see the original issue for details.

@gyandeeps
Copy link
Member

Closing based on the above feedback.
Feel free to reopen.

@gyandeeps gyandeeps closed this Jan 12, 2016
@izaakschroeder
Copy link
Author

Sorry for the delay; been a busy holiday. I will try and look into this more when I have time. You are right to raise those concerns and I'm not sure how best to approach them at the moment. Thanks for the feedback guys! 😄

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion do not merge This pull request should not be merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support having plugins as dependencies in shareable config
5 participants