Open OJFord opened 4 years ago
Will this work use additional_dependencies
?
- repo: https://github.com/prettier/pre-commit
rev: main
hooks:
- id: prettier
additional_dependencies:
- prettier-plugin-svelte:1.4.1
Hi. I am having the same issue. When I try to install @prettier/plugin-xml
, I get:
Executable `prettier` not found
My pre-commit config:
- repo: https://github.com/prettier/pre-commit
rev: v2.1.2
hooks:
- id: prettier
name: prettier + plugin-xml
additional_dependencies:
- "@prettier/plugin-xml@0.12.0"
args:
- --plugin=@prettier/plugin-xm
It works fine without the plugin.
I am trying to migrate from https://github.com/prettier/prettier to https://github.com/prettier/pre-commit
This should be fixed with the PRs mentioned above.
Seems like the problem was that, in https://github.com/prettier/pre-commit/blob/main/.pre-commit-hooks.yaml, hook is defining additional_dependencies
and args
, that are needed for prettier to work. However, if we need to define more in our hook, the will be rewritten.
Moving them to separate definitions should work.
In the meantime, another workaround is to copy the needed values:
- repo: https://github.com/prettier/pre-commit
rev: v2.1.2
hooks:
- id: prettier
name: prettier + plugin-xml
additional_dependencies:
- prettier@2.1.2
- "@prettier/plugin-xml@0.12.0"
args:
- --write
- --list-different
- --ignore-unknown
- --plugin=@prettier/plugin-xml
It's also possible to use plugins in config file
{
"plugins": [
"@prettier/plugin-xml",
"path/to/your/plugin"
]
}
I'm trying to use
prettier-plugin-svelte
, but I think it's detected from being installed rather than inpackage.json
(?) and so since there's no (good) way to put it in thepre-commit
environment, it isn't picked up?