-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
closes #1293. allows aliases that start with @ to be caught as internal #1294
Conversation
91a439c
to
3343898
Compare
4 similar comments
src/core/importType.js
Outdated
function baseModule(name) { | ||
if (isScoped(name)) { | ||
function baseModule(name, path) { | ||
if (isScoped(name, path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it makes sense to make isScoped
check isExternalPath
; i think all the places currently calling isScoped
should be explicitly handling isExternalPath
first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that. It does seem that "scoped" packages have a connotation meaning "external". So I thought it would be fine putting it in isScoped
because scoped modules have to be external. Will update shortly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually... I don't even know how to solve this? Move the isScoped
check down underneath isInternalModule
in the lodash.cond call? The problem I am seeing is that isScoped means external, but isExternalModule doesn't check it. It is checked by the lodash.cond call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like moving the internal check above scoped and external solved that problem and let me revert most of the other changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scoped packages are the same as anything in node_modules; they're things installed from npm. I don't think "scoped" means "external".
@ljharb updated per your comments. Appreciate you looking at this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good; it'll have to wait tho until master gets unbroken.
@ljharb anything I can do to help unbreak master? |
@jeffshaver open another PR that fixes the tests? :-D |
@ljharb. I'll take a look later today to see if I can fix some |
@ljharb since my other pr got merged (thanks! sorry we couldn't fix that one test), i rebased my branch with upstream master. just wanted to let you know |
@jeffshaver oh we fixed it! thanks for the PR, and the ping. |
[isExternalModule, constant('external')], | ||
[isScoped, constant('external')], | ||
[isInternalModule, constant('internal')], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but there is the possibility this will be a breaking change - however, since it doesn't break any tests, and since it's unlikely anyone is depending on the inability to mark an external module as "internal", it's probably fine.
@ljharb appreciate it! When do you think a new version will be released with these changes? |
Probably not super quickly; ping me again in a week if it’s not done by then. |
Have the PR been released? My '@' alias imports are still 'unknown' type with the latest eslint-plugin-import. |
@ljharb as we talked about in the issue, here is the fix. Please let me know if there are any issues. Or if you think we need more tests for this case. I added one. There were already a ton that didn't pass and didn't think I should fix them in this PR.
Fixes #1293. Unblocked by #1295.