Skip to content
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

Braces with a single value are not expanded #32

Closed
iiroj opened this issue Apr 15, 2021 · 4 comments
Closed

Braces with a single value are not expanded #32

iiroj opened this issue Apr 15, 2021 · 4 comments

Comments

@iiroj
Copy link

iiroj commented Apr 15, 2021

Hello,

I'm not sure if this is a feature or not, but braces containing only a single value do not get expanded properly.

Two values work fine:

❯ node -e "console.log(require('braces')('{x,y}', { expand:true }))"
[ 'x', 'y' ]

However, only a single value doesn't:

❯ node -e "console.log(require('braces')('{x}', { expand:true }))" 
[ '{x}' ]

I would expect it to instead return:

❯ node -e "console.log(require('braces')('{x}', { expand:true }))" 
[ 'x' ]
@jonschlinkert
Copy link
Member

jonschlinkert commented Apr 15, 2021

This is correct behavior, per bash. This is documented on the readme: https://github.com/micromatch/braces/blob/98414f9f1fabe021736e26836d8306d5de747e0d/README.md#escaping

Do:

$ echo a{a,b}
$ echo a{b}

@jonschlinkert
Copy link
Member

Closing since I think this is resolved. Please feel free to reopen if you think this needs to be discussed further.

@iiroj
Copy link
Author

iiroj commented Apr 16, 2021

Thanks! It makes sense. It's just a common misconfiguration issue with lint-staged, where users write globs like *.{jsx,tsx} and then also *.{json}. I think we just need to add something about it to the README. These are used for micromatch.

@jonschlinkert
Copy link
Member

jonschlinkert commented Apr 16, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants