cypress-documentation
                                
                                 cypress-documentation copied to clipboard
                                
                                    cypress-documentation copied to clipboard
                            
                            
                            
                        API `cy.end` example fails linting `cypress/unsafe-to-chain-command`
Subject
API > Other Commands > end > Examples
Description
Current behavior
The following API example for cy.end() as shown on the documentation site
cy.contains('User: Cheryl')
  .click()
  .end() // yield null
  .contains('User: Charles')
  .click() // contains looks for content in document now
fails linting with the error cypress/unsafe-to-chain-command.
Desired behavior
API > Other Commands > end > Examples should provide an example of using cy.end() which passes linting using the recommended configuration as defined by the Cypress-provided cypress-io/eslint-plugin-cypress npm module. (The example should also run.)
Test code to reproduce
git clone --branch cypress-end https://github.com/MikeMcC399/cypress-test-tiny
cd cypress-test-tiny
npm ci
npm run cypress:lint
Cypress Version
First reported on Cypress version: 13.7.0
Also reproducible on 13.16.1 and 14.1.0
Node version
v20.11.1 -> v20.17.0 & v22.14.0
Operating System
Ubuntu 22.04.4 LTS
Debug Logs
$ npm run cypress:lint
> [email protected] cypress:lint
> eslint cypress
/home/mike/github/cypress-io/cypress-test-tiny/cypress/e2e/end.cy.js
  16:7  error  It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line  cypress/unsafe-to-chain-command
  27:7  error  It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line  cypress/unsafe-to-chain-command
✖ 2 problems (2 errors, 0 warnings)
Other
eslint Version
8.57.0 & 9.20.1
eslint-plugin-cypress Version
~~2.15.1~~ 3.5.0 and 4.1.0
Related issues
- https://github.com/cypress-io/cypress-example-kitchensink/issues/804#issuecomment-1998529918