improvement(linter/tree_shaking): use root_node in the no_side_effects_in_initialization rule. (#3089)

This commit is contained in:
Ali Rezvani 2024-04-25 04:31:41 +03:30 committed by GitHub
parent 69e464b19a
commit 71da1a1d72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,8 +86,8 @@ declare_oxc_lint!(
impl Rule for NoSideEffectsInInitialization {
fn run_once(&self, ctx: &LintContext) {
let Some(root) = ctx.nodes().iter().next() else { return };
let AstKind::Program(program) = root.kind() else { return };
let Some(root) = ctx.nodes().root_node() else { return };
let AstKind::Program(program) = root.kind() else { unreachable!() };
let node_listener_options = NodeListenerOptions::new(ctx);
program.report_effects(&node_listener_options);
}