diff options
Diffstat (limited to 'cli/tools/lint/linter.rs')
-rw-r--r-- | cli/tools/lint/linter.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/tools/lint/linter.rs b/cli/tools/lint/linter.rs index 777fe4d09..2c2bc43ac 100644 --- a/cli/tools/lint/linter.rs +++ b/cli/tools/lint/linter.rs @@ -94,9 +94,16 @@ impl CliLinter { &self, file_path: &Path, source_code: String, + ext: Option<&str>, ) -> Result<(ParsedSource, Vec<LintDiagnostic>), AnyError> { let specifier = specifier_from_file_path(file_path)?; - let media_type = MediaType::from_specifier(&specifier); + let media_type = if let Some(ext) = ext { + MediaType::from_str(&format!("placeholder.{ext}")) + } else if file_path.extension().is_none() { + MediaType::TypeScript + } else { + MediaType::from_specifier(&specifier) + }; if self.fix { self.lint_file_and_fix(&specifier, media_type, source_code, file_path) |