Skip to content

Commit

Permalink
commitlint: honor our own WorkflowGuidelines
Browse files Browse the repository at this point in the history
The workflow guidelines state that we should avoid the keyword
"undefined". This is also extra good because it seems that the
`?`-based guards against both null and undefined, at least
according to this example:

conventional-changelog/commitlint@7ab4bab
  • Loading branch information
knocte committed Aug 31, 2024
1 parent ca5ef48 commit 9212367
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions commitlint/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ export abstract class Helpers {
potentialString: any,
paramName: string
): string | null {
if (potentialString === null || potentialString === undefined) {
// otherwise, String(null) might give us the stupid string "null"
return null;
}
return String(potentialString);
// this null/undefined check is required, otherwise, String(null) might give us the stupid string "null"
return potentialString ? String(potentialString) : null;
}

public static assertNotNull(
Expand Down

0 comments on commit 9212367

Please sign in to comment.