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

Add no-unnecessary-waiting rule #7

Conversation

SaladFork
Copy link
Contributor

Based on the best practice and what I think was originally suggested in #4. Will error if calling cy.get with a number literal. Also adds this rule to the default recommended set of this plugin.

Based on #6, will refactor/rebase if any changes are needed there. I can also move the base stuff (set up a recommended config, test tools, etc.) to its own PR if it would be easier.


Example:

// cypress/.eslintrc.js
module.exports = {
  plugins: ['cypress'],
  extends: 'plugin:cypress/recommended',
  env: {
    'cypress/globals': true
  }
}
// cypress/test.js
describe('something', () => {
  it('might do a thing', () => {
    cy.visit('/');
    cy.wait(1000);
  });
});
$ yarn run eslint cypress/test.js

./cypress/test.js
  4:5  error  Do not wait for arbitrary time periods  cypress/no-unnecessary-waiting

✖ 1 problem (1 error, 0 warnings)

Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks a lot! I'll merge the other one first after the minor change is made and then merge this one.

package.json Outdated Show resolved Hide resolved
@SaladFork SaladFork force-pushed the feature/add-no-unnecessary-waiting-rule branch from 6351f30 to afbf690 Compare November 2, 2018 19:48
@chrisbreiding chrisbreiding merged commit 1663a62 into cypress-io:master Nov 2, 2018
@chrisbreiding
Copy link
Contributor

Released in v2.1.0 🎉

@SaladFork SaladFork deleted the feature/add-no-unnecessary-waiting-rule branch November 5, 2018 19:10
jaffrepaul pushed a commit that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants