From b349a819baadbb5213327c83514cb8c50fc4e972 Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Wed, 13 Nov 2024 21:49:55 +0900 Subject: [PATCH] fix(runFormat.ts): improve filtering in scriptNames --- src/bin/tools/runFormat.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/tools/runFormat.ts b/src/bin/tools/runFormat.ts index b7a4d787..fd2eb108 100644 --- a/src/bin/tools/runFormat.ts +++ b/src/bin/tools/runFormat.ts @@ -44,7 +44,12 @@ export function runFormat(params: { packageJsonFilePath: string }) { return; } - for (const scriptName of ["format", "lint"]) { + const scriptKeys = Object.keys(scripts); + const scriptNames = scriptKeys.filter(scriptKey => + scriptKey.trim().match(/^(lint|format)/) + ); + + for (const scriptName of scriptNames) { if (!(scriptName in scripts)) { continue; }