-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
FR: Walk directories in leaf -> root order #4036
Comments
Please provide a way to reproduce the problem you are encountering. There are many reasons why I ask for a way to reproduce the problem, including:
For example, one thing I don't understand: there's some option called Marking this issue as |
Thanks for the prompt & thoughtful response! I'll put together a repro, but it might take a bit of time.
Well, yes and no. The enforcement is that violations fail the build -- not that processes cannot read outside of their source roots. I had a non-public discussion about changing this behavior with the BuildXL team, but I'll convert that discussion into a public FR on the BuildXL side of things, too.
From my perspective, neither product has an issue -- it's just that they have features which don't mesh well when used together. So, I have FRs out for both projects 😄 |
Problem
During the build process, esbuild walks the directory hierarchy, looking for
package.json
files along the way (in resolver.go). For reasons explained below, there are two problems with the current arrangement:/Volumes/src/my-project/my-package
, then it'll read:/package.json
(if it exists)/Volumes/package.json
(if it exists)/Volumes/src/package.json
(if it exists)/Volumes/src/my-project/package.json
(if it exists)/Volumes/src/my-project/my-package/package.json
(if it exists)root: true
configuration optionThis setup creates a problem for us. Our project exists within a monorepo, and we're building with BuildXL. We're working to enable the
enforceSourceReadsUnderPackageRoots
configuration option build flag, which prevents processes from reading outside of their declared dependency tree.Proposal
The proposal is to invert the logic: read from the leaf down. Along the way, the process could be aborted with a similar mechanism to indicate "this is the root, please stop traversing" to ESLint.
This pattern has other precedence in configuration of other projects in the JS ecosystem.
Workarounds
Our current workaround is to add our top-level
package.json
to the allow-list of files which can be read outside of the declared dependencies. This is suboptimal, since it opens up the window for other processes to read the file when they shouldn't.The text was updated successfully, but these errors were encountered: