Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,20 @@ impl CliRunner {

let number_of_files = files_to_lint.len();

// Due to the architecture of the import plugin and JS plugins,
// linting a large number of files with both enabled can cause resource exhaustion.
// See: https://github.com/oxc-project/oxc/issues/15863
if number_of_files > 10_000 && use_cross_module && has_external_linter {
print_and_flush_stdout(
stdout,
&format!(
"Failed to run oxlint.\n{}\n",
render_report(&handler, &OxcDiagnostic::error(format!("Linting {number_of_files} files with both import plugin and JS plugins enabled can cause resource exhaustion.")).with_help("See https://github.com/oxc-project/oxc/issues/15863 for more details."))
),
);
return CliRunResult::TooManyFilesWithImportAndJsPlugins;
}

let tsconfig = basic_options.tsconfig;
if let Some(path) = tsconfig.as_ref() {
if path.is_file() {
Expand Down
4 changes: 3 additions & 1 deletion apps/oxlint/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub enum CliRunResult {
ConfigFileInitFailed,
ConfigFileInitSucceeded,
TsGoLintError,
TooManyFilesWithImportAndJsPlugins,
}

impl Termination for CliRunResult {
Expand All @@ -37,7 +38,8 @@ impl Termination for CliRunResult {
| Self::InvalidOptionSeverityWithoutFilter
| Self::InvalidOptionSeverityWithoutPluginName
| Self::InvalidOptionSeverityWithoutRuleName
| Self::TsGoLintError => ExitCode::FAILURE,
| Self::TsGoLintError
| Self::TooManyFilesWithImportAndJsPlugins => ExitCode::FAILURE,
}
}
}
Loading