Skip to content

Commit

Permalink
add prefer optional chain and nullish coalescing rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Apr 11, 2024
1 parent 3b4bb33 commit 0d88011
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function time<T>(
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 {
Expand Down

0 comments on commit 0d88011

Please sign in to comment.