Skip to content

Commit a045948

Browse files
lint: enable ESLint's logical-assignment-operators rule (#3771)
1 parent ffa18e9 commit a045948

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ rules:
317317
# https://eslint.org/docs/rules/#variables
318318

319319
init-declarations: off
320-
logical-assignment-operators: off # TODO
320+
logical-assignment-operators: error
321321
no-delete-var: error
322322
no-label-var: error
323323
no-restricted-globals: off

resources/diff-npm-package.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const { tmpDirPath } = makeTmpDir('graphql-js-npm-diff');
1717
const args = process.argv.slice(2);
1818
let [fromRevision, toRevision] = args;
1919
if (args.length < 2) {
20-
fromRevision = fromRevision ?? 'HEAD';
21-
toRevision = toRevision ?? LOCAL;
20+
fromRevision ??= 'HEAD';
21+
toRevision ??= LOCAL;
2222
console.warn(
2323
`Assuming you meant: diff-npm-package ${fromRevision} ${toRevision}`,
2424
);

resources/gen-changelog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function genChangeLog(): Promise<string> {
9191
if (!labelsConfig[label]) {
9292
throw new Error(`Unknown label: ${label}. See ${pr.url}`);
9393
}
94-
byLabel[label] = byLabel[label] || [];
94+
byLabel[label] ??= [];
9595
byLabel[label].push(pr);
9696
committersByLogin[pr.author.login] = pr.author;
9797
}

resources/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function showDirStats(dirPath: string): void {
149149
const ext = name.split('.').slice(1).join('.');
150150
const filetype = ext ? '*.' + ext : name;
151151

152-
fileTypes[filetype] = fileTypes[filetype] ?? { filepaths: [], size: 0 };
152+
fileTypes[filetype] ??= { filepaths: [], size: 0 };
153153

154154
totalSize += stats.size;
155155
fileTypes[filetype].size += stats.size;

src/language/blockString.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function dedentBlockStringLines(
2323
continue; // skip empty lines
2424
}
2525

26-
firstNonEmptyLine = firstNonEmptyLine ?? i;
26+
firstNonEmptyLine ??= i;
2727
lastNonEmptyLine = i;
2828

2929
if (i !== 0 && indent < commonIndent) {

0 commit comments

Comments
 (0)