From 0c3a515e29d73f74b2da4b01c792a243ad1c88b0 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Tue, 13 Jan 2026 22:53:14 +0100 Subject: [PATCH] Update linting rules and replace @ts-ignore with @ts-expect-error (#6636) * Update linting rules and replace @ts-ignore with @ts-expect-error * Add release notes for PR #6636 * Fix TypeScript linting issue by adding @ts-ignore for electron types in server start message * Change category to Maintenance and update linting rules --------- Co-authored-by: github-actions[bot] --- .oxlintrc.json | 12 +++--------- packages/api/index.ts | 1 + packages/api/utils.ts | 1 + .../src/components/accounts/Account.tsx | 2 +- .../src/components/filters/PayeeFilter.tsx | 2 +- .../src/components/transactions/TransactionList.tsx | 4 ++-- .../transactions/TransactionsTable.test.tsx | 2 +- .../eslint-plugin-actual/lib/rules/typography.js | 3 ++- .../server/budget/category-template-context.test.ts | 1 - packages/loot-core/src/server/polyfills.ts | 3 +-- packages/loot-core/src/shared/schedules.ts | 4 ++-- packages/sync-server/src/app.ts | 1 + upcoming-release-notes/6636.md | 6 ++++++ 13 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 upcoming-release-notes/6636.md diff --git a/.oxlintrc.json b/.oxlintrc.json index 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.ts index a71a0c56d2..f265d84e03 100644 --- a/packages/api/index.ts +++ b/packages/api/index.ts @@ -6,6 +6,7 @@ import type { // loot-core types import type { InitConfig } from 'loot-core/server/main'; +// oxlint-disable-next-line typescript/ban-ts-comment // @ts-ignore: bundle not available until we build it import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; diff --git a/packages/api/utils.ts b/packages/api/utils.ts index 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 it import * 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.tsx index 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< { 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. { amount: 1000, from: '2023-11', month: '2023-12', - //@ts-ignore this is what the template expects repeat: 3, directive: 'template', priority: 1, diff --git a/packages/loot-core/src/server/polyfills.ts b/packages/loot-core/src/server/polyfills.ts index 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 modules if (typeof globalThis.require === 'undefined') { - // @ts-ignore - we're creating a minimal require implementation + // @ts-expect-error - we're creating a minimal require implementation globalThis.require = (moduleId: string) => { switch (moduleId) { case 'google-protobuf': @@ -21,7 +21,6 @@ if (typeof globalThis !== 'undefined') { // Also set on global for compatibility if (typeof global !== 'undefined') { if (typeof global.require === 'undefined') { - // @ts-ignore - assigning minimal require implementation to global global.require = globalThis.require; } } diff --git a/packages/loot-core/src/shared/schedules.ts b/packages/loot-core/src/shared/schedules.ts index 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/86 frequency: 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/86 base.interval = config.interval; } diff --git a/packages/sync-server/src/app.ts b/packages/sync-server/src/app.ts index 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 types process.parentPort?.postMessage({ type: 'server-started' }); console.log( diff --git a/upcoming-release-notes/6636.md b/upcoming-release-notes/6636.md new file mode 100644 index 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