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

import/no-cycle ignoreExternal does not work for external scoped modules #2258

Closed
johgoe opened this issue Oct 12, 2021 · 4 comments · Fixed by #2282
Closed

import/no-cycle ignoreExternal does not work for external scoped modules #2258

johgoe opened this issue Oct 12, 2021 · 4 comments · Fixed by #2282

Comments

@johgoe
Copy link

johgoe commented Oct 12, 2021

A module with name @babel/core seems not to be a external module for the rule

"import/no-cycle": [2, {  ignoreExternal: true   }

Reason seems to be

return isModule(name) && isExternalPath(name, settings, path, getContextPackagePath(context));
which is checking isModule(name) && isExternalPath(name, settings, path, getContextPackagePath(context));

instead of

(isModule(name) || isScopedModule(name)) && isExternalPath(name, settings, path, getContextPackagePath(context));

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

Can you help provide a test case?

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

I'm also a bit confused why importType has both isScoped and isScopedModule :-) it kind of seems like isScoped is the more robust one.

johgoe pushed a commit to johgoe/eslint-plugin-import-2258 that referenced this issue Oct 13, 2021
@johgoe
Copy link
Author

johgoe commented Oct 13, 2021

@ljharb I prepared a small sample project in which @apollo/client is not recognized as external module

My sample project is https://github.com/johgoe/eslint-plugin-import-2258

mx-bernhard added a commit to mx-bernhard/eslint-plugin-import that referenced this issue Oct 29, 2021
@johgoe
Copy link
Author

johgoe commented Oct 29, 2021

@ljharb #2282 will fix this issue.

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

Successfully merging a pull request may close this issue.

2 participants