Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
Force fork-ts-checker to watch all TS files in the repo
Browse files Browse the repository at this point in the history
There is an issue with fork-ts-checker (or perhaps we are misusing it) such that it does not re-typecheck the correct files when a change is made in the app, most notably for files that only export types. (TypeStrong/fork-ts-checker-webpack-plugin#611)

This change forces it to look at these files in our package source directories rather than the symlinks in node_modules created by yarn workspaces. Now they are correctly watched and new type errors show up when a type-only file is edited.
  • Loading branch information
jtbandes committed May 15, 2021
1 parent a1fdbcb commit 92ea276
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
10 changes: 9 additions & 1 deletion desktop/main/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*"],
"include": [
"./**/*",
// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/*.ts",
"../../package.json",
"../../packages/log/src/**/*"
],
"compilerOptions": {
"rootDir": "../..",
"noEmit": true
}
}
15 changes: 13 additions & 2 deletions desktop/preload/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*", "../common/types.ts"],
"include": [
"./**/*",
"../common/types.ts",

// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/*.ts",
"../../package.json",
"../../packages/electron-socket/*",
"../../packages/electron-socket/src/**/*",
"../../packages/log/src/**/*"
],
"compilerOptions": {
"rootDir": "../",
"rootDir": "../..",
"noEmit": true,
"lib": ["dom", "es2020"]
}
Expand Down
18 changes: 16 additions & 2 deletions desktop/renderer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*", "../common/**/*"],
"include": [
"./**/*",
"../common/**/*",

// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/**/*",
"../../app/**/*.json",
"../../app/.storybook/**/*",
"../../package.json",
"../../packages/@foxglove/*/src/**/*",
"../../packages/*/src/**/*",
"../../packages/electron-socket/*",
"../../packages/velodyne-cloud/src/**/*.json"
],
"compilerOptions": {
"rootDir": "../",
"rootDir": "../..",
"noEmit": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "es2020"]
Expand Down
11 changes: 10 additions & 1 deletion packages/@foxglove/tsconfig/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,

// These paths are added to ensure that fork-ts-checker correctly typechecks changed files.
// Using these resolutions will force TS to give us an error if we forgot to add these files to
// one of our tsconfig "include"s.
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"paths": {
"@foxglove-studio/app/*": ["../../../app/*"],
"@foxglove/*": ["../../../packages/*", "../../../packages/foxglove/*"]
}
}
}

0 comments on commit 92ea276

Please sign in to comment.