Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(tsc): add base tsconfig for config inheritance #13072

Merged
merged 3 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions flow-report/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../.tmp/tsbuildinfo/flow-report",
"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",
],
}
2 changes: 1 addition & 1 deletion 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-all.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
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
15 changes: 15 additions & 0 deletions tsconfig-all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Compilation entry point for all tsc projects within Lighthouse.

{
"references": [
{"path": "./"},
{"path": "./types/lhr/"},
{"path": "./report/"},
{"path": "./report/generator/"},
{"path": "./lighthouse-viewer/"},
{"path": "./lighthouse-treemap/"},
{"path": "./flow-report/"},
],
"files": [],
"include": [],
}
24 changes: 24 additions & 0 deletions tsconfig-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Base compiler options for all tsconfig files.

{
"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,
},
}
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