mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(linter) Fix panic when linting declaration files (#1014)
When linting declaration files, it panics here6628fc8d9c/crates/oxc_linter/src/rules/eslint/no_global_assign.rs (L57)with this error: ``` index out of bounds: the len is 0 but the index is 0 ``` Because it expects the array to have the root scope id inside (non zero len)0fcad27515/crates/oxc_semantic/src/scope.rs (L52-L54)
This commit is contained in:
parent
d31a667e23
commit
c4a2084f27
1 changed files with 3 additions and 1 deletions
|
|
@ -151,7 +151,9 @@ impl<'a> SemanticBuilder<'a> {
|
|||
}
|
||||
|
||||
pub fn build(mut self, program: &Program<'a>) -> SemanticBuilderReturn<'a> {
|
||||
if !self.source_type.is_typescript_definition() {
|
||||
if self.source_type.is_typescript_definition() {
|
||||
self.scope.add_scope(None, ScopeFlags::Top);
|
||||
} else {
|
||||
self.visit_program(program);
|
||||
|
||||
// Checking syntax error on module record requires scope information from the previous AST pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue