Skip to content

Commit

Permalink
fix: correct exit code for ignored resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-ha committed Sep 20, 2024
1 parent e7ac94c commit 65d3064
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/cli/src/getExitCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ export function getExitCode(analysis: CheckResult, opts?: RenderOptions): number
if (!analysis.types) {
return 0;
}
if (!opts?.ignoreRules) {
return analysis.problems.length > 0 ? 1 : 0;
}
return analysis.problems.some((problem) => !opts.ignoreRules!.includes(problemFlags[problem.kind])) ? 1 : 0;
const ignoreRules = opts?.ignoreRules ?? [];
const ignoreResolutions = opts?.ignoreResolutions ?? [];
return analysis.problems.some((problem) => {
const notRuleIgnored = !ignoreRules.includes(problemFlags[problem.kind]);
const notResolutionIgnored = "resolutionKind" in problem ? !ignoreResolutions.includes(problem.resolutionKind) : true;
return notRuleIgnored && notResolutionIgnored;
}) ? 1 : 0;
}

0 comments on commit 65d3064

Please sign in to comment.