Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion crates/oxc_linter/src/ast_util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use oxc_ast::{ast::BindingIdentifier, AstKind};
use oxc_ecmascript::ToBoolean;
use oxc_semantic::{AstNode, IsGlobalReference, NodeId, Semantic, SymbolId};
use oxc_semantic::{AstNode, IsGlobalReference, NodeId, ReferenceId, Semantic, SymbolId};
use oxc_span::{GetSpan, Span};
use oxc_syntax::operator::{AssignmentOperator, BinaryOperator, LogicalOperator, UnaryOperator};

Expand Down Expand Up @@ -282,6 +282,15 @@ pub fn get_declaration_of_variable<'a, 'b>(
Some(semantic.nodes().get_node(symbol_table.get_declaration(symbol_id)))
}

pub fn get_declaration_from_reference_id<'a, 'b>(
reference_id: ReferenceId,
semantic: &'b Semantic<'a>,
) -> Option<&'b AstNode<'a>> {
let symbol_table = semantic.symbols();
let symbol_id = symbol_table.get_reference(reference_id).symbol_id()?;
Some(semantic.nodes().get_node(symbol_table.get_declaration(symbol_id)))
}

pub fn get_symbol_id_of_variable(
ident: &IdentifierReference,
semantic: &Semantic<'_>,
Expand Down
5 changes: 5 additions & 0 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ mod node {
pub mod no_new_require;
}

mod react_hooks {
pub mod exhaustive_deps;
}

oxc_macros::declare_all_lint_rules! {
// import::no_deprecated,
// import::no_unused_modules,
Expand Down Expand Up @@ -956,4 +960,5 @@ oxc_macros::declare_all_lint_rules! {
vitest::prefer_to_be_object,
vitest::prefer_to_be_truthy,
vitest::require_local_test_context_for_concurrent_snapshots,
react_hooks::exhaustive_deps,
}
Loading