I want to exclude only js
, jsx
, and vue
files, I imagine something like:
prettier --check --write --ignore-unknown "**/*.{!js,jsx,vue}"
I want to exclude only js
, jsx
, and vue
files, I imagine something like:
prettier --check --write --ignore-unknown "**/*.{!js,jsx,vue}"
As it's said in the Prettier CLI docs, Prettier uses fast-glob (which in turn uses micromatch) to resolve glob patterns. If you follow the links, you'll find multiple ways to achieve what you need.
You can use negative patterns:
or
or you can use a syntax called extglob:
There might be other solutions. fast-glob supports a lot of different things.
BTW, using
--write
and--check
at the same time isn't a supported use case. Whatever it does, don't rely on that, and choose one of the two instead, depending on what you want the command to do:--write
to format files--check
to check if files are formatted (commonly used on CI)