[AI] Add per-package tsconfigs and typescript-strict-plugin for typecheck (#7019)

* [AI] Add per-package tsconfigs and typescript-strict-plugin for typecheck

Co-authored-by: Cursor <cursoragent@cursor.com>

* Update TypeScript configuration across multiple packages to correct plugin path key from "path" to "paths" and add reference to process-worker typings in index.electron.ts.

* Remove reference to process-worker typings in index.electron.ts and add new process-worker typings file for global Process augmentation.

* Refactor TypeScript build configurations across multiple packages by removing tsconfig.dist.json files and updating build scripts to use default TypeScript compilation. Adjusted compiler options to target ES2021 and enable declaration generation.

* Update TypeScript configuration in api package to refine include and exclude patterns for better file management.

* Update build script in api package to ensure migration SQL files are copied to the correct directory by creating the destination folder if it doesn't exist.

* Update TypeScript configurations in crdt and desktop-electron packages to refine include and exclude patterns for improved file management.

* Update TypeScript dependencies across multiple packages to include typescript-strict-plugin for enhanced type checking and maintain consistency in package.json files.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Matiss Janis Aboltins
2026-02-21 21:26:22 +00:00
committed by GitHub
parent cfc18c240a
commit 31a027fc64
25 changed files with 135 additions and 32 deletions

View File

@@ -1,6 +1,9 @@
/** @type {import('lage').ConfigOptions} */ /** @type {import('lage').ConfigOptions} */
module.exports = { module.exports = {
pipeline: { pipeline: {
typecheck: {
type: 'npmScript',
},
test: { test: {
type: 'npmScript', type: 'npmScript',
options: { options: {

View File

@@ -57,7 +57,7 @@
"lint": "oxfmt --check . && oxlint --type-aware", "lint": "oxfmt --check . && oxlint --type-aware",
"lint:fix": "oxfmt . && oxlint --fix --type-aware", "lint:fix": "oxfmt . && oxlint --fix --type-aware",
"install:server": "yarn workspaces focus @actual-app/sync-server --production", "install:server": "yarn workspaces focus @actual-app/sync-server --production",
"typecheck": "yarn tsc --incremental && tsc-strict", "typecheck": "tsc -p tsconfig.root.json --noEmit && lage typecheck",
"jq": "./node_modules/node-jq/bin/jq", "jq": "./node_modules/node-jq/bin/jq",
"prepare": "husky" "prepare": "husky"
}, },
@@ -84,8 +84,7 @@
"prompts": "^2.4.2", "prompts": "^2.4.2",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.9.3", "typescript": "^5.9.3"
"typescript-strict-plugin": "^2.4.4"
}, },
"resolutions": { "resolutions": {
"rollup": "4.40.1", "rollup": "4.40.1",

View File

@@ -12,12 +12,13 @@
"scripts": { "scripts": {
"build:app": "yarn workspace loot-core build:api", "build:app": "yarn workspace loot-core build:api",
"build:crdt": "yarn workspace @actual-app/crdt build", "build:crdt": "yarn workspace @actual-app/crdt build",
"build:node": "tsc --p tsconfig.dist.json && tsc-alias -p tsconfig.dist.json", "build:node": "tsc && tsc-alias",
"build:migrations": "cp migrations/*.sql dist/migrations", "build:migrations": "mkdir dist/migrations && cp migrations/*.sql dist/migrations",
"build:default-db": "cp default-db.sqlite dist/", "build:default-db": "cp default-db.sqlite dist/",
"build": "yarn run clean && yarn run build:app && yarn run build:node && yarn run build:migrations && yarn run build:default-db", "build": "yarn run clean && yarn run build:app && yarn run build:node && yarn run build:migrations && yarn run build:default-db",
"test": "yarn run clean && yarn run build:app && yarn run build:crdt && vitest --run", "test": "yarn run clean && yarn run build:app && yarn run build:crdt && vitest --run",
"clean": "rm -rf dist @types" "clean": "rm -rf dist @types",
"typecheck": "yarn build && tsc --noEmit && tsc-strict"
}, },
"dependencies": { "dependencies": {
"@actual-app/crdt": "workspace:^", "@actual-app/crdt": "workspace:^",
@@ -29,6 +30,7 @@
"devDependencies": { "devDependencies": {
"tsc-alias": "^1.8.16", "tsc-alias": "^1.8.16",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vitest": "^4.0.18" "vitest": "^4.0.18"
}, },
"engines": { "engines": {

View File

@@ -12,8 +12,9 @@
"declarationDir": "@types", "declarationDir": "@types",
"paths": { "paths": {
"loot-core/*": ["./@types/loot-core/src/*"] "loot-core/*": ["./@types/loot-core/src/*"]
} },
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
}, },
"include": ["."], "include": [".", "../../packages/loot-core/typings/pegjs.ts"],
"exclude": ["**/node_modules/*", "dist", "@types", "*.test.ts"] "exclude": ["**/node_modules/*", "dist", "@types", "*.test.ts"]
} }

View File

@@ -39,7 +39,8 @@
"test": "npm-run-all -cp 'test:*'", "test": "npm-run-all -cp 'test:*'",
"test:web": "ENV=web vitest --run -c vitest.web.config.ts", "test:web": "ENV=web vitest --run -c vitest.web.config.ts",
"start:storybook": "storybook dev -p 6006", "start:storybook": "storybook dev -p 6006",
"build:storybook": "storybook build" "build:storybook": "storybook build",
"typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@emotion/css": "^11.13.5", "@emotion/css": "^11.13.5",

View File

@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": "src",
"strict": true
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}

View File

@@ -9,10 +9,11 @@
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"build:node": "tsc --p tsconfig.dist.json", "build:node": "tsc",
"proto:generate": "./bin/generate-proto", "proto:generate": "./bin/generate-proto",
"build": "rm -rf dist && yarn run build:node", "build": "rm -rf dist && yarn run build:node",
"test": "vitest --run" "test": "vitest --run",
"typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"google-protobuf": "^3.21.4", "google-protobuf": "^3.21.4",

View File

@@ -15,7 +15,8 @@
"test": "vitest --run", "test": "vitest --run",
"e2e": "npx playwright test --browser=chromium", "e2e": "npx playwright test --browser=chromium",
"vrt": "cross-env VRT=true npx playwright test --browser=chromium", "vrt": "cross-env VRT=true npx playwright test --browser=chromium",
"playwright": "playwright" "playwright": "playwright",
"typecheck": "tsc --noEmit && tsc-strict"
}, },
"devDependencies": { "devDependencies": {
"@actual-app/components": "workspace:*", "@actual-app/components": "workspace:*",
@@ -90,6 +91,8 @@
"remark-gfm": "^4.0.1", "remark-gfm": "^4.0.1",
"rollup-plugin-visualizer": "^6.0.5", "rollup-plugin-visualizer": "^6.0.5",
"sass": "^1.97.3", "sass": "^1.97.3",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"usehooks-ts": "^3.1.1", "usehooks-ts": "^3.1.1",
"uuid": "^13.0.0", "uuid": "^13.0.0",
"vite": "^7.3.1", "vite": "^7.3.1",

View File

@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"../../packages/loot-core/typings/pegjs.ts",
"../../packages/loot-core/typings/window.ts"
],
"exclude": [
"node_modules",
"build",
"**/service-worker/**",
"e2e",
"**/*.test.ts",
"**/*.test.tsx",
"**/setupTests.ts"
]
}

View File

@@ -8,7 +8,8 @@
"clean": "rm -rf dist", "clean": "rm -rf dist",
"update-client": "bin/update-client", "update-client": "bin/update-client",
"build": "yarn build:dist && electron-builder", "build": "yarn build:dist && electron-builder",
"build:dist": "tsc --p tsconfig.dist.json && yarn copy-static-assets", "build:dist": "tsc && yarn copy-static-assets",
"typecheck": "tsc --noEmit && tsc-strict",
"copy-static-assets": "copyfiles --exclude 'build/**/*' **/*.html icons/**/* build/desktop-electron", "copy-static-assets": "copyfiles --exclude 'build/**/*' **/*.html icons/**/* build/desktop-electron",
"watch": "yarn build:dist && cross-env ACTUAL_DOCUMENT_DIR=\"../../data\" ACTUAL_DATA_DIR=\"../../data\" electron .", "watch": "yarn build:dist && cross-env ACTUAL_DOCUMENT_DIR=\"../../data\" ACTUAL_DATA_DIR=\"../../data\" electron .",
"e2e": "npx playwright test" "e2e": "npx playwright test"
@@ -29,7 +30,8 @@
"cross-env": "^10.1.0", "cross-env": "^10.1.0",
"electron": "39.2.7", "electron": "39.2.7",
"electron-builder": "26.4.0", "electron-builder": "26.4.0",
"typescript": "^5.9.3" "typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4"
}, },
"build": { "build": {
"appId": "com.actualbudget.actual", "appId": "com.actualbudget.actual",

View File

@@ -9,9 +9,10 @@
"noEmit": false, "noEmit": false,
"declaration": true, "declaration": true,
"outDir": "build", "outDir": "build",
"rootDir": ".." "rootDir": "..",
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
}, },
"include": ["."], "include": [".", "../../packages/loot-core/typings/window.ts"],
"exclude": [ "exclude": [
"**/node_modules/*", "**/node_modules/*",
"build/**/*", "build/**/*",

View File

@@ -60,7 +60,8 @@
"generate:i18n": "i18next", "generate:i18n": "i18next",
"test": "npm-run-all -cp 'test:*'", "test": "npm-run-all -cp 'test:*'",
"test:node": "ENV=node vitest --run", "test:node": "ENV=node vitest --run",
"test:web": "ENV=web vitest --run -c vitest.web.config.ts" "test:web": "ENV=web vitest --run -c vitest.web.config.ts",
"typecheck": "tsc --noEmit && tsc-strict"
}, },
"dependencies": { "dependencies": {
"@jlongster/sql.js": "^1.6.7", "@jlongster/sql.js": "^1.6.7",
@@ -81,6 +82,8 @@
"memoize-one": "^6.0.0", "memoize-one": "^6.0.0",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"slash": "5.1.0", "slash": "5.1.0",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"ua-parser-js": "^2.0.9", "ua-parser-js": "^2.0.9",
"uuid": "^13.0.0" "uuid": "^13.0.0"
}, },

View File

@@ -1,5 +1,5 @@
{ {
"extends": "../../tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": ".", "rootDir": ".",
"declaration": true, "declaration": true,

View File

@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"types": ["vite/client", "vitest/globals", "node"],
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"typings/**/*.ts",
"typings/**/*.d.ts"
],
"exclude": [
"node_modules",
"build",
"lib-dist",
"**/*.test.ts",
"**/*.spec.ts"
]
}

View File

@@ -0,0 +1,12 @@
import type { MessagePort } from 'worker_threads';
declare global {
namespace NodeJS {
// oxlint-disable-next-line typescript/consistent-type-definitions -- global Process augmentation requires interface for declaration merging
interface Process {
parentPort?: MessagePort;
}
}
}
export {};

View File

@@ -51,6 +51,11 @@ type Actual = {
declare global { declare global {
var Actual: Actual; var Actual: Actual;
// oxlint-disable-next-line typescript/consistent-type-definitions -- global Window augmentation requires interface
interface Window {
Actual: Actual;
}
var IS_TESTING: boolean; var IS_TESTING: boolean;
var currentMonth: string | null; var currentMonth: string | null;

View File

@@ -8,7 +8,8 @@
"scripts": { "scripts": {
"build": "cross-env NODE_ENV=production ./bin/build-service-worker", "build": "cross-env NODE_ENV=production ./bin/build-service-worker",
"build-dev": "cross-env NODE_ENV=development ./bin/build-service-worker", "build-dev": "cross-env NODE_ENV=development ./bin/build-service-worker",
"watch": "cross-env NODE_ENV=development ./bin/build-service-worker --watch" "watch": "cross-env NODE_ENV=development ./bin/build-service-worker --watch",
"typecheck": "tsc --noEmit && tsc-strict"
}, },
"dependencies": { "dependencies": {
"workbox-precaching": "^7.4.0" "workbox-precaching": "^7.4.0"
@@ -17,6 +18,7 @@
"@types/node": "^22.19.10", "@types/node": "^22.19.10",
"cross-env": "^10.1.0", "cross-env": "^10.1.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vite": "^7.3.1" "vite": "^7.3.1"
} }
} }

View File

@@ -10,7 +10,8 @@
"strict": false, "strict": false,
"types": ["vite/client"], "types": ["vite/client"],
"outDir": "dist", "outDir": "dist",
"rootDir": "src" "rootDir": "src",
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
}, },
"include": ["src/**/*"], "include": ["src/**/*"],
"exclude": ["node_modules"] "exclude": ["node_modules"]

View File

@@ -16,6 +16,7 @@
"start": "yarn build && node build/app", "start": "yarn build && node build/app",
"start-monitor": "nodemon --exec 'yarn build && node build/app' --ignore './build/**/*' --ext 'ts,js' build/app", "start-monitor": "nodemon --exec 'yarn build && node build/app' --ignore './build/**/*' --ext 'ts,js' build/app",
"build": "tsc && yarn add-import-extensions && yarn copy-static-assets", "build": "tsc && yarn add-import-extensions && yarn copy-static-assets",
"typecheck": "tsc --noEmit && tsc-strict",
"add-import-extensions": "node bin/add-import-extensions.mjs", "add-import-extensions": "node bin/add-import-extensions.mjs",
"copy-static-assets": "rm -rf build/src/sql && cp -r src/sql build/src/sql", "copy-static-assets": "rm -rf build/src/sql && cp -r src/sql build/src/sql",
"test": "NODE_ENV=test NODE_OPTIONS='--experimental-vm-modules --import ./register-loader.mjs --trace-warnings' vitest --run", "test": "NODE_ENV=test NODE_OPTIONS='--experimental-vm-modules --import ./register-loader.mjs --trace-warnings' vitest --run",
@@ -64,6 +65,7 @@
"nodemon": "^3.1.11", "nodemon": "^3.1.11",
"supertest": "^7.2.2", "supertest": "^7.2.2",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vitest": "^4.0.18" "vitest": "^4.0.18"
} }
} }

