Skip to content

Exclude package.json and package-lock.json from Prettier formatting#7942

Merged
pelikhan merged 3 commits intomainfrom
copilot/update-prettier-ignore-options
Dec 28, 2025
Merged

Exclude package.json and package-lock.json from Prettier formatting#7942
pelikhan merged 3 commits intomainfrom
copilot/update-prettier-ignore-options

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Package manager files should not be reformatted by Prettier to avoid interfering with package manager tooling and maintain their canonical format.

Changes

  • Created .prettierignore with patterns for package.json, package-lock.json, and other generated files
  • Updated npm scripts in actions/setup/js/package.json:
    • Added !../../../**/package.json and !../../../**/package-lock.json exclusions to format:pkg-json and check:pkg-json
    • Removed --ignore-path /dev/null to respect .prettierignore

Before/After

# Before: Formatted all JSON including package files
npx prettier --write '../../../**/*.json' --ignore-path /dev/null

# After: Excludes package manager files
npx prettier --write '../../../**/*.json' '!../../../**/package.json' '!../../../**/package-lock.json'

The dual approach (.prettierignore + explicit exclusions) ensures package files are protected both in general usage and in targeted npm scripts.

Original prompt

Update prettier formatting options to ignore/skip package.json and package-lock.json


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 28, 2025
Copilot AI and others added 2 commits December 28, 2025 03:28
…on files

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Prettier formatting options to skip package files Exclude package.json and package-lock.json from Prettier formatting Dec 28, 2025
Copilot AI requested a review from pelikhan December 28, 2025 03:33
@pelikhan pelikhan marked this pull request as ready for review December 28, 2025 03:36
@pelikhan pelikhan merged commit 3bb86ef into main Dec 28, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/update-prettier-ignore-options branch December 28, 2025 03:36
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