Interpret leading slashes relative to package - #180
Merged
Merged
Conversation
aomarks
requested review from
AndrewJakubowicz,
augustjk,
justinfagnani and
rictic
May 4, 2022 16:39
augustjk
approved these changes
May 4, 2022
rictic
approved these changes
May 4, 2022
| patterns: ['\\{foo,bar\\}'], | ||
| expected: ['{foo,bar}'], | ||
| })); | ||
|
|
Member
There was a problem hiding this comment.
No one should write this, but how do we interpret /./foo or /../bar? Probably worth a test to make sure what we do is sensible
Member
Author
There was a problem hiding this comment.
We remove the leading /, which I think is correct.
Added tests.
|
Failing Windows test - on Node 14 |
Member
Author
Fixed |
rictic
approved these changes
May 4, 2022
Member
Author
Actually not fixed, it's inconsistent on Windows between 14 and 16. But it's an inconsistency between |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, a glob pattern like
/foowas resolved tofooin the root of the filesystem, which is the usual behavior for a file path.However, that's a footgun because what a user almost certainly means by that is
fooin the package directory.So we now ignore the leading
/. In the case offiles, we still allow reaching out of the directory using e.g.../foo.This new behavior also matches the behavior of the npm
filesarray (apart from the../support, whichfilessimply ignores).Also fixed a duplicate
lintscript inpackage.json.Fixes #173