Extract tsconfig.base.json to obtain VSCode compatible tsconfig.json

VS Code requires all files including .d.ts files to be included in order
to correctly resolve their definitions. However, we can't add the
include and exclude keywords to the tsconfig.json, as that would break
inheriting tsconfig.json configurations.

Therefore, extract a tsconfig.base.json with the original configuration
and let tsconfig.json extend it. This should instruct VS Code to use the
tsconfig, which includes all files, while all other infrastructure can
remain working as-is.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=TypeScript update

Fixed: 1056211
Change-Id: Ib4d127c745a3e69fd8c8c77eb0fb20c3a68689b1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2095299
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
Tim van der Lippe
2020-03-16 11:15:51 +00:00
committed by Commit Bot
parent 45eb3ffb1e
commit e4a10affd8
9 changed files with 40 additions and 31 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = function(config) {
frameworks: ['mocha', 'chai', 'karma-typescript'],
karmaTypescriptConfig: {
tsconfig: './tsconfig.json',
tsconfig: './tsconfig.base.json',
compilerOptions: {
checkJs: false,
baseUrl: '.',
+1 -1
View File
@@ -11,5 +11,5 @@
"path": "../shared/tsconfig.json"
}
],
"extends": "../../tsconfig.json"
"extends": "../../tsconfig.base.json"
}
+1 -1
View File
@@ -11,5 +11,5 @@
"path": "../shared/tsconfig.json"
}
],
"extends": "../../tsconfig.json"
"extends": "../../tsconfig.base.json"
}
+1 -1
View File
@@ -11,5 +11,5 @@
"path": "../shared/tsconfig.json"
}
],
"extends": "../../tsconfig.json"
"extends": "../../tsconfig.base.json"
}
+1 -1
View File
@@ -7,5 +7,5 @@
"checkJs": false,
"allowJs": false
},
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
}
+2 -3
View File
@@ -23,7 +23,7 @@ finally:
NODE_LOCATION = devtools_paths.node_path()
ROOT_DIRECTORY_OF_REPOSITORY = path.join(_CURRENT_DIR, '..', '..')
ROOT_TS_CONFIG_LOCATION = path.join(ROOT_DIRECTORY_OF_REPOSITORY, 'tsconfig.json')
BASE_TS_CONFIG_LOCATION = path.join(ROOT_DIRECTORY_OF_REPOSITORY, 'tsconfig.base.json')
TYPES_NODE_MODULES_DIRECTORY = path.join(ROOT_DIRECTORY_OF_REPOSITORY, 'node_modules', '@types')
RESOURCES_INSPECTOR_PATH = path.join(os.getcwd(), 'resources', 'inspector')
@@ -54,8 +54,7 @@ def main():
parser.set_defaults(test_only=False)
opts = parser.parse_args()
with open(ROOT_TS_CONFIG_LOCATION) as root_tsconfig:
with open(BASE_TS_CONFIG_LOCATION) as root_tsconfig:
try:
tsconfig = json.loads(root_tsconfig.read())
except Exception as e:
+1 -1
View File
@@ -45,7 +45,7 @@ template("ts_library") {
])
inputs = [
"//$devtools_location/tsconfig.json",
"//$devtools_location/tsconfig.base.json",
"//$devtools_location/node_modules/typescript/lib/tsc.js",
"//$devtools_location/front_end/legacy/legacy-defs.d.ts",
"//$devtools_location/front_end/generated/protocol.d.ts",
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"baseUrl": ".",
"paths": {
"/front_end/*": ["front_end/*"]
},
"checkJs": true,
"allowJs": true,
"noEmitOnError": true,
"lib": [
"esnext",
"dom"
],
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
+8 -22
View File
@@ -1,24 +1,10 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"baseUrl": ".",
"paths": {
"/front_end/*": ["front_end/*"]
},
"checkJs": true,
"allowJs": true,
"noEmitOnError": true,
"lib": [
"esnext",
"dom"
],
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
"extends": "./tsconfig.base.json",
"include": [
"front_end/",
"test/"
],
"exclude": [
"front_end/externs.js"
]
}