Skip to content

Commit 1e68079

Browse files
committed
Merge branch 'main' into improve-labels
* main: Clean changelog Add comment to explain why the rule is disabled Remove obsolete `async` Remove obsolete comment Add changelog entry Allow `await` inside of loops
2 parents 2a99388 + cc4c2b2 commit 1e68079

File tree

15 files changed

+19
-27
lines changed

15 files changed

+19
-27
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ rules:
113113
- properties: false
114114
require-await: 1
115115
no-only-tests/no-only-tests: error
116+
no-await-in-loop: 0 # allows intentional sequential processing of async operations
116117

117118
overrides:
118119
- files:

scripts/history/migrate-services.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async function rewriteSnapshots(repository, records, idsMapping, logger) {
140140
let i = 1;
141141

142142
for (const record of records) {
143-
const { id: recordId } = await repository.save(record); // eslint-disable-line no-await-in-loop
143+
const { id: recordId } = await repository.save(record);
144144

145145
idsMapping[record.id] = recordId; // Saves the mapping between the old ID and the new one.
146146

@@ -166,7 +166,7 @@ async function rewriteVersions(repository, records, idsMapping, logger) {
166166

167167
record.snapshotId = newSnapshotId;
168168

169-
const { id: recordId } = await repository.save(record); // eslint-disable-line no-await-in-loop
169+
const { id: recordId } = await repository.save(record);
170170

171171
if (recordId) {
172172
logger.info({ message: `Migrated version with new ID: ${recordId}`, serviceId: record.serviceId, type: record.termsType, id: record.id, current: i++, total: records.length });

scripts/import/loadCommits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let client;
4242
let counter = 1;
4343

4444
for (const commit of filteredCommits.reverse()) { // reverse array to insert most recent commits first
45-
await collection.updateOne({ hash: commit.hash }, { $set: { ...commit } }, { upsert: true }); // eslint-disable-line no-await-in-loop
45+
await collection.updateOne({ hash: commit.hash }, { $set: { ...commit } }, { upsert: true });
4646

4747
if (counter % 1000 == 0) {
4848
logger.info({ message: ' ', current: counter, total: totalCommitToLoad });

scripts/reporter/duplicate/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ async function removeDuplicateIssues() {
4848
continue;
4949
}
5050

51-
await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', { /* eslint-disable-line no-await-in-loop */
51+
await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', {
5252
owner,
5353
repo,
5454
issue_number: issue.number,
5555
state: 'closed',
5656
});
5757

58-
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', { /* eslint-disable-line no-await-in-loop */
58+
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', {
5959
owner,
6060
repo,
6161
issue_number: issue.number,

scripts/rewrite/rewrite-snapshots.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ let recorder;
6464
const filteredCommits = commits.filter(({ message }) =>
6565
message.match(/^(Start tracking|Update)/));
6666

67-
/* eslint-disable no-await-in-loop */
6867
/* eslint-disable no-continue */
6968
for (const commit of filteredCommits) {
7069
console.log(Date.now(), commit.hash, commit.date, commit.message);

scripts/rewrite/rewrite-versions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ let recorder;
7474
const filteredCommits = commits.filter(({ message }) =>
7575
message.match(/^(Start tracking|Update)/));
7676

77-
/* eslint-disable no-await-in-loop */
7877
/* eslint-disable no-continue */
7978
for (const commit of filteredCommits) {
8079
console.log(Date.now(), commit.hash, commit.date, commit.message);

src/archivist/extract/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,12 @@ export async function extractFromHTML(sourceDocument) {
5959

6060
for (const filterFunction of serviceSpecificFilters) {
6161
try {
62-
/* eslint-disable no-await-in-loop */
63-
// We want this to be made in series
6462
await filterFunction(webPageDOM, {
6563
fetch: location,
6664
select: contentSelectors,
6765
remove: insignificantContentSelectors,
6866
filter: serviceSpecificFilters.map(filter => filter.name),
6967
});
70-
/* eslint-enable no-await-in-loop */
7168
} catch (error) {
7269
throw new Error(`The filter function "${filterFunction.name}" failed: ${error}`);
7370
}

src/archivist/fetcher/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const FETCHER_TYPES = {
2727
* @throws {FetchDocumentError} When the fetch operation fails
2828
* @async
2929
*/
30-
export default async function fetch({
30+
export default function fetch({
3131
url,
3232
executeClientScripts,
3333
cssSelectors,

src/archivist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default class Archivist extends events.EventEmitter {
187187
const { location: url, executeClientScripts, cssSelectors } = sourceDocument;
188188

189189
try {
190-
const { mimeType, content, fetcher } = await this.fetch({ url, executeClientScripts, cssSelectors }); // eslint-disable-line no-await-in-loop
190+
const { mimeType, content, fetcher } = await this.fetch({ url, executeClientScripts, cssSelectors });
191191

192192
sourceDocument.content = content;
193193
sourceDocument.mimeType = mimeType;

src/archivist/recorder/repositories/git/index.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,6 @@ describe('GitRepository', () => {
13821382

13831383
await subject.initialize();
13841384

1385-
/* eslint-disable no-await-in-loop */
13861385
for (const commit of Object.values(commits)) {
13871386
const { path: relativeFilePath, date, content, message } = commit;
13881387
const filePath = path.join(RECORDER_PATH, relativeFilePath);
@@ -1396,7 +1395,6 @@ describe('GitRepository', () => {
13961395
expectedIds.push(sha);
13971396
expectedDates.push(date);
13981397
}
1399-
/* eslint-enable no-await-in-loop */
14001398
});
14011399

14021400
after(() => subject.removeAll());

0 commit comments

Comments
 (0)