JamieMason / syncpack

Consistent dependency versions in large JavaScript Monorepos.
https://jamiemason.github.io/syncpack/
MIT License
1.34k stars 44 forks source link

feat(ranges): extend lint-semver-ranges to include specifier types #198

Open JamieMason opened 5 months ago

JamieMason commented 5 months ago

Description

When inspecting semver ranges, syncpack only looks at ^, ~ etc. but it could also ensure that instances in a semver group are all file: or alias dependencies etc.

Use case (https://github.com/microsoft/FluidFramework/pull/19637)

// Testing file: dependencies for build-common across the repo. I wanted to at
// least guarantee that a file: dependency was being used, but syncpack doesn't
// seem to support that without the file path being the same everywhere, which
// doesn't work in our repo.
{
  label: 'build-common should be a file: dependency',
  dependencies: ['@fluidframework/build-common'],
  packages: ['**'],
  isIgnored: true,
}

Suggested Solution

All of the specifierTypes used to target instances could be used in place of the range property as additional allowed values.