Skip to content

Commit 9d27169

Browse files
committed
fix(eslint): manually fix non-autofixable unicorn/no-array-for-each violations
1 parent cbbec15 commit 9d27169

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/libs/SearchQueryUtils.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,25 +346,26 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea
346346
// their value when computing the similarSearchHash
347347
const similarSearchValueBasedFilters = new Set<SearchFilterKey>([CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION]);
348348

349-
query.flatFilters
349+
const flatFilters = query.flatFilters
350350
.map((filter) => {
351351
const filterKey = filter.key;
352352
const filters = cloneDeep(filter.filters);
353353
filters.sort((a, b) => customCollator.compare(a.value.toString(), b.value.toString()));
354354
return {filterString: buildFilterValuesString(filterKey, filters), filterKey};
355355
})
356-
.sort((a, b) => customCollator.compare(a.filterString, b.filterString))
357-
.forEach(({filterString, filterKey}) => {
358-
if (!similarSearchIgnoredFilters.has(filterKey)) {
359-
filterSet.add(filterKey);
360-
}
356+
.sort((a, b) => customCollator.compare(a.filterString, b.filterString));
361357

362-
if (similarSearchValueBasedFilters.has(filterKey)) {
363-
filterSet.add(filterString.trim());
364-
}
358+
for (const {filterString, filterKey} of flatFilters) {
359+
if (!similarSearchIgnoredFilters.has(filterKey)) {
360+
filterSet.add(filterKey);
361+
}
365362

366-
orderedQuery += ` ${filterString}`;
367-
});
363+
if (similarSearchValueBasedFilters.has(filterKey)) {
364+
filterSet.add(filterString.trim());
365+
}
366+
367+
orderedQuery += ` ${filterString}`;
368+
}
368369

369370
const similarSearchHash = hashText(Array.from(filterSet).join(''), 2 ** 32);
370371
const recentSearchHash = hashText(orderedQuery, 2 ** 32);

src/libs/SearchUIUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,9 @@ function getColumnsToShow(
25822582
};
25832583

25842584
if (Array.isArray(data)) {
2585-
data.forEach(updateColumns);
2585+
for (const item of data) {
2586+
updateColumns(item);
2587+
}
25862588
} else {
25872589
for (const key of Object.keys(data)) {
25882590
if (!isTransactionEntry(key)) {

src/libs/actions/OnyxUpdateManager/utils/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ function detectGapsAndSplit(lastUpdateIDFromClient: number): DetectGapAndSplitRe
9999

100100
// Add all deferred updates after the gap(s) to "updatesAfterGaps".
101101
// If "firstUpdateToBeAppliedAfterGap" is set to the last deferred update, the array will be empty.
102-
Object.entries(pendingDeferredUpdates).forEach(([lastUpdateID, update]) => {
102+
for (const [lastUpdateID, update] of Object.entries(pendingDeferredUpdates)) {
103103
if (Number(lastUpdateID) < firstUpdateToBeAppliedAfterGap) {
104-
return;
104+
continue;
105105
}
106106

107107
updatesAfterGaps[Number(lastUpdateID)] = update;
108-
}, {});
108+
}
109109
}
110110

111111
return {applicableUpdates, updatesAfterGaps, latestMissingUpdateID};

0 commit comments

Comments
 (0)