Option to allow passing absolute file paths
Alexnortung opened this issue · comments
currently we have the pass_filenames
, but in certain cases it would be nice if the passed file names could be absolute paths.
Use case:
We have a monorepo with multiple projects that use prettier. If we use the predefined prettier hook, then it would not recognize the plugins that have been enabled prettier since they are installed in the node_modules folder in a nested folder.
So I tried creating a custom hook, but then the file names would be something like project/file-to-format
instead of just file-to-format
or /absolute/path/project/file-to-format
.
pre-commit.hooks = {
# prettier.enable = true;
prettier-nextjs = {
enable = true;
name = "Prettier Next.js";
files = "nextjs\/*";
entry = "${pnpm}/bin/pnpm --dir nextjs exec prettier --write";
};
};
In my case if the files could have an absolute path instead of a relative one it would solve my issue.
Upstream issue: pre-commit/pre-commit#2621