Repository: biomejs/biome (language: rust)

Issue:
🐛 Panic `internal error: entered unreachable code` in `lint/correctness/use_exhaustive_dependencies.rs`
### Environment information

```block
CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0
```


### What happened?


```
timeout -v 150 biome lint TEST___FILE.ts
```
crashes with
```
Source Location: crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs:610:13
Thread Name: biome::worker_1
Message: internal error: entered unreachable code
```

File - [compressed.zip](https://github.com/user-attachments/files/17796931/compressed.zip)


### Expected result

No crash

### Code of Conduct

- [X] I agree to follow Biome's Code of Conduct
🐛 Panic `internal error: entered unreachable code` in `lint/correctness/use_exhaustive_dependencies.rs`
### Environment information

```block
CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0
```


### What happened?


```
timeout -v 150 biome lint TEST___FILE.ts
```
crashes with
```
Source Location: crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs:610:13
Thread Name: biome::worker_1
Message: internal error: entered unreachable code
```

File - [compressed.zip](https://github.com/user-attachments/files/17796931/compressed.zip)


### Expected result

No crash

### Code of Conduct

- [X] I agree to follow Biome's Code of Conduct


Discussion / hints:
Thanks so much for the detailed reports! It may take us a bit to get back to all of them, but rest assured they're on our radar!
Thanks so much for the detailed reports! It may take us a bit to get back to all of them, but rest assured they're on our radar!

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fd6baf8f417..e27bfefaf5af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -261,6 +261,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
 
 - [noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class/) no longer panics on malformed escape sequences that end with a multi-byte character ([#4587](https://github.com/biomejs/biome/issues/4587)). Contributed by @Conaclos
 
+- Fixed a panic related to bogus import statements in `useExhaustiveDependencies` ([#4568](https://github.com/biomejs/biome/issues/4568)) Contributed by @dyc3
+
 ### Parser
 
 #### Bug fixes
diff --git a/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs b/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
index 15da2a2ddf61..4e89988ad457 100644
--- a/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
+++ b/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
@@ -597,18 +597,14 @@ fn capture_needs_to_be_in_the_dependency_list(
         | AnyJsBindingDeclaration::JsArrayBindingPatternRestElement(_)
         | AnyJsBindingDeclaration::JsObjectBindingPatternProperty(_)
         | AnyJsBindingDeclaration::JsObjectBindingPatternRest(_)
-        | AnyJsBindingDeclaration::JsObjectBindingPatternShorthandProperty(_) => {
-            unreachable!("The declaration should be resolved to its prent declaration")
-        }
+        | AnyJsBindingDeclaration::JsObjectBindingPatternShorthandProperty(_) => true,
 
         // This should be unreachable because of the test if the capture is imported
         AnyJsBindingDeclaration::JsShorthandNamedImportSpecifier(_)
         | AnyJsBindingDeclaration::JsNamedImportSpecifier(_)
         | AnyJsBindingDeclaration::JsBogusNamedImportSpecifier(_)
         | AnyJsBindingDeclaration::JsDefaultImportSpecifier(_)
-        | AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_) => {
-            unreachable!()
-        }
+        | AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_) => false,
     }
 }
 
diff --git a/crates/biome_js_semantic/src/semantic_model/import.rs b/crates/biome_js_semantic/src/semantic_model/import.rs
index 81bb95a83487..2ad413a94d8d 100644
--- a/crates/biome_js_semantic/src/semantic_model/import.rs
+++ b/crates/biome_js_semantic/src/semantic_model/import.rs
@@ -6,8 +6,14 @@ use biome_js_syntax::{
 use biome_rowan::AstNode;
 
 pub(crate) fn is_imported(node: &JsSyntaxNode) -> bool {
-    node.ancestors()
-        .any(|x| matches!(x.kind(), JsSyntaxKind::JS_IMPORT))
+    node.ancestors().any(|x| {
+        matches!(
+            x.kind(),
+            JsSyntaxKind::JS_IMPORT
+                | JsSyntaxKind::JS_NAMED_IMPORT_SPECIFIERS
+                | JsSyntaxKind::JS_DEFAULT_IMPORT_SPECIFIER
+        )
+    })
 }
 
 /// Marker trait that groups all "AstNode" that can be imported or


Test patch:
diff --git a/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js b/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js
new file mode 100644
index 000000000000..dc6a145397ae
--- /dev/null
+++ b/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js
@@ -0,0 +1,6 @@
+import type {Point} fom '.geomet';
+import {useEffect, seRef} 'react';
+
+xpor function ueCanvasn(
+) {
+  useEffect( => {on late Point},[c
diff --git a/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js.snap b/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js.snap
new file mode 100644
index 000000000000..b6c48933c524
--- /dev/null
+++ b/crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue4568.js.snap
@@ -0,0 +1,37 @@
+---
+source: crates/biome_js_analyze/tests/spec_tests.rs
+expression: issue4568.js
+---
+# Input
+```jsx
+import type {Point} fom '.geomet';
+import {useEffect, seRef} 'react';
+
+xpor function ueCanvasn(
+) {
+  useEffect( => {on late Point},[c
+
+```
+
+# Diagnostics
+```
+issue4568.js:6:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+  ! This hook specifies more dependencies than necessary: c
+  
+    4 │ xpor function ueCanvasn(
+    5 │ ) {
+  > 6 │   useEffect( => {on late Point},[c
+      │   ^^^^^^^^^
+    7 │ 
+  
+  i This dependency can be removed from the list.
+  
+    4 │ xpor function ueCanvasn(
+    5 │ ) {
+  > 6 │   useEffect( => {on late Point},[c
+      │                                  ^
+    7 │ 
+  
+
+```