Skip to content

Fixed editors auto-reformatting Koenig files on save - #29181

Merged
kevinansfield merged 1 commit into
mainfrom
fix-koenig-editor-reformatting
Jul 8, 2026
Merged

Fixed editors auto-reformatting Koenig files on save#29181
kevinansfield merged 1 commit into
mainfrom
fix-koenig-editor-reformatting

Conversation

@kevinansfield

Copy link
Copy Markdown
Member

no ref

Since the Koenig monorepo merge, editing a file under koenig/ in Zed rewrites the whole file on save (prettier defaults: double quotes, added brace spacing, trailing commas, 80-col wrapping), polluting PRs with unrelated changes. Other directories in the repo are unaffected, and the Koenig code itself is fine — the whole tree already passes ESLint's autofix with zero changes under the same eslint-plugin-ghost style Ghost uses.

The trigger is that kg-default-nodes, kg-lexical-html-renderer, and koenig-lexical are the only packages in the repo with prettier as a devDependency (used purely to normalise HTML strings in test assertions). Zed enables prettier formatting per-package when it finds a prettier dependency, and with no prettier config anywhere it formats with prettier defaults.

  • Added a catch-all .prettierignore to each of the three packages so editor-driven prettier formatting is switched off exactly where the test-only dependency exists (respected by Zed, monorepo-aware, takes precedence over any root config). The tests are unaffected as they call the prettier API directly with explicit options.
  • Added ./koenig/*/ to eslint.workingDirectories in .vscode/settings.json so the VS Code ESLint extension treats Koenig packages as separate working directories, matching the old Koenig repo's ./packages/*/ setting and the existing apps/*/ghost/* entries.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74335ec2-f187-4536-8125-19d715c0f841

📥 Commits

Reviewing files that changed from the base of the PR and between 8d157f9 and 5f58f3f.

📒 Files selected for processing (4)
  • .vscode/settings.json
  • koenig/kg-default-nodes/.prettierignore
  • koenig/kg-lexical-html-renderer/.prettierignore
  • koenig/koenig-lexical/.prettierignore
✅ Files skipped from review due to trivial changes (3)
  • koenig/kg-default-nodes/.prettierignore
  • koenig/kg-lexical-html-renderer/.prettierignore
  • .vscode/settings.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • koenig/koenig-lexical/.prettierignore

Walkthrough

This pull request updates linting and formatting configuration. .vscode/settings.json adds a new eslint.workingDirectories entry for ./koenig/*/. Three .prettierignore files in kg-default-nodes, kg-lexical-html-renderer, and koenig-lexical each add a * rule, making Prettier ignore all files in those directories.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preventing editor auto-reformatting in Koenig files.
Description check ✅ Passed The description directly matches the changes by explaining the Prettier ignore files and ESLint working directory update.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-koenig-editor-reformatting

Comment @coderabbitai help to get the list of available commands.

no ref

- kg-default-nodes, kg-lexical-html-renderer, and koenig-lexical carry prettier as a devDependency purely for normalising HTML strings in test assertions
- Zed enables prettier formatting per-package when it finds a prettier dependency, and with no prettier config in the repo it applies prettier defaults, rewriting whole files on save and polluting PRs with unrelated changes
- a catch-all .prettierignore in each package switches off editor-driven prettier formatting without affecting the tests, which call the prettier API directly with explicit options
- also added ./koenig/*/ to eslint.workingDirectories so the VS Code ESLint extension treats Koenig packages as separate working directories, matching the old Koenig repo's ./packages/*/ setting
@kevinansfield
kevinansfield force-pushed the fix-koenig-editor-reformatting branch from 8d157f9 to 5f58f3f Compare July 8, 2026 16:19
@nx-cloud

nx-cloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 5f58f3f

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 10m 44s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 2m 41s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗
nx run-many -t test:unit -p @tryghost/kg-defaul... ✅ Succeeded 6m 21s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 53s View ↗
nx run @tryghost/admin:build ✅ Succeeded 3m 20s View ↗
nx run ghost:test:legacy ✅ Succeeded 3m 3s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 45s View ↗
Additional runs (6) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-08 16:32:34 UTC

@kevinansfield
kevinansfield enabled auto-merge (squash) July 8, 2026 16:23
@kevinansfield
kevinansfield merged commit f0de650 into main Jul 8, 2026
46 checks passed
@kevinansfield
kevinansfield deleted the fix-koenig-editor-reformatting branch July 8, 2026 16: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.

1 participant