sherif icon indicating copy to clipboard operation
sherif copied to clipboard

-i Flag Fails to Ignore Dependencies Specified with Caret (e.g., ^9.7.0) on Windows but not macOS or Linux

Open Tatious opened this issue 1 year ago • 1 comments

Environment:

Node.js: v22.13.1 npm: v10.9.2 NX: v20.3.2 Sherif: v1.1.1

Steps to Reproduce:

  1. Create a new NX project with two apps, one with "eslint": "^9.7.0", another with "eslint": "^9.8.0".

  2. Run npm i, followed by npx sherif -i eslint@^9.7.0

Expected Behavior:

Sherif should not report any errors, as the specified version eslint@^9.7.0 is being ignored.

Actual Behavior:

Sherif reports the following error on Windows, but not macOS or Linux:

1 issue found in ./:

 ⨯ error Dependency eslint has multiple versions defined in the workspace. multiple-dependency-versions

      ./                        ^9.8.0   ↑ highest

      .\apps\app2               ^9.8.0   ↑ highest

      .\apps\app1               ^9.7.0   ↓ lowest

1 issue found (1 ⨯, 0 ⚠️, 0 ✓) across 2 packages in 793.5µs.

Observations:

  • The eslint@^9.7.0 version was explicitly ignored using npx sherif -i eslint@^9.7.0.
  • Despite this, Sherif flagged the version mismatch as an error.
  • Testing the same for "eslint": "9.7.0" and "eslint": "9.8.0" does not repro.

Zipped demo:

nx-sherif-demo.zip

Tatious avatar Jan 21 '25 19:01 Tatious

That's an interesting bug. I don't have access to a Windows machine, so had to setup a VM. However I'm unable to reproduce the issue:

  • First run is without any arguments, it correctly shows the ^9.7.0 version in apps/app1 being different from ^9.8.0 in other packages
  • Second run is with -i eslint@^9.7.0, and correctly shows that no issues were reported
Image

Do you have any other detail that could help me reproduce the issue?

QuiiBz avatar Jan 26 '25 09:01 QuiiBz

Closing as unable to reproduce. Happy to dig more if more folks face this issue with a repro.

QuiiBz avatar Jun 21 '25 06:06 QuiiBz