mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
improvement(linter/unicorn): use root_node method in the no_empty_file rule. (#3090)
This commit is contained in:
parent
71da1a1d72
commit
a43054bec5
1 changed files with 2 additions and 2 deletions
|
|
@ -47,8 +47,8 @@ impl Rule for NoEmptyFile {
|
|||
{
|
||||
return;
|
||||
}
|
||||
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!() };
|
||||
|
||||
if program.body.iter().any(|node| !is_empty_stmt(node)) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue