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 cypress to eslint envs (just like mocha) #3100

Open
jean-moldovan opened this Issue Jan 9, 2019 · 4 comments

Comments

3 participants
@jean-moldovan
Copy link

jean-moldovan commented Jan 9, 2019

Hello!

Would be super useful to have cypress available here https://eslint.org/docs/user-guide/configuring#specifying-environments, so that we do not have to configure globals manually or use something like https://github.com/standard/eslint-config-standard which adds extra complexity.

Expected
If I add in package.json:

{
  "standard": {
    "env": ["cypress"]
  }
}

I should not be getting /cypress/integration/examples/location.spec.js:3:1: 'context' is not defined. and similar.

Cheers!

@jean-moldovan

This comment has been minimized.

@jean-moldovan

This comment has been minimized.

Copy link

jean-moldovan commented Jan 9, 2019

Current workaround:

{
 "standard": {
    "env": ["browser", "mocha"],
    "globals": ["cy", "Cypress", "expect", "assert"]
  }
}

@jean-moldovan jean-moldovan changed the title Add cypress to StandardJS envs (just like mocha) Add cypress to eslint envs (just like mocha) Jan 9, 2019

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Jan 9, 2019

This sounds like a great idea! It looks like this would require a PR similar to this one made to add another environment.

Edit: Investigating more into how it's possible to be listed here.

@chrisbreiding

This comment has been minimized.

Copy link
Collaborator

chrisbreiding commented Jan 9, 2019

We can try to get Cypress on eslint's default globals, but it's ultimately up to them.

I'd recommend using our eslint plugin and then you can do the following:

{
  "standard": {
    "env": ["cypress/globals"]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment