You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot get consistent glob behaviour across operating systems. I want to pass a glob, and not have the shell expand it.
What stylelint configuration is needed to reproduce the bug?
I can do this, as a script in package.json:
"lint": "stylelint src/**/*.css",
Which will appear to work, but silently misses a lot of files on Linux/macOS because that glob is expanded by the shell and ** is treated as *. But it works on Windows.
I can try using single quotes around the glob:
"lint": "stylelint 'src/**/*.css'",
Now it works on Linux/macOS, but fails on Windows because the actual string, with quote marks, is passed to stylelint, so argv looks like [ "'src/**/*.css'" ].
And I can't use double quotes because actually I'm running this with concurrently so double quotes would look like this, and then they get removed and I'm back to the shell expanding the glob incorrectly on Linux.
Cannot get consistent glob behaviour across operating systems. I want to pass a glob, and not have the shell expand it.
I can do this, as a script in
package.json
:Which will appear to work, but silently misses a lot of files on Linux/macOS because that glob is expanded by the shell and
**
is treated as*
. But it works on Windows.I can try using single quotes around the glob:
Now it works on Linux/macOS, but fails on Windows because the actual string, with quote marks, is passed to stylelint, so
argv
looks like[ "'src/**/*.css'" ]
.And I can't use double quotes because actually I'm running this with
concurrently
so double quotes would look like this, and then they get removed and I'm back to the shell expanding the glob incorrectly on Linux.I can use a glob pattern that the shell doesn't recognise, and this is the only thing that behaves the same cross-OS.
But that's pretty nasty.
The cheap fix would be to check for file input strings that start and end in a single quote and remove the quote characters.
What do other people do, this seems like the sort of thing most people must face. Am I doing something dumb?
13.8.0
npm script in
package.json
, withconcurrently
.No
Consistent behaviour across macOS, Linux, and Windows. Or words in the docs explaining how to work around it.
As above
I'm aware of these issues #4521 but couldn't see anything specifically about this issue.
The text was updated successfully, but these errors were encountered: