-
-
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
Correct module real path resolution #1696
Conversation
paztis
commented
Mar 24, 2020
- supports the monorepo correctly
- correct the no-extraneous-dependencies usage
…odule real path resolution add real support of isAbsolute (windows + unix support) importType refactoring: use the real resolved package path to check if external of internal, and not the name only like before: in case of monorepo, external modules are not under node_modules due to symlink but still out of the module. correct tests node_modules dependencies to really provide teh package.json like in real usage correct no-extraneous-dependencies rule: get the real name from the resolved package.json. If not aliased imports (alias/react for example) will not be correctly interpreted change path import add real support of isAbsolute (windows + unix support) correct no-extraneous-dependencies rule: get the real name from the resolved package.json. If not aliased imports (alias/react for example) will not be correctly interpreted even externals like "a/file.js" must not use extension. only module names like 'module.js' and '@scope/module.js' are allowed correct bad external definition: must be the folder path under the root of the module. Here the module root is test folder, not cycles folder
2 similar comments
Not sure to understand why, but I have this CI build that fails only on node v10: https://ci.appveyor.com/project/benmosher/eslint-plugin-import/builds/31684756/job/7lv7l952s32a8qx7 It crash on resolving the .babelrc of the webpack resolver. I don't change this part. Understand the issue ? Coverage decrease is because of the fallback on no-extraneous-dependencies we never pass in (it might never apperas in reality, but I keep it for security) |
resolvers/webpack/.babelrc
Outdated
../../.babelrc |
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 was a symlink; why did this file change?
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 file import was failing on ApVeillor in case of node v10.
I try to replace its content with
{
"extends": "../../.babelrc"
}
to avoid symling problem, but still present, so I rollback it.
I think the extension is a better way as the symlink for local development
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 change should still be reverted
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 know how to commit a sYmlinked file. can you do it after the merge ?
review changes applied |
Any new for the PR approval ? |
No news: start to be impossible to continue without thiese fixes |
any news ? |
+1 |
Looking forward to 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.
Sorry for the delay :-) i've reviewed this from scratch; apologies if you already answered some of these questions
resolvers/webpack/.babelrc
Outdated
../../.babelrc |
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 change should still be reverted
Hi I review all the changes. I've only problems with the babelrc file: I cannot commit the original symlink (don't know how to do it). Can you fix it on your side after the merge ? For the files/symlinked-module change, it is because my module resolution is now really looking at the root package path + folder name, and not only test if the folder name is in the path. Please tell me if there's missing things |
Hey guys, will this PR resolve #1832? I have the same problem with |
No, I think. It only verify the import path is correctly written. Not it the content of the import is good. |
@paztis Yeah we are migrating to TS so far, so it will take some time since the project is huge. I didn't get the last sentence of yours |
Sorry autocorrect from my phone.
We can do it with webpack or typescript I said.
In webpack there's an option to check the name import really exist in the
import file
Le ven. 31 juil. 2020 à 12:08, Shamanin Kirill <notifications@github.com> a
écrit :
… @paztis <https://github.com/paztis> Yeah we are migrating to TS so far,
so it will take some time since the project is huge. I didn't get the last
sentence of yours
We pack can do it potentially. What do you mean by that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1696 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIKMMNC26KBLPJHF4BTFJLR6KJZBANCNFSM4LSVAZOA>
.
|
@ljharb what is the review status now ? |
@paztis I found your fork on npm, but how can I actually use it? I added |
@paztis would you mind rebasing this on top of latest master (which will remove all merge commits) and ideally condense the commits? There's 34 right now. I can handle #1696 (comment) for you after that's done, and give it a fresh review. |
In fact the problem is Airbnb is pointing to original eslint-plugin-import,
which conflict with mine .
That's why I push to merge my changes.
To use it, the only way I found is to use symlinks in my local environment:
I symlink original one to mine.
Le mar. 25 août 2020 à 08:47, Jordan Harband <notifications@github.com> a
écrit :
… @paztis <https://github.com/paztis> would you mind rebasing this on top
of latest master (which will remove all merge commits) and ideally condense
the commits? There's 34 right now.
I can handle #1696 (comment)
<#1696 (comment)>
for you after that's done, and give it a fresh review.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1696 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIKMMJCMELSI66K27ETSO3SCNM7NANCNFSM4LSVAZOA>
.
|
@ljharb rebase on top of master is done now. I've verify the final content is exactly the same as on my old branch. |
so excited for this! thank you all so much 🙏 |
Me too ^^ |
@paztis thanks! I've rebased this PR. I've split out the Also, the second commit is quite large, so it's hard to me to understand everything it's doing. Can any parts of it be split into separate commits, that could land "first" - before the primary fix in the PR? |
For the extension, you were testing only the name not the real path.
If an alias exist for this name, potentially it is not an external.
Is package value was potentially incorrect, then
isUseOfExtensionRequired(extension, package)
Will fail
I just fix the usage of is external module because the last parameters was
missing.
For the second commit, tell me which point you want to check.
Le sam. 5 sept. 2020 à 23:18, Jordan Harband <notifications@github.com> a
écrit :
… @paztis <https://github.com/paztis> thanks! I've rebased this PR.
I've split out the isExternalModule bugfix into its own commit. That
commit includes a test for order that fails without the fix, but i can't
come up with a test for extensions that fails without the fix. Got any
ideas?
Also, the second commit is quite large, so it's hard to me to understand
everything it's doing. Can any parts of it be split into separate commits,
that could land "first" - before the primary fix in the PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1696 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIKMMPAHEG7762HLSNGV3DSEKTLBANCNFSM4LSVAZOA>
.
|
@ljharb, any news ? |
I don't know in fact. I'm still waiting the approval for the merge. |
thanks for merging this! @ljharb any idea when a new version will be published to npm? |