Treat all tsconfig files as jsonc (#34781)
Treat all tsconfig files as jsonc.
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ module.exports = {
|
||||
'experimentalOperatorPosition': 'start',
|
||||
'overrides': [
|
||||
{
|
||||
files: ['build/commands/tsconfig.json'],
|
||||
files: ['tsconfig*.json'],
|
||||
options: {
|
||||
parser: 'jsonc',
|
||||
},
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.d.ts",
|
||||
"../../../components/definitions/*.d.ts"
|
||||
]
|
||||
"../../../components/definitions/*.d.ts",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"]
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"]
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
".*\\.css",
|
||||
],
|
||||
"CheckParseErrors": [
|
||||
".*tsconfig\\.json",
|
||||
".*tsconfig.*\\.json",
|
||||
"components/brave_ads/core/test/data/invalid\\.json",
|
||||
],
|
||||
"CheckNoBannedFunctions": [
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../../definitions/*.d.ts"]
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.d.ts",
|
||||
"../../../definitions/*.d.ts",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../../definitions/*.d.ts"]
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.d.ts",
|
||||
"../../../definitions/*.d.ts",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"]
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../definitions/*.d.ts"]
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../definitions/*.d.ts"],
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"**/*.d.ts",
|
||||
"../definitions/*.d.ts",
|
||||
"**/*.svg",
|
||||
"*/*.svg"
|
||||
]
|
||||
"*/*.svg",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react"
|
||||
"jsx": "react",
|
||||
},
|
||||
"extends": "../../../../tsconfig.json",
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"]
|
||||
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"],
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { load, write } from './lit_mangler'
|
||||
import childProcess from 'child_process'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import ts from 'typescript'
|
||||
|
||||
const baseDir = path.join(__dirname, '../../../')
|
||||
const tsConfigPath = path.join(baseDir, 'tsconfig-mangle.json')
|
||||
@@ -20,7 +21,14 @@ const tsConfigPath = path.join(baseDir, 'tsconfig-mangle.json')
|
||||
* @returns The path to the generated tsconfig
|
||||
*/
|
||||
const getTsConfigForFiles = (genDir: string, files: string[]) => {
|
||||
const tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf8'))
|
||||
const { config: tsConfig, error } = ts.readConfigFile(
|
||||
tsConfigPath,
|
||||
ts.sys.readFile,
|
||||
)
|
||||
if (error) {
|
||||
console.error('Error reading tsconfig:', error)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Override the include path to only include the lit_mangler and the file
|
||||
// we want to check
|
||||
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"target": "ESNext",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
"esModuleInterop": true,
|
||||
},
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
"./*.js",
|
||||
"./*.ts",
|
||||
"./*.mjs",
|
||||
"./*.mts"
|
||||
"./*.mts",
|
||||
],
|
||||
"exclude": []
|
||||
"exclude": [],
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
"include": [
|
||||
"./tools/chromium_src/lit_mangler.ts",
|
||||
"./tools/chromium_src/lit_mangler_cli.ts",
|
||||
"./chromium_src/**/*.lit_mangler.ts"
|
||||
"./chromium_src/**/*.lit_mangler.ts",
|
||||
],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"lit_mangler": ["./tools/chromium_src/lit_mangler/lit_mangler.ts"]
|
||||
"lit_mangler": ["./tools/chromium_src/lit_mangler/lit_mangler.ts"],
|
||||
},
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
"skipLibCheck": true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
"./components/definitions/*",
|
||||
"./components/**/storybook",
|
||||
"./components/**/stories/*.tsx",
|
||||
"./components/**/*.stories.tsx"
|
||||
"./components/**/*.stories.tsx",
|
||||
],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": true,
|
||||
"outDir": "./storybook_dist"
|
||||
}
|
||||
"outDir": "./storybook_dist",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
// we don't mistakenly resolve to a different build configuration,
|
||||
// hiding an error or a timing issue with the dev's
|
||||
// current build configuration.
|
||||
"paths": {}
|
||||
"paths": {},
|
||||
},
|
||||
"include": [
|
||||
"./components/definitions/*",
|
||||
"./components/brave_extension/extension/brave_extension/types/**/*"
|
||||
]
|
||||
"./components/brave_extension/extension/brave_extension/types/**/*",
|
||||
],
|
||||
}
|
||||
|
||||
+8
-8
@@ -17,7 +17,7 @@
|
||||
"es2017",
|
||||
"es2018",
|
||||
"es2019",
|
||||
"esnext"
|
||||
"esnext",
|
||||
],
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
@@ -44,7 +44,7 @@
|
||||
"../out/Component_arm64/gen/*",
|
||||
"../out/Static_arm64/gen/*",
|
||||
"../out/Release_arm64/gen/*",
|
||||
"../out/Debug_arm64/gen/*"
|
||||
"../out/Debug_arm64/gen/*",
|
||||
],
|
||||
"//resources/mojo/*": [
|
||||
"../out/Component/gen/ui/webui/resources/tsc/mojo/*",
|
||||
@@ -54,7 +54,7 @@
|
||||
"../out/Component_arm64/gen/ui/webui/resources/tsc/mojo/*",
|
||||
"../out/Static_arm64/gen/ui/webui/resources/tsc/mojo/*",
|
||||
"../out/Release_arm64/gen/ui/webui/resources/tsc/mojo/*",
|
||||
"../out/Debug_arm64/gen/ui/webui/resources/tsc/mojo/*"
|
||||
"../out/Debug_arm64/gen/ui/webui/resources/tsc/mojo/*",
|
||||
],
|
||||
"chrome://resources/*": [
|
||||
"../out/Component/gen/ui/webui/resources/tsc/*",
|
||||
@@ -64,7 +64,7 @@
|
||||
"../out/Component_arm64/gen/ui/webui/resources/tsc/*",
|
||||
"../out/Static_arm64/gen/ui/webui/resources/tsc/*",
|
||||
"../out/Release_arm64/gen/ui/webui/resources/tsc/*",
|
||||
"../out/Debug_arm64/gen/ui/webui/resources/tsc/*"
|
||||
"../out/Debug_arm64/gen/ui/webui/resources/tsc/*",
|
||||
],
|
||||
"chrome://resources/brave/*": [
|
||||
"../out/Component/gen/brave/ui/webui/resources/tsc/*",
|
||||
@@ -74,16 +74,16 @@
|
||||
"../out/Component_arm64/gen/brave/ui/webui/resources/tsc/*",
|
||||
"../out/Static_arm64/gen/brave/ui/webui/resources/tsc/*",
|
||||
"../out/Release_arm64/gen/brave/ui/webui/resources/tsc/*",
|
||||
"../out/Debug_arm64/gen/brave/ui/webui/resources/tsc/*"
|
||||
"../out/Debug_arm64/gen/brave/ui/webui/resources/tsc/*",
|
||||
],
|
||||
"$web-common/*": ["components/common/*"]
|
||||
"$web-common/*": ["components/common/*"],
|
||||
},
|
||||
"typeRoots": ["./node_modules/@types", "./components/definitions"],
|
||||
// optional
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitReturns": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": true
|
||||
"noUnusedLocals": true,
|
||||
},
|
||||
"include": []
|
||||
"include": [],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user