-i Flag Fails to Ignore Dependencies Specified with Caret (e.g., ^9.7.0) on Windows but not macOS or Linux
Environment:
Node.js: v22.13.1
npm: v10.9.2
NX: v20.3.2
Sherif: v1.1.1
Steps to Reproduce:
-
Create a new NX project with two apps, one with
"eslint": "^9.7.0", another with"eslint": "^9.8.0". -
Run
npm i, followed bynpx 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.0version was explicitly ignored usingnpx 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:
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.0version inapps/app1being different from^9.8.0in other packages - Second run is with
-i eslint@^9.7.0, and correctly shows that no issues were reported
Do you have any other detail that could help me reproduce the issue?
Closing as unable to reproduce. Happy to dig more if more folks face this issue with a repro.