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

💅 noRedeclare false positive when function overloading with destructured objects #2608

Closed
1 task done
hougesen opened this issue Apr 26, 2024 · 0 comments · Fixed by #2615
Closed
1 task done
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

Comments

@hougesen
Copy link

Environment information

CLI:
  Version:                      1.7.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.5.2"

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

Linter:
  Recommended:                  true
  All:                          false
  Rules:
Workspace:
  Open Documents:               0

Rule name

lint/suspicious/noRedeclare

Playground link

https://biomejs.dev/playground/?code=dAB5AHAAZQAgAFgAIAA9ACAAewAKAAkAKABlADoAIAAiAGMAaABhAG4AZwBlAC0AawBpAG4AZAAiACwAIAB7ACAAawBpAG4AZAAgAH0AOgAgAHsAIABrAGkAbgBkADoAIAAiAGEAIgAgAH0AKQA6ACAAdgBvAGkAZAA7AAoACQAoAGUAOgAgACIAYwBoAGEAbgBnAGUALQBrAGkAbgBkACIALAAgAHsAIABrAGkAbgBkACwAIABlAHgAdAByAGEAIAB9ADoAIAB7ACAAawBpAG4AZAA6ACAAIgBiACIAOwAgAGUAeAB0AHIAYQA6ACAAbgB1AG0AYgBlAHIAIAB9ACkAOgAgAHYAbwBpAGQAOwAKAH0AOwAKAAoAbABlAHQAIAB4ADoAIABYADsACgAKAHgAKAAiAGMAaABhAG4AZwBlAC0AawBpAG4AZAAiACwAIAB7ACAAawBpAG4AZAA6ACAAIgBhACIAIAB9ACkAOwAKAAoAeAAoACIAYwBoAGEAbgBnAGUALQBrAGkAbgBkACIALAAgAHsAIABrAGkAbgBkADoAIAAiAGIAIgAsACAAZQB4AHQAcgBhADoAIAAxACAAfQApADsACgA%3D

Expected result

The rule should not be triggered when writing function overload definitions since it is a type, not actual code.

The playground and the original code that triggered it is not completely equal, since it was a generic function input in a Vue component (as seen below).

<script setup lang="ts">
defineEmits<{
  (e: 'change-kind', { kind }: { kind: 'a' }): void;
  (e: 'change-kind', { kind, extra }: { kind: 'b'; extra: number }): void;
}>();
</script>

As far as I am aware it should not be triggered in either case, but it definitely shouldn't in the Vue snippet.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants