cypress-io / eslint-plugin-cypress

An ESLint plugin for projects that use Cypress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Script tests for other ESLint versions give warnings or fail

MikeMcC399 opened this issue ยท comments

Issue

The script definitions

  • "test:v4": "npm i eslint@4.x && npm run test"
  • "test:v6": "npm i eslint@6.x && npm run test"

cause npm@6.10.1 from semantic-release@15.13.18 -> @semantic-release/npm@5.1.13 to be used.

This causes a warning to be issued because the package-lock.json is at "lockfileVersion": 2 whereas npm v6 is only compatible with lockfileVersion 1.

"lockfileVersion": 2,

If semantic-release@19.0.3 is installed, then @semantic-release/npm@9.0.2 installs npm@8.19.4

  • This in turn invokes the issue #153 of peer dependencies, which causes the installation to fail and therefore the test fails.

Steps to reproduce

On Ubuntu 22.04.4 LTS with Node.js 16.15.0

git switch master
git clean -xfd
npm ci
npm run test:v4

Repeat the test after executing

npm install semantic-release@19.0.3 -D

Logs

semantic-release@15.13.18

$ npm run test:v4

> eslint-plugin-cypress@0.0.0-development test:v4
> npm i eslint@4.x && npm run test

npm WARN npm npm does not support Node.js v16.15.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ eslint@4.19.1
added 25 packages from 93 contributors, removed 16 packages, updated 1239 packages and audited 1332 packages in 19.762s
found 622 vulnerabilities (42 low, 221 moderate, 253 high, 106 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
npm WARN npm npm does not support Node.js v16.15.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/

> eslint-plugin-cypress@0.0.0-development test /home/mike/github/cypress-io/eslint-plugin-cypress
> jest

 PASS  tests/lib/rules/no-unnecessary-waiting.js
 PASS  tests/lib/rules/assertion-before-screenshot.js
 PASS  tests/lib/rules/no-force.js
 PASS  tests/lib/rules/no-assigning-return-values.js
 PASS  tests/lib/rules/no-async-before.js
 PASS  tests/lib/rules/require-data-selectors.js
 PASS  tests/lib/rules/no-pause.js
 PASS  tests/lib/rules/unsafe-to-chain-command.js
 PASS  tests/lib/rules/no-async-tests.js
 PASS  tests/config.js

Test Suites: 10 passed, 10 total
Tests:       133 passed, 133 total
Snapshots:   0 total
Time:        1.758s, estimated 2s
Ran all test suites.

semantic-release@19.0.3

$ npm install semantic-release@19.0.3 -D

added 148 packages, removed 405 packages, changed 236 packages, and audited 1084 packages in 16s

47 packages are looking for funding
  run `npm fund` for details

44 vulnerabilities (1 low, 28 moderate, 10 high, 5 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
$ npm run test:v4

> eslint-plugin-cypress@0.0.0-development test:v4
> npm i eslint@4.x && npm run test

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @cypress/eslint-plugin-dev@3.2.0
npm ERR! Found: eslint@4.19.1
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"4.x" from the root project
npm ERR!   peer eslint@">= 3.2.1 < 6" from @cypress/eslint-plugin-dev@3.2.0
npm ERR!   node_modules/@cypress/eslint-plugin-dev
npm ERR!     dev @cypress/eslint-plugin-dev@"3.2.0" from the root project
npm ERR!   1 more (@cypress/eslint-plugin-json)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/eslint-plugin@">= 1.11.0" from @cypress/eslint-plugin-dev@3.2.0
npm ERR! node_modules/@cypress/eslint-plugin-dev
npm ERR!   dev @cypress/eslint-plugin-dev@"3.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint@5.16.0
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^8.56.0" from @typescript-eslint/eslint-plugin@7.6.0
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     peer @typescript-eslint/eslint-plugin@">= 1.11.0" from @cypress/eslint-plugin-dev@3.2.0
npm ERR!     node_modules/@cypress/eslint-plugin-dev
npm ERR!       dev @cypress/eslint-plugin-dev@"3.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/mike/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mike/.npm/_logs/2024-04-12T17_55_41_300Z-debug-0.log

Suggestion

If the installation of alternative ESLint versions is not run from a script, then npm 8.5.5 from Node.js v16.15.0 is used and there is no conflict with the package-lock.json lockfile version, nor with peer dependencies.

I will follow up with a PR to correct this issue.

  • PR #164 resolves the issue. Another PR is needed to remove the now unneeded script definitions.

๐ŸŽ‰ This issue has been resolved in version 3.0.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€