Skip to content

Commit 5f0a6a7

Browse files
committed
refactor: use optional chaining ?.
1 parent eae9622 commit 5f0a6a7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const lintStaged = async (
109109
printTaskOutput(ctx, logger)
110110
return true
111111
} catch (runAllError) {
112-
if (runAllError && runAllError.ctx && runAllError.ctx.errors) {
112+
if (runAllError?.ctx?.errors) {
113113
const { ctx } = runAllError
114114

115115
if (ctx.errors.has(ConfigNotFoundError)) {

lib/printTaskOutput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
export const printTaskOutput = (ctx = {}, logger) => {
77
if (!Array.isArray(ctx.output)) return
8-
const log = ctx.errors && ctx.errors.size > 0 ? logger.error : logger.log
8+
const log = ctx.errors?.size > 0 ? logger.error : logger.log
99
for (const line of ctx.output) {
1010
log(line)
1111
}

0 commit comments

Comments
 (0)