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

🐛 lint/a11y/useButtonType doesn't know when type is spread #2248

Closed
1 task done
hornta opened this issue Mar 31, 2024 · 3 comments · Fixed by #2249
Closed
1 task done

🐛 lint/a11y/useButtonType doesn't know when type is spread #2248

hornta opened this issue Mar 31, 2024 · 3 comments · Fixed by #2249
Assignees
Labels
A-Linter Area: linter good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@hornta
Copy link

hornta commented Mar 31, 2024

Environment information

CLI:
  Version:                      1.6.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v18.18.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.15.0"

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

Workspace:
  Open Documents:               0

What happened?

const props = { type: "submit" as const };
return <button {...props}>button</button>;

Biome should be able to tell that the type prop is spread onto the button element but it is still reported as an error in the lint/a11y/useButtonType rule.

Expected result

It should not raise any error.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Sec-ant
Copy link
Member

Sec-ant commented Mar 31, 2024

I think this is an expected limitation because of a lack of type inference as of now.

@ematipico
Copy link
Member

Yeah, that's a bug. If there's a spread prop, we shouldn't trigger the rule

@ematipico ematipico added good first issue Good for newcomers A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Mar 31, 2024
@fireairforce
Copy link
Member

i want to work on this~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter good first issue Good for newcomers 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.

4 participants