mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
improvement(linter/ts): use root_node method in the triple_slash_reference rule. (#3088)
This commit is contained in:
parent
c49f6922c2
commit
69e464b19a
1 changed files with 2 additions and 2 deletions
|
|
@ -103,8 +103,8 @@ impl Rule for TripleSlashReference {
|
|||
}))
|
||||
}
|
||||
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!() };
|
||||
|
||||
// We don't need to iterate over all comments since Triple-slash directives are only valid at the top of their containing file.
|
||||
// We are trying to get the first statement start potioin, falling back to the program end if statement does not exist
|
||||
|
|
|
|||
Loading…
Reference in a new issue