View File

@@ -3,7 +3,8 @@
"compilerOptions": { "compilerOptions": {
"lib": ["ES2021"], "lib": ["ES2021"],
"noEmit": false, "noEmit": false,
"outDir": "build" "outDir": "build",
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
}, },
"include": [ "include": [
"src/**/*", "src/**/*",

View File

@@ -36,13 +36,7 @@
"@desktop-client/e2e/*": ["./packages/desktop-client/e2e/*"], "@desktop-client/e2e/*": ["./packages/desktop-client/e2e/*"],
// Allow importing from hyperformula's internal typings for custom function plugins // Allow importing from hyperformula's internal typings for custom function plugins
"hyperformula/typings/*": ["./node_modules/hyperformula/typings/*"] "hyperformula/typings/*": ["./node_modules/hyperformula/typings/*"]
}, }
"plugins": [
{
"name": "typescript-strict-plugin",
"path": ["./packages"]
}
]
}, },
"include": ["packages/**/*", "bin/*.ts"], "include": ["packages/**/*", "bin/*.ts"],
"exclude": [ "exclude": [

5
tsconfig.root.json Normal file
View File

@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["bin/*.ts"],
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---
TypeScript: individual tsconfig files per package, running via lage

View File

@@ -29,6 +29,7 @@ __metadata:
node-fetch: "npm:^3.3.2" node-fetch: "npm:^3.3.2"
tsc-alias: "npm:^1.8.16" tsc-alias: "npm:^1.8.16"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
uuid: "npm:^13.0.0" uuid: "npm:^13.0.0"
vitest: "npm:^4.0.18" vitest: "npm:^4.0.18"
languageName: unknown languageName: unknown
@@ -128,6 +129,7 @@ __metadata:
pluggy-sdk: "npm:^0.83.0" pluggy-sdk: "npm:^0.83.0"
supertest: "npm:^7.2.2" supertest: "npm:^7.2.2"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
uuid: "npm:^13.0.0" uuid: "npm:^13.0.0"
vitest: "npm:^4.0.18" vitest: "npm:^4.0.18"
winston: "npm:^3.19.0" winston: "npm:^3.19.0"
@@ -212,6 +214,8 @@ __metadata:
remark-gfm: "npm:^4.0.1" remark-gfm: "npm:^4.0.1"
rollup-plugin-visualizer: "npm:^6.0.5" rollup-plugin-visualizer: "npm:^6.0.5"
sass: "npm:^1.97.3" sass: "npm:^1.97.3"
typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
usehooks-ts: "npm:^3.1.1" usehooks-ts: "npm:^3.1.1"
uuid: "npm:^13.0.0" uuid: "npm:^13.0.0"
vite: "npm:^7.3.1" vite: "npm:^7.3.1"
@@ -4508,11 +4512,11 @@ __metadata:
linkType: hard linkType: hard
"@isaacs/brace-expansion@npm:^5.0.0": "@isaacs/brace-expansion@npm:^5.0.0":
version: 5.0.1 version: 5.0.0
resolution: "@isaacs/brace-expansion@npm:5.0.1" resolution: "@isaacs/brace-expansion@npm:5.0.0"
dependencies: dependencies:
"@isaacs/balanced-match": "npm:^4.0.1" "@isaacs/balanced-match": "npm:^4.0.1"
checksum: 10/aec226065bc4285436a27379e08cc35bf94ef59f5098ac1c026495c9ba4ab33d851964082d3648d56d63eb90f2642867bd15a3e1b810b98beb1a8c14efce6a94 checksum: 10/cf3b7f206aff12128214a1df764ac8cdbc517c110db85249b945282407e3dfc5c6e66286383a7c9391a059fc8e6e6a8ca82262fc9d2590bd615376141fbebd2d
languageName: node languageName: node
linkType: hard linkType: hard
@@ -10791,7 +10795,6 @@ __metadata:
source-map-support: "npm:^0.5.21" source-map-support: "npm:^0.5.21"
ts-node: "npm:^10.9.2" ts-node: "npm:^10.9.2"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@@ -14414,6 +14417,7 @@ __metadata:
fs-extra: "npm:^11.3.3" fs-extra: "npm:^11.3.3"
promise-retry: "npm:^2.0.1" promise-retry: "npm:^2.0.1"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@@ -19687,6 +19691,7 @@ __metadata:
stream-browserify: "npm:^3.0.0" stream-browserify: "npm:^3.0.0"
ts-node: "npm:^10.9.2" ts-node: "npm:^10.9.2"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
ua-parser-js: "npm:^2.0.9" ua-parser-js: "npm:^2.0.9"
uuid: "npm:^13.0.0" uuid: "npm:^13.0.0"
vite: "npm:^7.3.1" vite: "npm:^7.3.1"
@@ -22681,6 +22686,7 @@ __metadata:
"@types/node": "npm:^22.19.10" "@types/node": "npm:^22.19.10"
cross-env: "npm:^10.1.0" cross-env: "npm:^10.1.0"
typescript: "npm:^5.9.3" typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"
vite: "npm:^7.3.1" vite: "npm:^7.3.1"
workbox-precaching: "npm:^7.4.0" workbox-precaching: "npm:^7.4.0"
languageName: unknown languageName: unknown