Skip to content

Commit

Permalink
Refactor tsconfigs to share compiler options
Browse files Browse the repository at this point in the history
This lets each config specify *only* how it actually does a build (or
not!), while sharing the config explicitly.

It also fixes an existing bug in the compilation settings which was not
affecting *normal* TS compilation with `tsc`, but was generating noise
in the `broccoli-typescript-compiler` pipeline because the packages
happened to be resolved in a different order such that the `loader`
"package" definition, and its declaration of the `require` module, was
not present in the graph. Set it explicitly in `compilerOptiosn.paths`
to fix that.
  • Loading branch information
chriskrycho committed Nov 22, 2022
1 parent 9c4962b commit 4e62cd6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 33 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
* text=auto

# Tell GH to render all tsconfigs in the tsconfig dir correctly.
tsconfig/*.json linguist-language=JSON-with-Comments
34 changes: 2 additions & 32 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
{
"extends": "./tsconfig/compiler-options.json",
"compilerOptions": {
// Compilation Configuration
"target": "es2017",
"sourceMap": true,
"outDir": "dist",
"baseUrl": "packages",
"rootDir": "packages",

// Environment Configuration
"experimentalDecorators": true,
"moduleResolution": "node",

// Enhance Strictness
"strict": true,
"noImplicitReturns": true,
"allowUnreachableCode": false,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUncheckedIndexedAccess": true,
"noUnusedParameters": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,

"newLine": "LF",
"noEmit": true,

"allowJs": true,
"checkJs": false,

"paths": {
"backburner": ["../node_modules/backburner.js/dist/backburner.d.ts"]
}
"noEmit": true
},

"include": ["packages/**/*.ts"],

"exclude": ["dist", "node_modules", "tmp", "types"]
}
35 changes: 35 additions & 0 deletions tsconfig/compiler-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
// Compilation Configuration
"target": "es2019",
"sourceMap": true,
"baseUrl": "../packages",
"rootDir": "../packages",

// Environment Configuration
"experimentalDecorators": true,
"moduleResolution": "node",

// Enhance Strictness
"strict": true,
"noImplicitReturns": true,
"allowUnreachableCode": false,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUncheckedIndexedAccess": true,
"noUnusedParameters": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,

"newLine": "LF",

"allowJs": true,
"checkJs": false,

"paths": {
"backburner": ["../node_modules/backburner.js/dist/backburner.d.ts"],
"require": ["./loader/lib/index.d.ts"]
}
}
}

0 comments on commit 4e62cd6

Please sign in to comment.