Skip to content

Commit 03d890d

Browse files
mashraf-222claude
andcommitted
fix: derive JS/TS language from parsed config instead of hardcoding
TypeScript projects discovered via package.json were incorrectly assigned Language.JAVASCRIPT. Now derives language from the config dict returned by parse_package_json_config() and deduplicates both JS and TS together. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2bfdd0a commit 03d890d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

codeflash/code_utils/config_parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,16 @@ def _check_dir_for_configs(dir_path: Path, configs: list[LanguageConfig], seen_l
199199
except Exception:
200200
pass
201201

202-
if Language.JAVASCRIPT not in seen_languages:
202+
if Language.JAVASCRIPT not in seen_languages and Language.TYPESCRIPT not in seen_languages:
203203
package_json = dir_path / "package.json"
204204
if package_json.exists():
205205
try:
206206
result = parse_package_json_config(package_json)
207207
if result is not None:
208208
config, path = result
209-
seen_languages.add(Language.JAVASCRIPT)
210-
configs.append(LanguageConfig(config=config, config_path=path, language=Language.JAVASCRIPT))
209+
lang = Language(config.get("language", "javascript"))
210+
seen_languages.add(lang)
211+
configs.append(LanguageConfig(config=config, config_path=path, language=lang))
211212
except Exception:
212213
pass
213214

0 commit comments

Comments
 (0)