Skip to content

A local-first personal finance app

[AI] Promote typescript/no-for-in-array lint rule from warn to error (#7193)

Matiss Janis Aboltinsd6dcc30e442c
diff --git a/.oxlintrc.json b/.oxlintrc.json
index 3451a56e92..49ab8037bc 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -105,7 +105,7 @@
"typescript/no-floating-promises": "error",
"typescript/require-array-sort-compare": "error",
"typescript/unbound-method": "error",
- "typescript/no-for-in-array": "warn", // TODO: covert to error
+ "typescript/no-for-in-array": "error",
"typescript/restrict-template-expressions": "error",
// Import rules
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx
index 72d575261d..9cd6143e08 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx
@@ -543,7 +543,7 @@ describe('Transactions', () => {
'{Shift>}[Enter]{/Shift}',
];
- for (const idx in ks) {
+ for (const [idx] of ks.entries()) {
const input = await editField(container, 'notes', 2);
const oldValue = input.value;
await userEvent.clear(input);
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
index 87dccf062e..66314aff1a 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
@@ -2954,7 +2954,7 @@ export const TransactionTable = forwardRef(
amountPerTransaction,
);
- for (const amountIndex in amounts) {
+ for (const [amountIndex] of amounts.entries()) {
if (remainingCents === 0) break;
amounts[amountIndex] += 1;
@@ -2967,9 +2967,12 @@ export const TransactionTable = forwardRef(
tableNavigator.onEdit(null);
}
- for (const transactionIndex in emptyTransactions) {
+ for (const [
+ transactionIndex,
+ transaction,
+ ] of emptyTransactions.entries()) {
await onSave({
- ...emptyTransactions[transactionIndex],
+ ...transaction,
amount: amounts[transactionIndex],
});
}
diff --git a/upcoming-release-notes/7193.md b/upcoming-release-notes/7193.md
new file mode 100644
index 0000000000..cade60d76a
--- /dev/null
+++ b/upcoming-release-notes/7193.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+Elevate `typescript/no-for-in-array` lint rule from warning to error, refactor affected code.