fix(reusable-lint): pin prettier to the repo-root config - #59
Merged
Conversation
A nested .prettierrc that names a plugin kills the whole prettier job.
nyuchi-identity's apps/auth-ui is a SvelteKit app with its own
auto-discovered .prettierrc declaring prettier-plugin-svelte and
prettier-plugin-tailwindcss. This job installs prettier globally and
never runs `npm ci`, so when prettier walks into that directory and
resolves the nested config, plugin loading fails and the ENTIRE job dies
- not just that subtree:
[error] Cannot find package 'prettier-plugin-svelte' imported from
<repo>/noop.js
Every option available inside the repo was bad. Deleting the nested
config breaks the app's own formatting - without the svelte plugin
prettier cannot parse a .svelte file at all. Adding apps/auth-ui/ to
.prettierignore narrows the gate, which is the thing we are trying to
stop. Leaving both is a live trap: the app's own `prettier --write .`
re-tabs package.json and turns the org check red the next time anyone
formats.
So pass --config .prettierrc, exactly symmetric with the --ignore-path
argument already there and for the same reason: this job must use the
ORG's settings, not whatever it auto-discovers walking the tree. A
sub-app keeps its own .prettierrc for its own scripts and editors; it
just does not get to redefine the org gate from a subdirectory. And it
means one markdown/JSON dialect per repo, which is the point.
This does NOT narrow the gate - files under the sub-app are still
checked, now against the org config. Verified: apps/auth-ui/README.md
badly formatted is still reported.
A missing root .prettierrc is now a loud error naming the fix, rather
than prettier silently falling back to defaults.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A nested
.prettierrcthat names a plugin kills the whole prettier job.The bug, found in production
nyuchi-identity'sapps/auth-uiis a SvelteKit app with its own auto-discovered.prettierrcdeclaringprettier-plugin-svelteandprettier-plugin-tailwindcss. The gate installs prettier globally and never runsnpm ci, so walking into that directory kills the entire job, not just that subtree:Any monorepo with a per-app prettier config naming a plugin does the same.
Why no in-repo fix was acceptable
apps/auth-ui/.prettierrc.sveltefile at allapps/auth-ui/to.prettierignoreprettier --write .re-tabspackage.jsonand turns the org check red next time anyone formatsThe fix
Pass
--config .prettierrc, exactly symmetric with the--ignore-pathargument already there and for the same reason: this job must use the org's settings, not whatever it auto-discovers walking the tree. A sub-app keeps its own.prettierrcfor its own scripts and editors; it just cannot redefine the org gate from a subdirectory.A missing root
.prettierrcis now a loud error naming the fix, rather than prettier silently falling back to defaults.Proven both ways
[error] Cannot find package 'prettier-plugin-svelte', whole job diesapps/auth-ui/README.md.prettierrcUnblocks nyuchi/nyuchi-identity#14.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com