Skip to content

fix(reusable-lint): pin prettier to the repo-root config - #59

Merged
bryanfawcett merged 1 commit into
mainfrom
ci/prettier-explicit-config
Sep 11, 2026
Merged

fix(reusable-lint): pin prettier to the repo-root config#59
bryanfawcett merged 1 commit into
mainfrom
ci/prettier-explicit-config

Conversation

@bryanfawcett

Copy link
Copy Markdown
Contributor

A nested .prettierrc that names a plugin kills the whole prettier job.

The bug, found in production

nyuchi-identity's apps/auth-ui is a SvelteKit app with its own auto-discovered .prettierrc declaring prettier-plugin-svelte and prettier-plugin-tailwindcss. The gate installs prettier globally and never runs npm ci, so walking into that directory kills the entire job, not just that subtree:

[error] Cannot find package 'prettier-plugin-svelte' imported from <repo>/noop.js

Any monorepo with a per-app prettier config naming a plugin does the same.

Why no in-repo fix was acceptable

option why not
delete apps/auth-ui/.prettierrc breaks the app's own formatting — without the svelte plugin prettier cannot parse a .svelte file at all
add apps/auth-ui/ to .prettierignore narrows the gate, which is the thing we are eliminating
leave both live trap — the app's own prettier --write . re-tabs package.json and turns the org check red next time anyone formats

The fix

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 cannot redefine the org gate from a subdirectory.

A missing root .prettierrc is now a loud error naming the fix, rather than prettier silently falling back to defaults.

Proven both ways

case before after
nested config naming a missing plugin [error] Cannot find package 'prettier-plugin-svelte', whole job dies clean
badly formatted apps/auth-ui/README.md still caught — gate is not narrowed
missing root .prettierrc silent fallback to defaults loud error, exit 1

Unblocks nyuchi/nyuchi-identity#14.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

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>
@bryanfawcett
bryanfawcett merged commit c19b3ab into main Sep 11, 2026
7 checks passed
@bryanfawcett
bryanfawcett deleted the ci/prettier-explicit-config branch September 11, 2026 19:04
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.

1 participant