[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 <rl@stamina.pl> Co-authored-by: Tom Payne <tom@tompayne.dev> Co-authored-by: Jordan Harband <ljharb@gmail.com>
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? |
ljharb
left a comment
There was a problem hiding this comment.
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).