Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): hanging when source has syntax/is flow #7432

Merged
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
10 changes: 10 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ mod test {
assert_eq!(result.number_of_errors, 0);
}

#[test]
// https://github.com/oxc-project/oxc/issues/7406
fn ignore_flow_import_plugin_directory() {
let args = &["--import-plugin", "-A all", "-D no-cycle", "fixtures/flow/"];
let result = test(args);
assert_eq!(result.number_of_files, 2);
assert_eq!(result.number_of_warnings, 0);
assert_eq!(result.number_of_errors, 0);
}

#[test]
fn filter_allow_all() {
let args = &["-A", "all", "fixtures/linter"];
Expand Down
5 changes: 4 additions & 1 deletion crates/oxc_linter/src/service/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use oxc_allocator::Allocator;
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, Error, OxcDiagnostic};
use oxc_parser::{ParseOptions, Parser};
use oxc_resolver::Resolver;
use oxc_semantic::SemanticBuilder;
use oxc_semantic::{ModuleRecord, SemanticBuilder};
use oxc_span::{SourceType, VALID_EXTENSIONS};
use rayon::{iter::ParallelBridge, prelude::ParallelIterator};
use rustc_hash::FxHashSet;
Expand Down Expand Up @@ -199,6 +199,9 @@ impl Runtime {
.parse();

if !ret.errors.is_empty() {
if self.resolver.is_some() {
self.modules.add_resolved_module(path, Arc::new(ModuleRecord::default()));
}
return if ret.is_flow_language {
vec![]
} else {
Expand Down
Loading