Manypkg
Manypkg does a bunch of things for monorepos, but we’re going to rely on it for linting our package.json files.
Install it
shpnpm add -D @manypkg/cli
You can run the checks
shpnpm manypkg check
And some checks can be fixed automatically (e.g. ordering of dependencies)
shpnpm manypkg fix
Let’s add this as a script to our root package.json, and make it part of the top-level lint script (this feels more like linting than typechecking to me, personally, although arguably TypeScript is just a fancy linter)
json"scripts": {"dev": "pnpm --color run -r dev","lint": "pnpm --color run -r lint && pnpm --color manifests-lint","manifests-lint": "pnpm manypkg check","manifests-fix": "pnpm manypkg fix"}
Now you can run pnpm lint and it applies some rules to our package.json files.