Skip to content

Option to allow passing absolute file paths #354

Open
@Alexnortung

Description

@Alexnortung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions