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(prefer-checked): don't auto-fix when 2nd argument is a non literal. #62

Merged
merged 5 commits into from
Jul 10, 2020

Conversation

benmonro
Copy link
Member

@benmonro benmonro commented Jul 9, 2020

What: fixes banned attribute checks with 2nd arg passed as non literal value.

Why: fixes #58

How: add check for non literal 2nd arg, return null from fixer if present.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@codecov
Copy link

codecov bot commented Jul 9, 2020

Codecov Report

Merging #62 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #62   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          131       134    +3     
  Branches        18        21    +3     
=========================================
+ Hits           131       134    +3     
Impacted Files Coverage Δ
src/createBannedAttributeRule.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8497c48...cc1f0a1. Read the comment docs.

@benmonro
Copy link
Member Author

benmonro commented Jul 9, 2020

@RIP21 This PR will fix the auto-fix problem you found, however the rule will still report an error. In the example you gave you can use an if(checked) or perhaps open a PR on jest-dom to allow a variable to be passed in to toBeChecked() but imo this rule should report an error in that case. If you have no objections I will merge.

@RIP21
Copy link

RIP21 commented Jul 10, 2020

All good as long as this fix is no longer breaks test :)

@benmonro benmonro merged commit 564178b into master Jul 10, 2020
@benmonro benmonro deleted the bug/variable-props branch July 10, 2020 15:40
@benmonro
Copy link
Member Author

🎉 This PR is included in version 3.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule jest-dom/prefer-checked false positive when non-inline arguments passed
2 participants