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

closes #1293. allows aliases that start with @ to be caught as internal #1294

Merged
merged 1 commit into from
Mar 3, 2019

Conversation

jeffshaver
Copy link
Contributor

@jeffshaver jeffshaver commented Feb 21, 2019

@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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 93.651% when pulling 91a439c on jeffshaver:master into bdc05aa on benmosher:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 93.651% when pulling 91a439c on jeffshaver:master into bdc05aa on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 93.651% when pulling 91a439c on jeffshaver:master into bdc05aa on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 93.651% when pulling 91a439c on jeffshaver:master into bdc05aa on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 93.651% when pulling 91a439c on jeffshaver:master into bdc05aa on benmosher:master.

@coveralls
Copy link

coveralls commented Feb 21, 2019

Coverage Status

Coverage increased (+3.2%) to 97.317% when pulling 651829d on jeffshaver:master into e9544f8 on benmosher:master.

function baseModule(name) {
if (isScoped(name)) {
function baseModule(name, path) {
if (isScoped(name, path)) {
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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 isInternalModulein 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

Copy link
Contributor Author

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

Copy link
Member

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".

@jeffshaver
Copy link
Contributor Author

@ljharb updated per your comments. Appreciate you looking at this!

Copy link
Member

@ljharb ljharb left a 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.

@jeffshaver
Copy link
Contributor Author

@ljharb anything I can do to help unbreak master?

@ljharb
Copy link
Member

ljharb commented Feb 24, 2019

@jeffshaver open another PR that fixes the tests? :-D

@jeffshaver
Copy link
Contributor Author

@ljharb. I'll take a look later today to see if I can fix some

@jeffshaver
Copy link
Contributor Author

@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

@ljharb
Copy link
Member

ljharb commented Mar 3, 2019

@jeffshaver oh we fixed it! thanks for the PR, and the ping.

[isExternalModule, constant('external')],
[isScoped, constant('external')],
[isInternalModule, constant('internal')],
Copy link
Member

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 ljharb merged commit 651829d into import-js:master Mar 3, 2019
@jeffshaver
Copy link
Contributor Author

@ljharb appreciate it! When do you think a new version will be released with these changes?

@ljharb
Copy link
Member

ljharb commented Mar 3, 2019

Probably not super quickly; ping me again in a week if it’s not done by then.

@laozhu
Copy link

laozhu commented Jul 16, 2019

Have the PR been released? My '@' alias imports are still 'unknown' type with the latest eslint-plugin-import.

@ljharb
Copy link
Member

ljharb commented Jul 16, 2019

@laozhu yes, if you click on the commit 651829d you can see it's in 2.17.0 and higher.

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

Successfully merging this pull request may close these issues.

[import/order] Aliases that start with @ get incorrectly grouped
5 participants