A local-first personal finance app
Update linting rules and replace @ts-ignore with @ts-expect-error (#6636)
Matiss Janis Aboltins0c3a515e29d7
diff --git a/.oxlintrc.json b/.oxlintrc.jsonindex 2488a0bb4b..bac53e73e3 100644--- a/.oxlintrc.json+++ b/.oxlintrc.json@@ -15,7 +15,7 @@"vi": "readonly","backend": "readonly","importScripts": "readonly",- "FS": "readonly" // TODO: remove this+ "FS": "readonly"},"rules": {// TODO fix all these and re-enable@@ -103,13 +103,7 @@"jsx-a11y/scope": "warn",// Typescript rules- "typescript/ban-ts-comment": [- "warn",- {- // TODO: remove this- "ts-ignore": "allow-with-description"- }- ],+ "typescript/ban-ts-comment": ["warn"],"typescript/consistent-type-definitions": ["warn", "type"],"typescript/consistent-type-imports": ["warn",@@ -190,7 +184,7 @@// ESLint rules"eslint/array-callback-return": "warn",- // "eslint/curly": ["warn", "multi-line", "consistent"], // TODO: re-enable? this rule is really slow+ "eslint/curly": ["warn", "multi-line", "consistent"],"eslint/default-case": ["warn",{diff --git a/packages/api/index.ts b/packages/api/index.tsindex a71a0c56d2..f265d84e03 100644--- a/packages/api/index.ts+++ b/packages/api/index.ts@@ -6,6 +6,7 @@ import type {// loot-core typesimport type { InitConfig } from 'loot-core/server/main';+// oxlint-disable-next-line typescript/ban-ts-comment// @ts-ignore: bundle not available until we build itimport * as bundle from './app/bundle.api.js';import * as injected from './injected';diff --git a/packages/api/utils.ts b/packages/api/utils.tsindex 52bf45eb9d..dfd3c5ca41 100644--- a/packages/api/utils.ts+++ b/packages/api/utils.ts@@ -1,3 +1,4 @@+// oxlint-disable-next-line typescript/ban-ts-comment// @ts-ignore: bundle not available until we build itimport * as bundle from './app/bundle.api.js';diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex f40d34a289..0e410d8a5e 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -1841,7 +1841,7 @@ class AccountInternal extends PureComponent<<View style={{ flex: 1 }}><TransactionListheaderContent={undefined}- // @ts-ignore TODO+ // @ts-expect-error - fix metableRef={this.table}account={account}transactions={transactions}diff --git a/packages/desktop-client/src/components/filters/PayeeFilter.tsx b/packages/desktop-client/src/components/filters/PayeeFilter.tsxindex 64cfb55453..9899a417da 100644--- a/packages/desktop-client/src/components/filters/PayeeFilter.tsx+++ b/packages/desktop-client/src/components/filters/PayeeFilter.tsx@@ -43,7 +43,7 @@ export const PayeeFilter = ({ value, op, onChange }: PayeeFilterProps) => {multi && coercedValue.length > 0 ? undefined : t('nothing');return (- // @ts-ignore: typing is not playing nicely with the union type of AutocompleteProps.+ // @ts-expect-error: typing is not playing nicely with the union type of AutocompleteProps.<PayeeAutocompletetype={multi ? 'multi' : 'single'}showInactivePayeesdiff --git a/packages/desktop-client/src/components/transactions/TransactionList.tsx b/packages/desktop-client/src/components/transactions/TransactionList.tsxindex 798d271925..9eeb6d0bcb 100644--- a/packages/desktop-client/src/components/transactions/TransactionList.tsx+++ b/packages/desktop-client/src/components/transactions/TransactionList.tsx@@ -76,9 +76,9 @@ async function saveDiffAndApply(diff, changes, onChange, learnCategories) {const remoteDiff = await saveDiff(diff, learnCategories);onChange(// TODO:- // @ts-ignore testing+ // @ts-expect-error - fix meapplyTransactionDiff(changes.newTransaction, remoteDiff),- // @ts-ignore testing+ // @ts-expect-error - fix meapplyChanges(remoteDiff, changes.data),);}diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsxindex 0625f34eaf..38a7768aaf 100644--- a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx@@ -209,7 +209,7 @@ function LiveTransactionTable(props: LiveTransactionTableProps) {{...props}transactions={transactions}loadMoreTransactions={vi.fn()}- // @ts-ignore TODO:+ // @ts-expect-error TODO: fix mecommonPayees={[]}payees={payees}addNotification={console.log}diff --git a/packages/eslint-plugin-actual/lib/rules/typography.js b/packages/eslint-plugin-actual/lib/rules/typography.jsindex 234b256b6a..75a8be8d6c 100644--- a/packages/eslint-plugin-actual/lib/rules/typography.js+++ b/packages/eslint-plugin-actual/lib/rules/typography.js@@ -30,8 +30,9 @@ module.exports = {!value.includes('\u2019') &&!value.includes('\u201C') &&!value.includes('\u201D')- )+ ) {return;+ }let rawText = context.getSourceCode().getText(node);const originalRawText = rawText;diff --git a/packages/loot-core/src/server/budget/category-template-context.test.ts b/packages/loot-core/src/server/budget/category-template-context.test.tsindex 430bad6077..e654fab881 100644--- a/packages/loot-core/src/server/budget/category-template-context.test.ts+++ b/packages/loot-core/src/server/budget/category-template-context.test.ts@@ -381,7 +381,6 @@ describe('CategoryTemplateContext', () => {amount: 1000,from: '2023-11',month: '2023-12',- //@ts-ignore this is what the template expectsrepeat: 3,directive: 'template',priority: 1,diff --git a/packages/loot-core/src/server/polyfills.ts b/packages/loot-core/src/server/polyfills.tsindex f0e7b69338..4d4df03e87 100644--- a/packages/loot-core/src/server/polyfills.ts+++ b/packages/loot-core/src/server/polyfills.ts@@ -4,7 +4,7 @@ import * as jspb from 'google-protobuf';if (typeof globalThis !== 'undefined') {// Add a basic require polyfill for CommonJS modulesif (typeof globalThis.require === 'undefined') {- // @ts-ignore - we're creating a minimal require implementation+ // @ts-expect-error - we're creating a minimal require implementationglobalThis.require = (moduleId: string) => {switch (moduleId) {case 'google-protobuf':@@ -21,7 +21,6 @@ if (typeof globalThis !== 'undefined') {// Also set on global for compatibilityif (typeof global !== 'undefined') {if (typeof global.require === 'undefined') {- // @ts-ignore - assigning minimal require implementation to globalglobal.require = globalThis.require;}}diff --git a/packages/loot-core/src/shared/schedules.ts b/packages/loot-core/src/shared/schedules.tsindex 8f05cb982b..042a6574ce 100644--- a/packages/loot-core/src/shared/schedules.ts+++ b/packages/loot-core/src/shared/schedules.ts@@ -261,13 +261,13 @@ export function getRecurringDescription(export function recurConfigToRSchedule(config) {const base: IRuleOptions = {start: monthUtils.parseDate(config.start),- // @ts-ignore: issues with https://gitlab.com/john.carroll.p/rschedule/-/issues/86+ // @ts-expect-error: issues with https://gitlab.com/john.carroll.p/rschedule/-/issues/86frequency: config.frequency.toUpperCase(),byHourOfDay: [12],};if (config.interval) {- // @ts-ignore: issues with https://gitlab.com/john.carroll.p/rschedule/-/issues/86+ // @ts-expect-error: issues with https://gitlab.com/john.carroll.p/rschedule/-/issues/86base.interval = config.interval;}diff --git a/packages/sync-server/src/app.ts b/packages/sync-server/src/app.tsindex 2275430aa7..3c7209726f 100644--- a/packages/sync-server/src/app.ts+++ b/packages/sync-server/src/app.ts@@ -163,6 +163,7 @@ function parseHTTPSConfig(value: string) {function sendServerStartedMessage() {// Signify to any parent process that the server has started. Used in electron desktop app+ // oxlint-disable-next-line typescript/ban-ts-comment// @ts-ignore-error electron typesprocess.parentPort?.postMessage({ type: 'server-started' });console.log(diff --git a/upcoming-release-notes/6636.md b/upcoming-release-notes/6636.mdnew file mode 100644index 0000000000..87cd8495e1--- /dev/null+++ b/upcoming-release-notes/6636.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MatissJanis]+---++lint: patch some low-hanging fruit lint violations