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

fix(useButtonType): don't report dynamically created button with valid type #4074

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

Conaclos
Copy link
Member

Summary

Fix #4072

This solves two bugs:

  1. The find_prop_by_name utility only returned quoted property.
    For instance { "type": foo } was reported, while { type: foo } was not reported.
  2. The rule was always reporting "type" property set with any string value, including valid ones.

I have to admit that I was a bit surprised that our JSX rules handle dynamic code such as React.createElement. I wonder if we should restrict our rules to JSX and ignore dynamic creation completely.

I took the opportunity of refactoring a bit the flow to make it more readable.

Test Plan

I added a test

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Sep 25, 2024
@Conaclos Conaclos force-pushed the conaclos/useButtonType-4072 branch 2 times, most recently from 8102e70 to a489636 Compare September 25, 2024 10:55
Copy link

codspeed-hq bot commented Sep 25, 2024

CodSpeed Performance Report

Merging #4074 will not alter performance

Comparing conaclos/useButtonType-4072 (a489636) with main (d03c6cd)

Summary

✅ 107 untouched benchmarks

@Conaclos Conaclos merged commit dec3238 into main Sep 25, 2024
15 checks passed
@Conaclos Conaclos deleted the conaclos/useButtonType-4072 branch September 25, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 useButtonType warning when type is provided
3 participants