QuiiBz / sherif

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

allow to ignore multiple packages at once #41

Closed TkDodo closed 11 months ago

TkDodo commented 12 months ago

We have an integrations folder in TanStack Query where we run integration tests of our library against various bundlers. We now test against vite4 and vite5, which yields the following errors:

⨯ error Dependency vite has multiple versions defined in the workspace. multiple-dependency-versions
⨯ error Dependency @vitejs/plugin-react has multiple versions defined in the workspace. multiple-dependency-versions

I would like to exclude the integrations directory from sherif completely, because we will have multiple versions of the same lib in there on purpose.

I'm now using:

--ignore-package react-vite5 --ignore-package react-vite4

and that works, but it doesn't scale when adding more tests, e.g. against different nextJs versions.

Suggestion

ignore-package needs to provide the package name, wich I didn't know - I was trying to specify a path to a package. For me, this syntax would be preferable:

--ignore ./integrations/**

but I could also have those packages start with a prefix and then exclude them if they would allow for a glob pattern. So given that I rename them to integration-react-vite5 and integration-react-vite4, a glob pattern like this should exclude them all:

--ignore-package integration*
QuiiBz commented 12 months ago

That's totally fine to have multiple versions of the same dependency, and that's why we have this --ignore-package option: but it's indeed a special case (probably fairly common in fact) that you've raised, and I also think that --ignore-package should support globs for package names and paths.

Here's what we should do:

QuiiBz commented 11 months ago

Released in https://github.com/QuiiBz/sherif/releases/tag/v0.7.0, sorry for the delay!