diff --git a/.eslintrc.yml b/.eslintrc.yml index 2090b80caa..02a4b0aa42 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -317,7 +317,7 @@ rules: # https://eslint.org/docs/rules/#variables init-declarations: off - logical-assignment-operators: off # TODO + logical-assignment-operators: error no-delete-var: error no-label-var: error no-restricted-globals: off diff --git a/resources/diff-npm-package.ts b/resources/diff-npm-package.ts index c61f54aa32..147e4874fe 100644 --- a/resources/diff-npm-package.ts +++ b/resources/diff-npm-package.ts @@ -17,8 +17,8 @@ const { tmpDirPath } = makeTmpDir('graphql-js-npm-diff'); const args = process.argv.slice(2); let [fromRevision, toRevision] = args; if (args.length < 2) { - fromRevision = fromRevision ?? 'HEAD'; - toRevision = toRevision ?? LOCAL; + fromRevision ??= 'HEAD'; + toRevision ??= LOCAL; console.warn( `Assuming you meant: diff-npm-package ${fromRevision} ${toRevision}`, ); diff --git a/resources/gen-changelog.ts b/resources/gen-changelog.ts index baae5d15d4..9d106fbacc 100644 --- a/resources/gen-changelog.ts +++ b/resources/gen-changelog.ts @@ -91,7 +91,7 @@ async function genChangeLog(): Promise { if (!labelsConfig[label]) { throw new Error(`Unknown label: ${label}. See ${pr.url}`); } - byLabel[label] = byLabel[label] || []; + byLabel[label] ??= []; byLabel[label].push(pr); committersByLogin[pr.author.login] = pr.author; } diff --git a/resources/utils.ts b/resources/utils.ts index ba0aa35471..ed46f9635a 100644 --- a/resources/utils.ts +++ b/resources/utils.ts @@ -149,7 +149,7 @@ export function showDirStats(dirPath: string): void { const ext = name.split('.').slice(1).join('.'); const filetype = ext ? '*.' + ext : name; - fileTypes[filetype] = fileTypes[filetype] ?? { filepaths: [], size: 0 }; + fileTypes[filetype] ??= { filepaths: [], size: 0 }; totalSize += stats.size; fileTypes[filetype].size += stats.size; diff --git a/src/language/blockString.ts b/src/language/blockString.ts index 667f91831e..5f8d5f6127 100644 --- a/src/language/blockString.ts +++ b/src/language/blockString.ts @@ -23,7 +23,7 @@ export function dedentBlockStringLines( continue; // skip empty lines } - firstNonEmptyLine = firstNonEmptyLine ?? i; + firstNonEmptyLine ??= i; lastNonEmptyLine = i; if (i !== 0 && indent < commonIndent) {