Be careful with Node file globbing vs bash globbing
There’s a common gotcha when using commandline tools that have their own file globbing, such as Prettier in Nodejs.
This command is supposed to run prettier against all the .ts
files in all
folders under src
recursively;
prettier --write src/**/*.ts
What actually happens though is that bash expands the src/**/*.ts
first, which
will only go one folder deep instead of the intended unlimited recursion.
The fix is simply to quote the globbing express so that bash passes it to prettier unscathed:
prettier --write 'src/**/*.ts'
It’s an easy mistake to make.