diff --git a/.prettierrc.js b/.prettierrc.js index 09e067316e2..9a0bbb28d83 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -28,7 +28,7 @@ module.exports = { 'experimentalOperatorPosition': 'start', 'overrides': [ { - files: ['build/commands/tsconfig.json'], + files: ['tsconfig*.json'], options: { parser: 'jsonc', }, diff --git a/browser/resources/ai_chat_agent_new_tab_page/tsconfig.json b/browser/resources/ai_chat_agent_new_tab_page/tsconfig.json index 58d7cfb0733..73f10c1bc17 100644 --- a/browser/resources/ai_chat_agent_new_tab_page/tsconfig.json +++ b/browser/resources/ai_chat_agent_new_tab_page/tsconfig.json @@ -4,6 +4,6 @@ "**/*.ts", "**/*.tsx", "**/*.d.ts", - "../../../components/definitions/*.d.ts" - ] + "../../../components/definitions/*.d.ts", + ], } diff --git a/browser/resources/brave_new_tab_page_refresh/tsconfig.json b/browser/resources/brave_new_tab_page_refresh/tsconfig.json index 60fcc51f0d9..00c8b4b2501 100644 --- a/browser/resources/brave_new_tab_page_refresh/tsconfig.json +++ b/browser/resources/brave_new_tab_page_refresh/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"] + "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"], } diff --git a/browser/resources/brave_welcome_page/tsconfig.json b/browser/resources/brave_welcome_page/tsconfig.json index 60fcc51f0d9..00c8b4b2501 100644 --- a/browser/resources/brave_welcome_page/tsconfig.json +++ b/browser/resources/brave_welcome_page/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"] + "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"], } diff --git a/chromium_presubmit_config.json5 b/chromium_presubmit_config.json5 index 947305e61b8..3e4d4a9e991 100644 --- a/chromium_presubmit_config.json5 +++ b/chromium_presubmit_config.json5 @@ -93,7 +93,7 @@ ".*\\.css", ], "CheckParseErrors": [ - ".*tsconfig\\.json", + ".*tsconfig.*\\.json", "components/brave_ads/core/test/data/invalid\\.json", ], "CheckNoBannedFunctions": [ diff --git a/components/ai_chat/resources/page/tsconfig.json b/components/ai_chat/resources/page/tsconfig.json index 50138ad36d1..5ccb3f7f7b3 100644 --- a/components/ai_chat/resources/page/tsconfig.json +++ b/components/ai_chat/resources/page/tsconfig.json @@ -1,4 +1,9 @@ { "extends": "../../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../../definitions/*.d.ts"] + "include": [ + "**/*.ts", + "**/*.tsx", + "**/*.d.ts", + "../../../definitions/*.d.ts", + ], } diff --git a/components/ai_chat/resources/untrusted_conversation_frame/tsconfig.json b/components/ai_chat/resources/untrusted_conversation_frame/tsconfig.json index 50138ad36d1..5ccb3f7f7b3 100644 --- a/components/ai_chat/resources/untrusted_conversation_frame/tsconfig.json +++ b/components/ai_chat/resources/untrusted_conversation_frame/tsconfig.json @@ -1,4 +1,9 @@ { "extends": "../../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../../definitions/*.d.ts"] + "include": [ + "**/*.ts", + "**/*.tsx", + "**/*.d.ts", + "../../../definitions/*.d.ts", + ], } diff --git a/components/brave_rewards/resources/tsconfig.json b/components/brave_rewards/resources/tsconfig.json index 510921af711..6e769d6f06e 100644 --- a/components/brave_rewards/resources/tsconfig.json +++ b/components/brave_rewards/resources/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"] + "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../definitions/*.d.ts"], } diff --git a/components/brave_shields/resources/panel_new/tsconfig.json b/components/brave_shields/resources/panel_new/tsconfig.json index 6783562bb2d..aebeb7f5f94 100644 --- a/components/brave_shields/resources/panel_new/tsconfig.json +++ b/components/brave_shields/resources/panel_new/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../../tsconfig", - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../definitions/*.d.ts"] + "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../definitions/*.d.ts"], } diff --git a/components/brave_wallet_ui/tsconfig.json b/components/brave_wallet_ui/tsconfig.json index 1b2022dc0af..b024145a59e 100644 --- a/components/brave_wallet_ui/tsconfig.json +++ b/components/brave_wallet_ui/tsconfig.json @@ -6,6 +6,6 @@ "**/*.d.ts", "../definitions/*.d.ts", "**/*.svg", - "*/*.svg" - ] + "*/*.svg", + ], } diff --git a/components/email_aliases/resources/tsconfig.json b/components/email_aliases/resources/tsconfig.json index f5c5ee00343..af86d306d32 100644 --- a/components/email_aliases/resources/tsconfig.json +++ b/components/email_aliases/resources/tsconfig.json @@ -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"], } diff --git a/tools/chromium_src/lit_mangler/lit_mangler_cli.ts b/tools/chromium_src/lit_mangler/lit_mangler_cli.ts index 11256e74e7c..572f5908b4a 100644 --- a/tools/chromium_src/lit_mangler/lit_mangler_cli.ts +++ b/tools/chromium_src/lit_mangler/lit_mangler_cli.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 diff --git a/tsconfig-jest.json b/tsconfig-jest.json index 2c61d8846e6..d304806efba 100644 --- a/tsconfig-jest.json +++ b/tsconfig-jest.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "ESNext", "target": "ESNext", - "esModuleInterop": true - } + "esModuleInterop": true, + }, } diff --git a/tsconfig-lint.json b/tsconfig-lint.json index c3ce80aa686..d41707955dd 100644 --- a/tsconfig-lint.json +++ b/tsconfig-lint.json @@ -8,7 +8,7 @@ "./*.js", "./*.ts", "./*.mjs", - "./*.mts" + "./*.mts", ], - "exclude": [] + "exclude": [], } diff --git a/tsconfig-mangle.json b/tsconfig-mangle.json index c08e6839394..c871bbb4cfd 100644 --- a/tsconfig-mangle.json +++ b/tsconfig-mangle.json @@ -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, + }, } diff --git a/tsconfig-storybook.json b/tsconfig-storybook.json index 7c198f6c3b8..d4bed367162 100644 --- a/tsconfig-storybook.json +++ b/tsconfig-storybook.json @@ -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", + }, } diff --git a/tsconfig-webpack.json b/tsconfig-webpack.json index 01028061695..faf010628c7 100644 --- a/tsconfig-webpack.json +++ b/tsconfig-webpack.json @@ -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/**/*", + ], } diff --git a/tsconfig.json b/tsconfig.json index 3ac8a6bffe7..a57bbdf1a7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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": [], }