mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-08 21:53:44 -05:00
[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:
committed by
GitHub
parent
cfc18c240a
commit
31a027fc64
@@ -1,6 +1,9 @@
|
||||
/** @type {import('lage').ConfigOptions} */
|
||||
module.exports = {
|
||||
pipeline: {
|
||||
typecheck: {
|
||||
type: 'npmScript',
|
||||
},
|
||||
test: {
|
||||
type: 'npmScript',
|
||||
options: {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
"lint": "oxfmt --check . && oxlint --type-aware",
|
||||
"lint:fix": "oxfmt . && oxlint --fix --type-aware",
|
||||
"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",
|
||||
"prepare": "husky"
|
||||
},
|
||||
@@ -84,8 +84,7 @@
|
||||
"prompts": "^2.4.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4"
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"rollup": "4.40.1",
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
"scripts": {
|
||||
"build:app": "yarn workspace loot-core build:api",
|
||||
"build:crdt": "yarn workspace @actual-app/crdt build",
|
||||
"build:node": "tsc --p tsconfig.dist.json && tsc-alias -p tsconfig.dist.json",
|
||||
"build:migrations": "cp migrations/*.sql dist/migrations",
|
||||
"build:node": "tsc && tsc-alias",
|
||||
"build:migrations": "mkdir dist/migrations && cp migrations/*.sql dist/migrations",
|
||||
"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",
|
||||
"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": {
|
||||
"@actual-app/crdt": "workspace:^",
|
||||
@@ -29,6 +30,7 @@
|
||||
"devDependencies": {
|
||||
"tsc-alias": "^1.8.16",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
"declarationDir": "@types",
|
||||
"paths": {
|
||||
"loot-core/*": ["./@types/loot-core/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["."],
|
||||
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
|
||||
},
|
||||
"include": [".", "../../packages/loot-core/typings/pegjs.ts"],
|
||||
"exclude": ["**/node_modules/*", "dist", "@types", "*.test.ts"]
|
||||
}
|
||||
@@ -39,7 +39,8 @@
|
||||
"test": "npm-run-all -cp 'test:*'",
|
||||
"test:web": "ENV=web vitest --run -c vitest.web.config.ts",
|
||||
"start:storybook": "storybook dev -p 6006",
|
||||
"build:storybook": "storybook build"
|
||||
"build:storybook": "storybook build",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.13.5",
|
||||
|
||||
10
packages/component-library/tsconfig.json
Normal file
10
packages/component-library/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"rootDir": "src",
|
||||
"strict": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -9,10 +9,11 @@
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build:node": "tsc --p tsconfig.dist.json",
|
||||
"build:node": "tsc",
|
||||
"proto:generate": "./bin/generate-proto",
|
||||
"build": "rm -rf dist && yarn run build:node",
|
||||
"test": "vitest --run"
|
||||
"test": "vitest --run",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"google-protobuf": "^3.21.4",
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
"test": "vitest --run",
|
||||
"e2e": "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": {
|
||||
"@actual-app/components": "workspace:*",
|
||||
@@ -90,6 +91,8 @@
|
||||
"remark-gfm": "^4.0.1",
|
||||
"rollup-plugin-visualizer": "^6.0.5",
|
||||
"sass": "^1.97.3",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4",
|
||||
"usehooks-ts": "^3.1.1",
|
||||
"uuid": "^13.0.0",
|
||||
"vite": "^7.3.1",
|
||||
|
||||
22
packages/desktop-client/tsconfig.json
Normal file
22
packages/desktop-client/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
"clean": "rm -rf dist",
|
||||
"update-client": "bin/update-client",
|
||||
"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",
|
||||
"watch": "yarn build:dist && cross-env ACTUAL_DOCUMENT_DIR=\"../../data\" ACTUAL_DATA_DIR=\"../../data\" electron .",
|
||||
"e2e": "npx playwright test"
|
||||
@@ -29,7 +30,8 @@
|
||||
"cross-env": "^10.1.0",
|
||||
"electron": "39.2.7",
|
||||
"electron-builder": "26.4.0",
|
||||
"typescript": "^5.9.3"
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4"
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.actualbudget.actual",
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"outDir": "build",
|
||||
"rootDir": ".."
|
||||
"rootDir": "..",
|
||||
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
|
||||
},
|
||||
"include": ["."],
|
||||
"include": [".", "../../packages/loot-core/typings/window.ts"],
|
||||
"exclude": [
|
||||
"**/node_modules/*",
|
||||
"build/**/*",
|
||||
@@ -60,7 +60,8 @@
|
||||
"generate:i18n": "i18next",
|
||||
"test": "npm-run-all -cp 'test:*'",
|
||||
"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": {
|
||||
"@jlongster/sql.js": "^1.6.7",
|
||||
@@ -81,6 +82,8 @@
|
||||
"memoize-one": "^6.0.0",
|
||||
"mitt": "^3.0.1",
|
||||
"slash": "5.1.0",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4",
|
||||
"ua-parser-js": "^2.0.9",
|
||||
"uuid": "^13.0.0"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"declaration": true,
|
||||
|
||||
21
packages/loot-core/tsconfig.json
Normal file
21
packages/loot-core/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
12
packages/loot-core/typings/process-worker.ts
Normal file
12
packages/loot-core/typings/process-worker.ts
Normal 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 {};
|
||||
@@ -51,6 +51,11 @@ type Actual = {
|
||||
declare global {
|
||||
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 currentMonth: string | null;
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"scripts": {
|
||||
"build": "cross-env NODE_ENV=production ./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": {
|
||||
"workbox-precaching": "^7.4.0"
|
||||
@@ -17,6 +18,7 @@
|
||||
"@types/node": "^22.19.10",
|
||||
"cross-env": "^10.1.0",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4",
|
||||
"vite": "^7.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"strict": false,
|
||||
"types": ["vite/client"],
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
"rootDir": "src",
|
||||
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"start": "yarn build && node 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",
|
||||
"typecheck": "tsc --noEmit && tsc-strict",
|
||||
"add-import-extensions": "node bin/add-import-extensions.mjs",
|
||||
"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",
|
||||
@@ -64,6 +65,7 @@
|
||||
"nodemon": "^3.1.11",
|
||||
"supertest": "^7.2.2",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-strict-plugin": "^2.4.4",
|
||||
"vitest": "^4.0.18"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2021"],
|
||||
"noEmit": false,
|
||||
"outDir": "build"
|
||||
"outDir": "build",
|
||||
"plugins": [{ "name": "typescript-strict-plugin", "paths": ["."] }]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
|
||||
@@ -36,13 +36,7 @@
|
||||
"@desktop-client/e2e/*": ["./packages/desktop-client/e2e/*"],
|
||||
// Allow importing from hyperformula's internal typings for custom function plugins
|
||||
"hyperformula/typings/*": ["./node_modules/hyperformula/typings/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-strict-plugin",
|
||||
"path": ["./packages"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["packages/**/*", "bin/*.ts"],
|
||||
"exclude": [
|
||||
|
||||
5
tsconfig.root.json
Normal file
5
tsconfig.root.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["bin/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
6
upcoming-release-notes/7019.md
Normal file
6
upcoming-release-notes/7019.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
TypeScript: individual tsconfig files per package, running via lage
|
||||
14
yarn.lock
14
yarn.lock
@@ -29,6 +29,7 @@ __metadata:
|
||||
node-fetch: "npm:^3.3.2"
|
||||
tsc-alias: "npm:^1.8.16"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
uuid: "npm:^13.0.0"
|
||||
vitest: "npm:^4.0.18"
|
||||
languageName: unknown
|
||||
@@ -128,6 +129,7 @@ __metadata:
|
||||
pluggy-sdk: "npm:^0.83.0"
|
||||
supertest: "npm:^7.2.2"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
uuid: "npm:^13.0.0"
|
||||
vitest: "npm:^4.0.18"
|
||||
winston: "npm:^3.19.0"
|
||||
@@ -212,6 +214,8 @@ __metadata:
|
||||
remark-gfm: "npm:^4.0.1"
|
||||
rollup-plugin-visualizer: "npm:^6.0.5"
|
||||
sass: "npm:^1.97.3"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
usehooks-ts: "npm:^3.1.1"
|
||||
uuid: "npm:^13.0.0"
|
||||
vite: "npm:^7.3.1"
|
||||
@@ -4508,11 +4512,11 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"@isaacs/brace-expansion@npm:^5.0.0":
|
||||
version: 5.0.1
|
||||
resolution: "@isaacs/brace-expansion@npm:5.0.1"
|
||||
version: 5.0.0
|
||||
resolution: "@isaacs/brace-expansion@npm:5.0.0"
|
||||
dependencies:
|
||||
"@isaacs/balanced-match": "npm:^4.0.1"
|
||||
checksum: 10/aec226065bc4285436a27379e08cc35bf94ef59f5098ac1c026495c9ba4ab33d851964082d3648d56d63eb90f2642867bd15a3e1b810b98beb1a8c14efce6a94
|
||||
checksum: 10/cf3b7f206aff12128214a1df764ac8cdbc517c110db85249b945282407e3dfc5c6e66286383a7c9391a059fc8e6e6a8ca82262fc9d2590bd615376141fbebd2d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -10791,7 +10795,6 @@ __metadata:
|
||||
source-map-support: "npm:^0.5.21"
|
||||
ts-node: "npm:^10.9.2"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -14414,6 +14417,7 @@ __metadata:
|
||||
fs-extra: "npm:^11.3.3"
|
||||
promise-retry: "npm:^2.0.1"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -19687,6 +19691,7 @@ __metadata:
|
||||
stream-browserify: "npm:^3.0.0"
|
||||
ts-node: "npm:^10.9.2"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
ua-parser-js: "npm:^2.0.9"
|
||||
uuid: "npm:^13.0.0"
|
||||
vite: "npm:^7.3.1"
|
||||
@@ -22681,6 +22686,7 @@ __metadata:
|
||||
"@types/node": "npm:^22.19.10"
|
||||
cross-env: "npm:^10.1.0"
|
||||
typescript: "npm:^5.9.3"
|
||||
typescript-strict-plugin: "npm:^2.4.4"
|
||||
vite: "npm:^7.3.1"
|
||||
workbox-precaching: "npm:^7.4.0"
|
||||
languageName: unknown
|
||||
|
||||
Reference in New Issue
Block a user