From 827a2569332fd3a4c77b663814ee9e4643f9d592 Mon Sep 17 00:00:00 2001 From: Boshen Date: Tue, 16 Dec 2025 03:23:43 +0000 Subject: [PATCH] fix(oxfmt): place ignorePatterns at bottom of JSON in --migrate prettier (#16926) --- apps/oxfmt/src-js/migration/migrate-prettier.ts | 6 ++++-- apps/oxfmt/src-js/migration/shared.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/oxfmt/src-js/migration/migrate-prettier.ts b/apps/oxfmt/src-js/migration/migrate-prettier.ts index 34155b3244969..8f411738c79e0 100644 --- a/apps/oxfmt/src-js/migration/migrate-prettier.ts +++ b/apps/oxfmt/src-js/migration/migrate-prettier.ts @@ -106,10 +106,12 @@ export async function runMigratePrettier() { // Migrate `ignorePatterns` from `.prettierignore` const ignores = await resolvePrettierIgnore(cwd); - if (0 < ignores.length) { - oxfmtrc.ignorePatterns = ignores; + if (ignores.length > 0) { console.log("Migrated ignore patterns from `.prettierignore`"); } + // Keep ignorePatterns at the bottom + delete oxfmtrc.ignorePatterns; + oxfmtrc.ignorePatterns = ignores; const jsonStr = JSON.stringify(oxfmtrc, null, 2); diff --git a/apps/oxfmt/src-js/migration/shared.ts b/apps/oxfmt/src-js/migration/shared.ts index 5644f24dec58f..04276338eb040 100644 --- a/apps/oxfmt/src-js/migration/shared.ts +++ b/apps/oxfmt/src-js/migration/shared.ts @@ -17,7 +17,7 @@ export async function createBlankOxfmtrcFile(cwd: string) { const config: Record = { // Add `$schema` field at the top if schema file exists in `node_modules` $schema: schemaPath, - // `ignorePatterns` is included to make visible and preferred over `.prettierignore` + // `ignorePatterns` is included to make it visible and preferred over `.prettierignore` ignorePatterns: [], };