feat: require-data-selector uses consistent rules with assignments#302
Conversation
|
|
You might like to take a look at this PR, since you were the last contributor to make changes to the cypress/require-data-selectors. |
|
Ah great catch, yes indeed in that case where the definition was not inline the rule was not working properly. Great addition for the re-assignment, does it works at more than one level ? Also I agree with @MikeMcC399 - documentation should be updated to reflect this, and existing tests "should not" be updated |
|
Thanks for the review. I did not delete any tests, I just removed the unnecessary escaping in one of them, as pointed out by eslint. You are allowed to have backticks in strings. The tested JS is exactly the same. I will add more examples to the documentation and change my commit message to mark it as a feature. @duranbe You can chain as many assignments as you want. |
1640d17 to
35c6f6e
Compare
Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
4133671 to
db3c15c
Compare
|
Applied the suggestions (one selector was supposed to be a class selector). Nice catch with the two code blocks, that was visible in the rendered documentation. |
MikeMcC399
left a comment
There was a problem hiding this comment.
Thanks for the corrections! That looks good to me now.
|
bugbot run |
Bugbot couldn't runBugbot is not enabled for your user on this team. Ask your team administrator to increase your team's hard limit for Bugbot seats or add you to the allowlist in the Cursor dashboard. |
|
Thanks for the contribution @MgmClientGuy0! |
|
🎉 This PR is included in version 6.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

#272 improved the checks for the require-data-selectors rule to include variable assignments. This works great, thanks for that, but it does not have the exact same semantic as if the selector was defined inline. The following is valid if defined inline:
and not valid if defined in a variable:
This PR now reuses the exact same checks for variable declarations as the inline version. As a bonus, this now supports variable reassignments: