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

refactor(linter): clean up the runtime after the module record change #7557

Merged
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
22 changes: 9 additions & 13 deletions crates/oxc_linter/src/service/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,13 @@ impl Runtime {
};
};

// Build the module record to unblock other threads from waiting for too long.
// The semantic model is not built at this stage.
let semantic_builder = SemanticBuilder::new()
.with_cfg(true)
.with_scope_tree_child_ids(true)
.with_build_jsdoc(true)
.with_check_syntax_error(check_syntax_errors);

let mut module_record = ModuleRecord::new(path, &ret.module_record);
module_record.resolved_absolute_path = path.to_path_buf();
let module_record = Arc::new(module_record);
let module_record = Arc::new(ModuleRecord::new(path, &ret.module_record));

// If import plugin is enabled.
if self.resolver.is_some() {
self.modules.add_resolved_module(path, Arc::clone(&module_record));

// Retrieve all dependency modules from this module.
// Retrieve all dependent modules from this module.
let dir = path.parent().unwrap();
module_record
.requested_modules
Expand Down Expand Up @@ -291,7 +282,12 @@ impl Runtime {
}
}

let semantic_ret = semantic_builder.build(&ret.program);
let semantic_ret = SemanticBuilder::new()
.with_cfg(true)
.with_scope_tree_child_ids(true)
.with_build_jsdoc(true)
.with_check_syntax_error(check_syntax_errors)
.build(&ret.program);

if !semantic_ret.errors.is_empty() {
return semantic_ret.errors.into_iter().map(|err| Message::new(err, None)).collect();
Expand Down
Loading