Skip to content

Have Format On Save recognize .prettierignore within workspace/project subfolders #3465

Open
@cwhitemaddox

Description

@cwhitemaddox

Right now, with the prettier-vscode extension installed, the extension will recognize a .prettierignore file that is on the root of the vscode workspace/project, but it will not recognize any .prettierignore files that are within folders in that vscode workspace.

It would be helpful to have the prettier-vscode extension recognize and honor the .prettierignore files that are within folders in a vscode workspace. This is especially helpful in a monorepo context, where different folders of the monorepo can have different package.jsons and different .prettierignore files.

If, for example, you have a folder structure in a workspace like so:

codebase-1/
  package.json
  .prettierignore
  src/
    first-script.ts
    first-file-to-ignore.ts
codebase-2/
  package.json
  .prettierignore
  src/
    second-script.ts
    second-file-to-ignore.ts

And the contents of codebase-1/.prettierignore are:

src/first-file-to-ignore.ts

With the vscode workspace opened on code structure above, opening codebase-1/src/first-file-to-ignore.ts and saving the file (with Format On Save enabled), prettier-vscode will format the file and disregard codebase-1/.prettierignore.


Edits:

  • 2025-02-21: I confirmed on my setup re: the comment below that this issue appears to only affect .prettierignore files and not .prettierrc files in subfolders. Updated the copy above to reflect that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions