From 7f7c776f8ac6910896ba1ae7c69320669838b296 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 8 Jun 2024 00:49:46 +0900 Subject: [PATCH] Clarify exhaustiveCheck --- dist/index.js | 19 ++++++++++++------- src/main.ts | 2 +- src/report.ts | 19 +++++++++++-------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index d2182eb2..dc4b2c33 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32416,13 +32416,18 @@ function matchPath({ workflowFile, jobName, jobMatchMode }, summary) { if (!jobName) { return true; } - if (jobMatchMode === "exact") { - return jobName === summary.jobName; - } - if (jobMatchMode === "prefix") { - return summary.jobName.startsWith(jobName); + switch (jobMatchMode) { + case "exact": { + return jobName === summary.jobName; + } + case "prefix": { + return summary.jobName.startsWith(jobName); + } + default: { + const _exhaustiveCheck = jobMatchMode; + return false; + } } - return false; } function seekWaitList(summaries, waitList, elapsed) { const seeker = waitList.map((condition) => ({ ...condition, found: false })); @@ -32579,7 +32584,7 @@ function colorize(severity, message) { return message; } default: { - const _unexpectedSeverity = severity; + const _exhaustiveCheck = severity; return message; } } diff --git a/src/main.ts b/src/main.ts index 26fa0921..55caafa3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,7 +16,7 @@ function colorize(severity: Severity, message: string): string { return message; } default: { - const _unexpectedSeverity: never = severity; + const _exhaustiveCheck: never = severity; return message; } } diff --git a/src/report.ts b/src/report.ts index 3d122b7a..3de3c757 100644 --- a/src/report.ts +++ b/src/report.ts @@ -93,15 +93,18 @@ function matchPath({ workflowFile, jobName, jobMatchMode }: FilterCondition, sum return true; } - if (jobMatchMode === 'exact') { - return jobName === summary.jobName; - } - - if (jobMatchMode === 'prefix') { - return summary.jobName.startsWith(jobName); + switch (jobMatchMode) { + case 'exact': { + return jobName === summary.jobName; + } + case 'prefix': { + return summary.jobName.startsWith(jobName); + } + default: { + const _exhaustiveCheck: never = jobMatchMode; + return false; + } } - - return false; } function seekWaitList(