Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function SuggestionMention({

const getUserMentionOptions = useCallback(
(personalDetailsParam: PersonalDetailsList | SuggestionPersonalDetailsList | undefined, searchValue = ''): Mention[] => {
const suggestions = [];
const suggestions: Mention[] = [];

if (CONST.AUTO_COMPLETE_SUGGESTER.HERE_TEXT.includes(searchValue.toLowerCase())) {
suggestions.push({
Expand Down Expand Up @@ -315,10 +315,9 @@ function SuggestionMention({
// At this point we are sure that the details are not null, since empty user details have been filtered in the previous step
const sortedPersonalDetails = getSortedPersonalDetails(filteredPersonalDetails, localeCompare);

// eslint-disable-next-line unicorn/no-array-for-each
sortedPersonalDetails.slice(0, CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS - suggestions.length).forEach((detail) => {
for (const detail of sortedPersonalDetails.slice(0, CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS - suggestions.length)) {
suggestions.push({
text: formatLoginPrivateDomain(getDisplayNameOrDefault(detail), detail?.login),
text: `${formatLoginPrivateDomain(getDisplayNameOrDefault(detail), detail?.login)}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wrap it in a template?

alternateText: `@${formatLoginPrivateDomain(detail?.login, detail?.login)}`,
handle: detail?.login,
icons: [
Expand All @@ -331,7 +330,7 @@ function SuggestionMention({
},
],
});
});
}

return suggestions;
},
Expand All @@ -341,10 +340,9 @@ function SuggestionMention({
const getRoomMentionOptions = useCallback(
(searchTerm: string, reportBatch: OnyxCollection<Report>): Mention[] => {
const filteredRoomMentions: Mention[] = [];
// eslint-disable-next-line unicorn/no-array-for-each
Object.values(reportBatch ?? {}).forEach((report) => {
for (const report of Object.values(reportBatch ?? {})) {
if (!canReportBeMentionedWithinPolicy(report, policyID)) {
return;
continue;
}
if (report?.reportName?.toLowerCase().includes(searchTerm.toLowerCase())) {
filteredRoomMentions.push({
Expand All @@ -353,7 +351,7 @@ function SuggestionMention({
alternateText: report.reportName,
});
}
});
}

return lodashSortBy(filteredRoomMentions, 'handle').slice(0, CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ function IOURequestStepScan({
billable?: boolean,
reimbursable = true,
) => {
// eslint-disable-next-line unicorn/no-array-for-each
files.forEach((receiptFile: ReceiptFile, index) => {
for (const [index, receiptFile] of files.entries()) {
const transaction = transactions.find((item) => item.transactionID === receiptFile.transactionID);
const receipt: Receipt = receiptFile.file ?? {};
receipt.source = receiptFile.source;
Expand Down Expand Up @@ -366,7 +365,7 @@ function IOURequestStepScan({
transactionViolations,
});
}
});
}
},
[
transactions,
Expand Down
5 changes: 2 additions & 3 deletions src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ function IOURequestStepScan({
billable?: boolean,
reimbursable = true,
) => {
// eslint-disable-next-line unicorn/no-array-for-each
files.forEach((receiptFile: ReceiptFile, index) => {
for (const [index, receiptFile] of files.entries()) {
const transaction = transactions.find((item) => item.transactionID === receiptFile.transactionID);
const receipt: Receipt = receiptFile.file ?? {};
receipt.source = receiptFile.source;
Expand Down Expand Up @@ -427,7 +426,7 @@ function IOURequestStepScan({
transactionViolations,
});
}
});
}
},
[
backToReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ function SageIntacctEntityPage({policy}: WithPolicyProps) {
isSelected: entityID === '',
},
];
// eslint-disable-next-line unicorn/no-array-for-each
policy?.connections?.intacct?.data?.entities.forEach((entity) => {
for (const entity of policy?.connections?.intacct?.data?.entities ?? []) {
sections.push({
text: entity.name,
value: entity.name,
keyForList: entity.id,
isSelected: entity.id === entityID,
});
});
}

const saveSelection = ({keyForList}: ListItem) => {
updateSageIntacctEntity(policyID, keyForList ?? '', entityID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// eslint-disable-next-line no-restricted-imports
import type {ScrollView as ScrollViewRN} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 8 in src/pages/workspace/workflows/approvals/ApprovalWorkflowEditor.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 8 in src/pages/workspace/workflows/approvals/ApprovalWorkflowEditor.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -53,10 +53,11 @@
(index: number) => {
let pendingAction: PendingAction | undefined;
if (index === 0) {
// eslint-disable-next-line unicorn/no-array-for-each
approvalWorkflow?.members?.forEach((member) => {
pendingAction = pendingAction ?? member.pendingFields?.submitsTo;
});
if (approvalWorkflow?.members) {
for (const member of approvalWorkflow.members) {
pendingAction = pendingAction ?? member.pendingFields?.submitsTo;
}
}
return pendingAction;
}
const previousApprover = approvalWorkflow?.approvers.at(index - 1);
Expand Down
Loading