Skip to content

Respect Both .gitignore and .prettierignore FilesΒ #3894

@GoodbyeNJN

Description

@GoodbyeNJN

Preflight Checklist

  • I have searched existing issues and this is not a duplicate
  • This is a feature for the VS Code extension, not for Prettier's formatting behavior

Problem Description

When using this extension to format code, it only respects patterns in the .prettierignore file and ignores patterns from .gitignore. While you can specify an ignore file via the prettier.ignorePath setting, this doesn't allow both files to be considered simultaneously.

Proposed Solution

By default, respect patterns from both .gitignore and .prettierignore files. When patterns exist in both files, they should both be applied.

Alternatives Considered

Update the prettier.ignorePath setting to support multiple ignore file paths, for example:

{
    "prettier.ignorePath": [".gitignore", ".prettierignore"]
}

Additional Context

Since Prettier v3.0.0, it has respected both .gitignore and .prettierignore files by default (reference). However, this extension has only respected .prettierignore, creating an inconsistency in behavior. With the extension moving toward v12, this is a good opportunity to align it with Prettier's default behavior.

Related issue: #3361 and #3063

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