diff --git a/lib/index.js b/lib/index.js index 2e250fecf..85420f546 100644 --- a/lib/index.js +++ b/lib/index.js @@ -109,7 +109,7 @@ const lintStaged = async ( printTaskOutput(ctx, logger) return true } catch (runAllError) { - if (runAllError && runAllError.ctx && runAllError.ctx.errors) { + if (runAllError?.ctx?.errors) { const { ctx } = runAllError if (ctx.errors.has(ConfigNotFoundError)) { diff --git a/lib/printTaskOutput.js b/lib/printTaskOutput.js index 831f8fd07..e3a4845d6 100644 --- a/lib/printTaskOutput.js +++ b/lib/printTaskOutput.js @@ -5,7 +5,7 @@ */ export const printTaskOutput = (ctx = {}, logger) => { if (!Array.isArray(ctx.output)) return - const log = ctx.errors && ctx.errors.size > 0 ? logger.error : logger.log + const log = ctx.errors?.size > 0 ? logger.error : logger.log for (const line of ctx.output) { log(line) }