diff --git a/pants.toml b/pants.toml index 6b91bb1bbd9..48fcfe4a3c8 100644 --- a/pants.toml +++ b/pants.toml @@ -27,6 +27,7 @@ backend_packages.add = [ "pants.backend.experimental.java.lint.google_java_format", "pants.backend.experimental.java.debug_goals", "pants.backend.experimental.javascript", + "pants.backend.experimental.typescript", "pants.backend.experimental.javascript.lint.prettier", "pants.backend.experimental.python", "pants.backend.experimental.python.packaging.pyoxidizer", diff --git a/src/python/pants/backend/typescript/tsconfig.py b/src/python/pants/backend/typescript/tsconfig.py index c70e6fd0ff8..30fb582bf30 100644 --- a/src/python/pants/backend/typescript/tsconfig.py +++ b/src/python/pants/backend/typescript/tsconfig.py @@ -64,15 +64,21 @@ async def _read_parent_config( relative = os.path.dirname(child_path) else: relative = child_path + print(f"Child path: {child_path}") + print(f"Extends path: {extends_path}") + relative = os.path.normpath(os.path.join(relative, extends_path)) + print(f"Relative: {relative}") if not extends_path.endswith(".json"): relative = os.path.join(relative, target_file) parent = next((other for other in others if other.path == relative), None) + print(f"Parent: {parent}") if not parent: logger.warning( f"pants could not locate {child_path}'s 'extends' at {relative}. Found: {[other.path for other in others]}." ) return None + return await Get( # Must be a Get until https://github.com/pantsbuild/pants/pull/21174 lands TSConfig, ParseTSConfigRequest(parent, others, target_file) ) @@ -118,7 +124,7 @@ def _parse_config_from_content(content: FileContent) -> tuple[TSConfig, str | No module_resolution=compiler_options.get("moduleResolution"), paths=compiler_options.get("paths"), base_url=compiler_options.get("baseUrl"), - ), compiler_options.get("extends") + ), parsed_ts_config_json.get("extends") @rule @@ -147,7 +153,9 @@ class TSConfigsRequest: @rule async def construct_effective_ts_configs(req: TSConfigsRequest) -> AllTSConfigs: - all_files = await path_globs_to_digest(PathGlobs([f"**/{req.target_file}"])) + all_files = await path_globs_to_digest( + PathGlobs([f"**/{req.target_file}", "**/tsconfig*.json", "**/jsconfig*.json"]) + ) digest_contents = await get_digest_contents(all_files) return AllTSConfigs(