diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index 9cd252be2eba5..0b40023f090c1 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -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"]; diff --git a/crates/oxc_linter/src/service/runtime.rs b/crates/oxc_linter/src/service/runtime.rs index 2e012b455cfe2..389a67c493f28 100644 --- a/crates/oxc_linter/src/service/runtime.rs +++ b/crates/oxc_linter/src/service/runtime.rs @@ -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; @@ -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 {