diff --git a/.eslintrc.js b/.eslintrc.js index 5fb61e0efa..da77302262 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,6 +55,8 @@ module.exports = { 'prefer-arrow-callback': 'error', 'no-var': 'error', '@typescript-eslint/strict-boolean-expressions': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', eqeqeq: 'error', '@typescript-eslint/no-unused-vars': [ 'error', diff --git a/src/compiler/utils/time.ts b/src/compiler/utils/time.ts index bfdc4ba1c0..d1431a8490 100644 --- a/src/compiler/utils/time.ts +++ b/src/compiler/utils/time.ts @@ -12,7 +12,7 @@ export async function time( const duration = parseHrTimeToSeconds(endTime); if (mode === 'inline') { - const leadingNewLinesCount = (label.match(/^[\n]+/g) || [''])[0].length; + const leadingNewLinesCount = (label.match(/^[\n]+/g) ?? [''])[0].length; const cursorUp = `\x1b[${1 + leadingNewLinesCount}A`; process.stdout.write(`${cursorUp}${label} ${dim(`${duration}s`)}\n`); } else {