Skip to content

[cache issue] Prettier does not recheck files which used to be in .prettierignore #18016

Description

@HolgerJeromin

Prettier 3.6.2

I changed hundreds of files in a big feature branch (for es modules so I dropped namespace foo { indention).
To have easier rebase with main branch over month I added these files to .prettierignore.
This worked like a charm.

Now I am ready and I want to readd the files to my prettier workflow.
I deleted all entries in .prettierignore.
But prettier did not checked the "now new" files.

This is probably because they are marked as unchanged in prettier cache.

const command =
  `..\\node_modules\\.bin\\prettier.cmd --ignore-path ../.prettierignore` +
  ` --cache --cache-strategy metadata` +
  ` --cache-location ${solutionDir}/node_modules/.cache/prettier/.prettier-cache` +
  // project items
  ` .`;

Deleting the cache files solved the issue, but this was not obvious.

My suggestion would be to skip adding a file to the cache file which are in .prettierignore.
So when removing the files again, they are rechecked for sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliIssues with Prettier's Command Line Interface

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions