Closed JeffBeltran closed 5 years ago
Same for me
Hey @JeffBeltran, @Lukavyi, did you try the recommended workarounds in the error message? Which one did you try and what was the outcome of following them?
If ESLint is installed globally, then make sure eslint-plugin-cypress is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm i eslint-plugin-cypress@latest --save-dev
I found that if you install globally, you don't need to use --save-dev and that solved my problem.
any update?
Just tried this myself. Brand new VueJS project (and all the stuff it adds in). Installed cypress, the cypress eslint plugin locally, eslint installed locally, added the .json file - no luck.
same for me
Same here. Not really up for a global install as local should be sufficient.
There's only a need to install this plugin globally if you have eslint
installed globally and you're trying to run it globally (eslint *.js
). If you have both eslint
and eslint-plugin-cypress
installed locally and run it locally (./node_modules/.bin/eslint *.js
, npx eslint *.js
, etc), there should be no problem.
As far as I know, there's nothing we as plugin authors can do about this. It's how eslint
works. If you run eslint
globally, it can't find locally installed plugins.
So to reiterate, the solutions for this are one of the following:
Install and run eslint
locally
- or -
Install eslint-plugin-cypress
globally, then you can use the global eslint
Hi there. I don't have any npm package related to eslint installed. Actually, this is all I have:
$ npm list -g
/Users/willian/.asdf/installs/nodejs/10.19.0/.npm/lib
└─┬ fx@19.0.1
├── @medv/blessed@2.0.1
├─┬ chalk@4.1.0
│ ├─┬ ansi-styles@4.2.1
│ │ ├── @types/color-name@1.1.1
│ │ └─┬ color-convert@2.0.1
│ │ └── color-name@1.1.4
│ └─┬ supports-color@7.1.0
│ └── has-flag@4.0.0
├── indent-string@4.0.0
├── lossless-json@1.0.4
└─┬ string-width@4.2.0
├── emoji-regex@8.0.0
├── is-fullwidth-code-point@3.0.0
└─┬ strip-ansi@6.0.0
└── ansi-regex@5.0.0
Then, in my project I have these installed (filtered with grep eslint
):
$ yarn list | grep eslint
├─ @types/eslint-visitor-keys@1.0.0
├─ @typescript-eslint/eslint-plugin@2.34.0
│ ├─ @typescript-eslint/experimental-utils@2.34.0
├─ @typescript-eslint/experimental-utils@2.34.0
│ ├─ @typescript-eslint/typescript-estree@2.34.0
│ ├─ eslint-scope@^5.0.0
│ ├─ eslint-scope@5.1.0
│ ├─ eslint-utils@^2.0.0
│ └─ eslint-utils@2.1.0
│ └─ eslint-visitor-keys@^1.1.0
├─ @typescript-eslint/parser@2.34.0
│ ├─ @types/eslint-visitor-keys@^1.0.0
│ ├─ @typescript-eslint/experimental-utils@2.34.0
│ ├─ @typescript-eslint/typescript-estree@2.34.0
│ └─ eslint-visitor-keys@^1.1.0
├─ @typescript-eslint/typescript-estree@2.34.0
│ ├─ eslint-visitor-keys@^1.1.0
├─ babel-eslint@10.1.0
│ ├─ eslint-visitor-keys@^1.0.0
├─ eslint-config-airbnb-base@13.2.0
├─ eslint-config-airbnb@17.1.1
│ ├─ eslint-config-airbnb-base@^13.2.0
├─ eslint-config-prettier@3.6.0
├─ eslint-config-react-app@5.2.1
├─ eslint-import-resolver-node@0.3.4
├─ eslint-import-resolver-webpack@0.10.1
├─ eslint-loader@3.0.3
├─ eslint-module-utils@2.6.0
├─ eslint-plugin-cypress@2.11.1
├─ eslint-plugin-flowtype@4.6.0
├─ eslint-plugin-import@2.22.0
│ ├─ eslint-import-resolver-node@^0.3.3
│ ├─ eslint-module-utils@^2.6.0
├─ eslint-plugin-jsx-a11y@6.3.1
├─ eslint-plugin-prettier@3.1.4
├─ eslint-plugin-react-hooks@1.7.0
├─ eslint-plugin-react@7.20.6
├─ eslint-scope@3.7.3
├─ eslint-utils@1.4.3
│ └─ eslint-visitor-keys@^1.1.0
├─ eslint-visitor-keys@1.3.0
├─ eslint@4.19.1
│ ├─ eslint-scope@^3.7.1
│ ├─ eslint-visitor-keys@^1.0.0
├─ prettier-eslint@8.8.2
│ ├─ eslint@^4.0.0
│ ├─ typescript-eslint-parser@^16.0.0
│ └─ vue-eslint-parser@^2.0.2
│ ├─ @typescript-eslint/eslint-plugin@^2.10.0
│ ├─ @typescript-eslint/parser@^2.10.0
│ ├─ babel-eslint@10.1.0
│ ├─ eslint-config-react-app@^5.2.1
│ ├─ eslint-loader@3.0.3
│ ├─ eslint-plugin-flowtype@4.6.0
│ ├─ eslint-plugin-import@2.20.1
│ ├─ eslint-plugin-import@2.20.1
│ │ ├─ eslint-import-resolver-node@^0.3.2
│ │ ├─ eslint-module-utils@^2.4.1
│ ├─ eslint-plugin-jsx-a11y@6.2.3
│ ├─ eslint-plugin-jsx-a11y@6.2.3
│ ├─ eslint-plugin-react-hooks@^1.6.1
│ ├─ eslint-plugin-react@7.19.0
│ ├─ eslint-plugin-react@7.19.0
│ ├─ eslint-scope@5.1.0
│ ├─ eslint@^6.6.0
│ ├─ eslint@6.8.0
│ │ ├─ eslint-scope@^5.0.0
│ │ ├─ eslint-utils@^1.4.3
│ │ ├─ eslint-visitor-keys@^1.1.0
│ │ └─ eslint-visitor-keys@^1.1.0
├─ typescript-eslint-parser@16.0.1
├─ vue-eslint-parser@2.0.3
│ ├─ eslint-scope@^3.7.1
│ ├─ eslint-visitor-keys@^1.0.0
│ ├─ eslint-scope@^4.0.3
│ ├─ eslint-scope@4.0.3
And I get this warning anytime I open a .js
file from the project.
The stack trace from the ESLint output console:
[Error - 2:59:42 PM] ESLint stack trace:
[Error - 2:59:42 PM] Error: saf-ops/.eslintrc.json:
Environment key "cypress/globals" is unknown
at /Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/shared/config-validator.js:169:19
at Array.forEach (<anonymous>)
at validateEnvironment (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/shared/config-validator.js:163:30)
at validateConfigArray (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/shared/config-validator.js:334:9)
at CascadingConfigArrayFactory._finalizeConfigArray (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:417:13)
at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
at CLIEngine.isPathIgnored (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/cli-engine/cli-engine.js:951:18)
at CLIEngine.executeOnText (/Users/willian/Projects/SAF/saf/saf-ops/node_modules/eslint/lib/cli-engine/cli-engine.js:868:38)
at /Users/willian/.vscode/extensions/dbaeumer.vscode-eslint-2.1.8/server/out/eslintServer.js:1:40795
at le (/Users/willian/.vscode/extensions/dbaeumer.vscode-eslint-2.1.8/server/out/eslintServer.js:1:46704)
Any suggestions here?
When using VSCODE plugin or globally via
eslint /Users/jeffbeltran/work/lassie/cypress/integration/sample_spec.j
output: