Skip to content

Use --ignore-path for prettier to respect .prettierignore for package files#7998

Merged
pelikhan merged 2 commits intomain-9969beee31b5f93ffrom
copilot/update-prettier-ignore-config
Dec 28, 2025
Merged

Use --ignore-path for prettier to respect .prettierignore for package files#7998
pelikhan merged 2 commits intomain-9969beee31b5f93ffrom
copilot/update-prettier-ignore-config

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

The format:pkg-json and check:pkg-json npm scripts were manually excluding package.json and package-lock.json files via CLI negation patterns instead of leveraging the existing .prettierignore configuration.

Changes

  • Updated npm scripts to use --ignore-path ../../../.prettierignore flag
  • Removed redundant CLI exclusion patterns: '!../../../**/package.json' '!../../../**/package-lock.json'
  • Centralized ignore rules in .prettierignore rather than duplicating in multiple command definitions

Before:

"format:pkg-json": "npx prettier --write '../../../**/*.json' '!../../../pkg/workflow/js/**/*.json' '!../../../**/package.json' '!../../../**/package-lock.json'"

After:

"format:pkg-json": "npx prettier --write '../../../**/*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path ../../../.prettierignore"

This resolves the issue where prettier was attempting to format package manager files despite .prettierignore containing rules to exclude them. When running from a subdirectory, prettier requires an explicit --ignore-path to locate the root ignore file.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20556355729/job/59041081409#step:6:1

Use existing command to run prettier, it ignores package.JSON and package-lock.json


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

The format:pkg-json and check:pkg-json commands now use --ignore-path
to reference the root .prettierignore file, which already contains rules
to ignore package.json and package-lock.json files. This removes the
need for manual exclusion patterns in the npm scripts and ensures
consistency with the project's ignore configuration.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update prettier command to ignore package.json and package-lock.json Use --ignore-path for prettier to respect .prettierignore for package files Dec 28, 2025
Copilot AI requested a review from pelikhan December 28, 2025 16:46
@pelikhan pelikhan marked this pull request as ready for review December 28, 2025 16:49
@pelikhan pelikhan merged commit 2ac9486 into main-9969beee31b5f93f Dec 28, 2025
@pelikhan pelikhan deleted the copilot/update-prettier-ignore-config branch December 28, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants