Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💅 Calling biome lint errors with internal error: use_exhaustive_dependencies.rs when referencing an enum renamed with the import statement #1194

Closed
1 task done
jschaf opened this issue Dec 14, 2023 · 1 comment · Fixed by #1593
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@jschaf
Copy link

jschaf commented Dec 14, 2023

Environment information

CLI:
  Version:                      1.4.1
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v21.3.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Rule name

n/a

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUATQBlAG0AbwAgAH0AIABmAHIAbwBtACAAJwByAGUAYQBjAHQAJwA7AAoACgBlAG4AdQBtACAARgBvAG8AIAB7AAoAIAAgAEEAIAA9ACAAMQAsAAoAfQAKAAoAaQBtAHAAbwByAHQAIABGAG8AbwAyACAAPQAgAEYAbwBvADsACgAKAGMAbwBuAHMAdAAgAHUAcwBlAEIAYQBkACAAPQAgACgAKQAgAD0APgAgAHsACgAgACAAdQBzAGUATQBlAG0AbwAoACgAKQAgAD0APgAgAHsACgAgACAAIAAgADIAIAA9AD0APQAgAEYAbwBvADIALgBBADsACgAgACAAfQAsACAAWwBdACkAOwAKAH0AOwAKAA%3D%3D&jsx=false

Expected result

It should apply fixes successfully.

Instead, it errored with the following

2023-12-14T22:22:01.589456Z ERROR  biome::worker_7 Processes linting: crates/biome_cli/src/panic.rs: Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https:/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs:493:13
Thread Name: biome::worker_7
Message: internal error: entered unreachable code

Debugging notes

I think it's related to using the import statement to alias another type. Bisecting a file showed that the problem is this pattern:

bad.ts

import { useMemo } from 'react';

enum Foo {
  A = 1,
}

import Foo2 = Foo;

const useBad = () => {
  useMemo(() => {
    2 === Foo2.A;
  }, []);
};

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@jschaf jschaf changed the title 💅 Calling biome lint --apply . errors with internal error: entered unreachable code 💅 Calling biome lint errors with internal error: use_exhaustive_dependencies.rs when referencing an enum renamed with the import statement Dec 14, 2023
@ematipico ematipico added S-Help-wanted Status: you're familiar with the code base and want to help the project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Dec 17, 2023
@ematipico
Copy link
Member

The bug is currently triggered here:

// This should be unreachable because of the test if the capture is imported
AnyJsBindingDeclaration::JsShorthandNamedImportSpecifier(_)
| AnyJsBindingDeclaration::JsNamedImportSpecifier(_)
| AnyJsBindingDeclaration::JsBogusNamedImportSpecifier(_)
| AnyJsBindingDeclaration::JsDefaultImportSpecifier(_)
| AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_)
| AnyJsBindingDeclaration::TsImportEqualsDeclaration(_) => {
unreachable!()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants