Skip to content

fix(version): skip config resolution in prettier getFileInfo check#4306

Merged
JamesHenry merged 1 commit intolerna:mainfrom
AI-JamesHenry-Org:4238
Mar 12, 2026
Merged

fix(version): skip config resolution in prettier getFileInfo check#4306
JamesHenry merged 1 commit intolerna:mainfrom
AI-JamesHenry-Org:4238

Conversation

@AI-JamesHenry
Copy link
Copy Markdown
Collaborator

@AI-JamesHenry AI-JamesHenry commented Mar 12, 2026

Note

🤖 This PR was created by @AI-JamesHenry, an AI assistant account guided and overseen by @JamesHenry.

Summary

  • Pass resolveConfig: false to prettier.getFileInfo() in git-add.ts to prevent unnecessary plugin resolution when checking if a file is ignored
  • Fixes monorepo setups where a nested project has a prettier plugin (e.g., prettier-plugin-tailwindcss) not installed at the root, which caused lerna version to fail with Cannot find package
  • The full config is already resolved separately via resolveConfig() for the actual formatting step, so this change has no effect on formatting behavior

Fixes #4238

Test plan

  • All 195 version command unit tests pass
  • Full test suite passes (npm run test)
  • Lint passes (npm run lint)
  • Format check passes (npm run format:check)
  • Build passes (nx run-many -t build)
  • CI passes on this PR

When checking if a file is ignored by prettier, getFileInfo() was called
without resolveConfig: false, causing prettier to load the full config
including plugins. In monorepos where a nested project has a prettier
plugin not installed at the root, this throws "Cannot find package".

Since getFileInfo() is only used here to check the ignored status, and
the full config is already resolved separately via resolveConfig() for
the actual formatting step, passing resolveConfig: false avoids
unnecessary plugin resolution.

Fixes lerna#4238
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 12, 2026

View your CI Pipeline Execution ↗ for commit b917254

Command Status Duration Result
nx run-many --t e2e --parallel=1 ✅ Succeeded 11m 7s View ↗
nx run-many -t test --parallel=3 --ci --maxWork... ✅ Succeeded 1m 1s View ↗
nx run-many -t build --parallel=3 ✅ Succeeded 15s View ↗
nx run-many -t lint --parallel=3 ✅ Succeeded 13s View ↗
nx run integration:integration --ci --maxWorkers=2 ✅ Succeeded 12s View ↗
nx-cloud record -- npx nx format:check ✅ Succeeded 2s View ↗
nx run-many -t build ✅ Succeeded 1s View ↗
nx run-many -t test --parallel=3 --ci --maxWork... ✅ Succeeded 3m 48s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-12 11:31:05 UTC

@JamesHenry JamesHenry marked this pull request as ready for review March 12, 2026 11:50
@JamesHenry JamesHenry merged commit ae53efe into lerna:main Mar 12, 2026
15 checks passed
@JamesHenry JamesHenry deleted the 4238 branch March 12, 2026 11:51
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.

[monorepo] Formatting (prettier) fails when root package doesn't include a plugin in a nested project

2 participants