QuiiBz / sherif

Opinionated, zero-config linter for JavaScript monorepos
MIT License
915 stars 14 forks source link

How to tell sherif to ignore peerDepedencies #61

Closed KevinVandy closed 7 months ago

KevinVandy commented 8 months ago

Just upgraded to the latest version of sherif. How can we tell sherif to ignore the versions of peer dependencies? They should not be considered IMO.

⨯ error Dependency react has multiple versions defined in the workspace. multiple-dependency-versions
  ./packages
      react-table               >=16.8   ↓ lowest
      react-table-devtools      >=16.8   ↓ lowest
  ./examples/react
      basic                     ^18.2.0   ↑ highest
      bootstrap                 ^18.2.0   ↑ highest
      column-dnd                ^18.2.0   ↑ highest
      column-groups             ^18.2.0   ↑ highest
image
QuiiBz commented 8 months ago

You can use --ignore-dependency (or -i) followed by the package name to ignore it.

It was requested in https://github.com/QuiiBz/sherif/issues/49 but I'm actually not sure if we should keep it or not.

KevinVandy commented 8 months ago

Maybe a config option? I feel like this would be a common requirement. Maybe even make checking peerDependency opt in?

I think it's the norm, especially in repos for npm packages, to have a different version specifyer than an exact version in the peerDependency fields.

QuiiBz commented 8 months ago

One of the goal of this project is to avoid as much as possible for users the need to use cli options, or to introduce a configuration file. But I agree with you that Sherif should be smarter here, and not error.

moltar commented 7 months ago

Yes, this rule is problematic and IMO wrong.

When you define peers, you typically want to specify the version using a caret, e.g. ^10.3.0.

And then you want to install the exact pinned version (10.3.0) as a devDep to develop against to ensure that the package being developed adheres to the minimum peer version.

Currently, sherif will flag it as an issue.

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

QuiiBz commented 7 months ago

Sorry for the delay, I reverted #49 and released https://github.com/QuiiBz/sherif/releases/tag/v0.8.4