feat(eslint-plugin): add rule for restricting asset imports#3989
feat(eslint-plugin): add rule for restricting asset imports#3989
Conversation
ca5f2d6 to
a0f104d
Compare
3f618c5 to
bfae9b5
Compare
| * @param {string} relativeTo | ||
| * @returns {string | undefined} | ||
| */ | ||
| function realpath(p, relativeTo, fs = nodefs) { |
There was a problem hiding this comment.
This would be good to put in tools-filesystem as it is one of these subtle issues that isn't obvious.
Also, I believe on Windows you can call fs.realpath.native(), though this routine is still necessary on macOS.
There was a problem hiding this comment.
From what I've read, fs.realpath.native() has the side effect of resolving symlinks. I don't think it's what we want in this case.
I can move this tool but we'll have to come up with a different name. The real realpath is supposed to return the canonicalized absolute pathname. And I'm not sure it fits as is because it only looks at the basename part. To be entirely accurate, it would have to look at all the directories leading up to the file as well. We've shortcut it here because I assume it's not necessary. @dannyvv correct me if I'm wrong.
Edit: Moved to tools-filesystem as realname.
Edit 2: Moved back because it created a circular dependency.
bfae9b5 to
31e89c8
Compare
31e89c8 to
25e6147
Compare
d150668 to
97a84d6
Compare
97a84d6 to
3ac4780
Compare
Description
Added a rule for restricting asset imports.
Test plan
CI should pass.