CI failed @homarr/docs:typecheck with a wall of TS1473 "An import declaration can only be used at the top level of a module" pointing at build/__server/assets/js/*.js - Docusaurus's own emitted bundles, not source. The docs tsconfig includes **/*.js with allowJs enabled and excludes only node_modules, so anything the build writes into the package is typechecked as source. The turbo `typecheck` task dependsOn ["^topo"] and not on its own package's `build`, so `docusaurus build` and `tsc --noEmit` run concurrently - and tsc can observe the transient build/__server/ directory before the build removes it again. That makes it a latent race rather than a deterministic failure, which is why it has not bitten before: it needs @homarr/docs to be in the affected set, and merging dev brought apps/docs changes in. Locally it passes either way, because a completed build leaves no __server directory behind. Verified against a control rather than assumed: with build/__server/assets/js containing a nested import declaration, the current tsconfig reports 0 errors and the same tsconfig without the exclude reports the 2 TS1473 errors, matching CI.
36 lines
1.1 KiB
JSON
36 lines
1.1 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
"allowJs": true,
|
|
"skipLibCheck": true,
|
|
"strict": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"noEmit": true,
|
|
"esModuleInterop": true,
|
|
"module": "esnext",
|
|
"moduleResolution": "bundler",
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"jsx": "preserve",
|
|
"incremental": true,
|
|
"paths": {
|
|
"@site/*": ["./*"]
|
|
},
|
|
},
|
|
"include": [
|
|
"**/*.ts",
|
|
"**/*.jsx",
|
|
"**/*.js",
|
|
"**/*.tsx",
|
|
"**/*.md",
|
|
"**/*.mdx",
|
|
],
|
|
// `include` sweeps up **/*.js and allowJs is on, so anything the build emits into this package is
|
|
// typechecked as source. The turbo `typecheck` task only dependsOn ["^topo"], not on its own
|
|
// package's `build`, so `docusaurus build` and `tsc --noEmit` run concurrently - and tsc can observe
|
|
// Docusaurus's transient `build/__server/` bundles and fail with TS1473 before the build removes
|
|
// them. Excluding generated output makes typecheck independent of that scheduling.
|
|
"exclude": ["node_modules", "build", ".docusaurus"],
|
|
}
|