Prettier-Eslint-Cli Does Not Format Anything in Powershell

prettier-eslint and prettier-stylelint work inside bash and zsh, not in powershell or cmd

Long story short, I’ve set up eslint and stylelint for one project weeks back and everything ran perfectly on MACs, until we ran it inside powershell and cmd, it output nothing. It almost felt like no file is to be formatted.

Scripts we had inside package.json

1
2
3
4
"scripts": {
"fix-style": "prettier-stylelint --write 'src/**/*.{css,scss}' ",
"fix-code": "prettier-eslint --write 'src/**/*.{js,jsx}' "
}

After a couple hours of research, I accidentally saw this code on prettier-eslint-cli, and I gave it a go. It worked..

1
2
3
"scripts": {
"format": "prettier-eslint \"src/**/*.js\""
}

Turns out, nothing wrong with dependencies, neither plugins in vscode. It just in powershell, double quote and single quote have different functions. Still not 100% sure, but it is very likely to relate to this topic

To fix this issue, we simply updated the script to

1
2
"fix-style": "prettier-stylelint --write \"src/**/*.{css,scss}\" ",
"fix-code": "prettier-eslint --write \"src/**/*.{js,jsx}\" "