ESLint: 'cy' is not defined (Cypress)
I got that error after upgrading to cypress version 4+. I installed the eslint-plugin-cypress
https://github.com/cypress-io/eslint-plugin-cypressand activated it in the extends configuration either in package.json or in separate config file:
"eslintConfig": { "extends": [ "plugin:cypress/recommended" ]},
Specify cy
in eslintrc globals
cy is a global variable. Much like location. So really it is window.cy. You can add it to the globals in Eslint. Don't import cy from cypress.
{ "globals": { "cy": true }}
Added that to my .eslintrc
and fixed the issue