-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix(dollar): consider \$ expression #58
base: main
Are you sure you want to change the base?
fix(dollar): consider \$ expression #58
Conversation
|
Agreed! I didn't yet find the time to check why that is |
hello guys, I see your point, let me also add some context about this change, so I was using minimatch package and combining it with https://www.npmjs.com/package/lodash.template, something like: export function applyContext(str: string, context?: object) {
if (context == null) return str
const t = template(str)
return t(context)
}
new Minimatch(applyContext('string ${user.id}', {user:{id:1}})).match('string 1');// true so right now it is possible to do this, so I was also seeing the minimatch code and found that this was also covered as a functionality, to ignore the ${} expressions in https://github.com/juliangruber/brace-expansion/blob/main/test/dollar.js |
Yeah, I think the change in this PR is valid, if brace-expansion is going to be avoiding expansions of And when I look closer at the history of that feature, I see my own name scattered around the history, so... that's disconcerting and weird. Because looking at this and thinking about it really has be thinking that Like.. wat??
I'm willing to bet someone somewhere is 100% depending on the current behavior, since this is used in minimatch, which is used in glob and ignore-walk, which is used in npm/cli. Which means removing the special handling of So my recommendation: land this PR, as a semver patch version. Then rip out the |
I guess one potential reason that the |
I you look at the dollar test, https://github.com/juliangruber/brace-expansion/blob/dd5a4cb21fe444c5c43f9a5d26ccba606e093107/test/dollar.js, we're relying on From https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html:
To me then the question is whether we want to stay true to bash expansion or make it potentially more useful for JS. Maybe we could also add an option for this, what do you think? |
Ahh, ok, I didn't realize it was part of the spec. That does make more sense, then. It's interesting that in bash at least, So, new tests to add:
|
I guess this kind of makes sense as
Are you sure we should add |
hi @juliangruber, I have to add |
If I do this in my terminal:
now in brace-expand it do not match, so this pr is trying to fix this behavior