-
-
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
[New]: add no-relative-packages
#1860
[New]: add no-relative-packages
#1860
Conversation
Use this rule to prevent importing packages through relative paths. It's useful in Yarn/Lerna workspaces, were it's possible to import a sibling package using `../package` relative path, while direct `package` is the correct one. Co-authored-by: Rafal Lindemann <[email protected]> Co-authored-by: Tom Payne <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
3467f06
to
300a5b3
Compare
@ljharb is there anything I can do to get this over the line? |
300a5b3
to
273a9e9
Compare
@tapayne88 I tried this out from your branch and it improved my workflow dramatically. One recommendation: right now, the warning suggests importing from One wrinkle: in my case, I am not importing from the same location as the |
hey @wycats, thanks for the feedback! To be honest, the bulk of the work was originally done by @panrafal but I'll try set aside some time to look into your recommendation - it does sound closer to what we want. If I'm understanding your wrinkle correctly, I think node module resolution should use the |
@tapayne88 If it finds |
@ljharb what do you think of this PR? |
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.
Looks great! Went ahead and rebased, and refactored to use the new moduleVisitor
pattern.
e6533d2
to
6f5c52c
Compare
Duplicating #966 and hopefully fixed it 🤞 (sorry if this isn't the process).