-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
'unsafe-to-chain-command' has too many false positives #5216
Comments
@microbae Can you elaborate a bit more on why you think this is a false positive and what you think the correct behavior should be? |
Hi! There are still some cases in which this eslint rule is causing an error even when the code looks exactly the same as some examples in the cypress documentation.
This is causing an error and it's something that is widely used and showed in the cypress docs |
@riboher as i understand it from here: https://docs.cypress.io/guides/core-concepts/retry-ability#Actions-should-be-at-the-end-of-chains-not-the-middle That command should be broken up where you end chains after an action. cy.get('.map-container').scrollIntoView();
cy.get('.map-container').should('be.visible'); I think the blur command should be broken up too. cy.get('[name="comment"]').focus().type('Nice Product!')
cy.get('[name="comment"]').blur() So it seems like the cypress docs need to be updated. |
Transferred this issue to the cypress-documentation repo so the documentation examples can be updated. |
I experienced the same issue with |
Same for me, I have an eslint error on the following line: cy.focused().should('have.id', 'name'); I don't think I can split this. |
For
the docs explicitly say this is safe, but it does flag on https://docs.cypress.io/api/commands/focused#Syntax
I've made a PR here: cypress-io/eslint-plugin-cypress#142 |
Is it intended that the 'unsafe-to-chain-command' rule hits, if you use quite normal stuff like the ones given in the official Cypress documentation?
I think the rule should do much more than just checking if the action is included in the unsafeToChainActions array. There are too many false positives here..
Example:
The text was updated successfully, but these errors were encountered: