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

Adds ability to support array of alias values. #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DanHulton
Copy link

As of webpack 5, aliases can have an array of potential resolution paths, with the first entry in the array that resolves successfully being used. This allows users to define "fallback" paths to check.

However, this then breaks eslint, since it doesn't know what to do with a map, and simply picking one path or the other to default to could break under certain circumstances.

This patch allows aliases to have an array as their second parameter, which behave the same way that array paths in webpack do.

@coveralls
Copy link

coveralls commented Mar 1, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 16175ec on DanHulton:alias_array into a69b482 on johvin:master.

@VdeVentura
Copy link

@johvin any chance we can take a look at this PR? I could make use of it :)

@VdeVentura
Copy link

@DanHulton, any chance of releasing this fork as a different NPM package? (if u didn't do it already)

@DanHulton
Copy link
Author

@DanHulton, any chance of releasing this fork as a different NPM package? (if u didn't do it already)

I may have to. I've been using a link directly to my branch in git ("eslint-import-resolver-alias": "DanHulton/eslint-import-resolver-alias#alias_array") in the meantime, but the repo owner hasn't committed anything publicly since Feb, so they might be away for a while. If I do, I'll update this PR with a link.

@VdeVentura
Copy link

I started doing the same today 🙊

@DanHulton
Copy link
Author

For now, I have published my fork of this package as eslint-import-resolver-alias-array to make it easier for people to use this code. I'll happily deprecate it once this PR is resolved.

@shaozj
Copy link

shaozj commented Feb 21, 2022

why not accept this pr,it's very useful!

@nickrobillard
Copy link

I would like to add that I am also using this PR in the form the eslint-import-resolver-alias-array NPM package and it is working exactly as expected. I will report issues here if I find them. Thank you @DanHulton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants