Skip to content

Commit

Permalink
core(tsc): add base tsconfig for config inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Sep 15, 2021
1 parent 06bdf13 commit f3700cc
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 141 deletions.
30 changes: 9 additions & 21 deletions flow-report/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../.tmp/tsbuildinfo/flow-report",

// Project has real tsc output (and declaration was interfering with build).
// see https://github.com/GoogleChrome/lighthouse/pull/12929
"emitDeclarationOnly": false,
"declarationMap": true,

// Limit to base JS and DOM defs.
"lib": ["es2020", "dom", "dom.iterable"],
// Selectively include types from node_modules.
// Selectively include types from node_modules/.
"types": ["node", "jest"],
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,

"jsx": "react-jsx",
"jsxImportSource": "preact",
},
"references": [
{"path": "../types/lhr/"},
{"path": "../report"},
],
"include": [
"**/*.ts",
"**/*.tsx",
"./types",
],
"references": [
{"path": "../types/lhr/"},
{"path": "../report"},
],
}
28 changes: 6 additions & 22 deletions lighthouse-treemap/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../.tmp/tsbuildinfo/lighthouse-treemap",
"emitDeclarationOnly": true,
"declarationMap": true,

// Limit to base JS and DOM defs.
"lib": ["es2020", "dom", "dom.iterable"],
// Selectively include types from node_modules.
// Selectively include types from node_modules/.
"types": ["tabulator-tables"],
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,
},
"include": [
"app/src/**/*.js",
"types/**/*.d.ts",
],
"references": [
{"path": "../types/lhr/"},
{"path": "../report/"},
{"path": "../lighthouse-viewer/"},
],
"include": [
"app/src/**/*.js",
"types/**/*.d.ts",
],
}
28 changes: 6 additions & 22 deletions lighthouse-viewer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../.tmp/tsbuildinfo/lighthouse-viewer",
"emitDeclarationOnly": true,
"declarationMap": true,

// Limit to base JS and DOM defs.
"lib": ["es2020", "dom", "dom.iterable"],
// Don't include any types from node_modules.
// Don't include any types from node_modules/.
"types": [],
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,
},
"include": [
"app/src/**/*.js",
"./types/*.d.ts",
],
"references": [
{"path": "../types/lhr/"},
{"path": "../report/"}
],
"include": [
"app/src/**/*.js",
"./types/*.d.ts",
],
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"dogfood-lhci": "./lighthouse-core/scripts/dogfood-lhci.sh",
"timing-trace": "node lighthouse-core/scripts/generate-timing-trace.js",
"changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file",
"type-check": "tsc --build ./ report/ lighthouse-viewer/ lighthouse-treemap/ flow-report/",
"type-check": "tsc --build ./tsconfig-base.json",
"i18n:checks": "./lighthouse-core/scripts/i18n/assert-strings-collected.sh",
"i18n:collect-strings": "node lighthouse-core/scripts/i18n/collect-strings.js",
"update:lantern-baseline": "node lighthouse-core/scripts/lantern/update-baseline-lantern-values.js",
Expand Down Expand Up @@ -173,7 +173,7 @@
"terser": "^5.3.8",
"ts-jest": "^27.0.4",
"typed-query-selector": "^2.4.0",
"typescript": "4.4.2",
"typescript": "4.4.3",
"webtreemap-cdt": "^3.2.1"
},
"dependencies": {
Expand Down
21 changes: 5 additions & 16 deletions report/generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
{
"extends": "../../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../../.tmp/tsbuildinfo/report/generator",
"emitDeclarationOnly": true,
"declarationMap": true,

"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,
// Limit defs to base JS and DOM (for URL: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960).
"lib": ["es2020", "dom"],
// Only include `@types/node` from node_modules/.
"types": ["node"],
},
"references": [
{"path": "../../types/lhr/"},
Expand Down
27 changes: 6 additions & 21 deletions report/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../.tmp/tsbuildinfo/report",
"emitDeclarationOnly": true,
"declarationMap": true,

// Limit to base JS and DOM defs.
"lib": ["es2020", "dom", "dom.iterable"],
// Don't include any types from node_modules.
// Don't include any types from node_modules/.
"types": [],
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,
},
"include": [
"**/*.js",
"types/**/*.d.ts",
],
"references": [
{"path": "../types/lhr/"},
{"path": "./generator/"}
],
"include": [
"**/*.js",
"types/**/*.d.ts",
],
"exclude": [
"generator/**/*.js",
// These test files require further changes before they can be type checked.
Expand Down
38 changes: 38 additions & 0 deletions tsconfig-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Base compiler options and all compilation entry points.

{
"compilerOptions": {
"composite": true,
"emitDeclarationOnly": true,
"declarationMap": true,

"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,

"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,

// "listFiles": true,
// "noErrorTruncation": true,
"extendedDiagnostics": true,
},
// `references` is not inherited by extending tsconfigs. This is a list of all
// project references so `tsc --build tsconfig-base.json` can type check all files.
"references": [
{"path": "./"},
{"path": "./types/lhr/"},
{"path": "./report/"},
{"path": "./report/generator/"},
{"path": "./lighthouse-viewer/"},
{"path": "./lighthouse-treemap/"},
{"path": "./flow-report/"},
],
"files": [],
"include": [],
"exclude": [],
}
27 changes: 8 additions & 19 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"emitDeclarationOnly": true,
"module": "commonjs",
"target": "ES2020",
"allowJs": true,
"checkJs": true,
"strict": true,
// TODO: remove the next line to be fully `strict`.
"useUnknownInCatchVariables": false,
// "listFiles": true,
// "noErrorTruncation": true,
"outDir": ".tmp/tsbuildinfo/",

// TODO(esmodules): included to support require('file.json'). Remove on the switch to ES Modules.
"resolveJsonModule": true,
"diagnostics": true,
"composite": true,
"outDir": ".tmp/tsbuildinfo/",
"esModuleInterop": true,
},
"references": [
{"path": "./types/lhr/"},
{"path": "./report/"},
{"path": "./report/generator/"},
],
"include": [
"root.js",
"lighthouse-cli/**/*.js",
Expand All @@ -36,11 +30,6 @@
"third-party/snyk/snapshot.json",
"lighthouse-core/audits/byte-efficiency/polyfill-graph-data.json",
],
"references": [
{"path": "./types/lhr/"},
{"path": "./report/"},
{"path": "./report/generator/"},
],
"exclude": [
"lighthouse-core/test/audits/**/*.js",
"lighthouse-core/test/fixtures/**/*.js",
Expand Down
18 changes: 4 additions & 14 deletions types/lhr/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
{
"extends": "../../tsconfig-base.json",
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"esModuleInterop": true,
"moduleResolution": "node",

"strict": true,
"extendedDiagnostics": true,
"outDir": "../../.tmp/tsbuildinfo/types/lhr",

// We only need the base JS definitions, no libs in node_modules, no DOM, etc.
// We only need the base JS definitions, no DOM, etc.
"lib": ["esnext"],
// Don't include any types from node_modules/.
"types": [],

// "listFiles": true,
// "noErrorTruncation": true,

"composite": true,
"outDir": "../../.tmp/tsbuildinfo/types/lhr",
},
"include": [
"*.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8496,10 +8496,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

[email protected].2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==
[email protected].3:
version "4.4.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==

uglify-js@^3.1.4:
version "3.4.9"
Expand Down

0 comments on commit f3700cc

Please sign in to comment.