UNPKG

synopkg

Version:

Consistent dependency versions in large JavaScript Monorepos

34 lines (26 loc) 892 B
--- title: Only allow @types packages in devDependencies --- Only allow TypeScript [@types](HREF_TYPES) packages from being used anywhere other than in the `devDependencies` section of package.json. ### 1. Add a version group - Match all **dependencies** whose name starts with `@types/`. - Only match those dependencies when they appear anywhere **except** `devDependencies`. - Define the behaviour of this group as **isBanned**. - Add a **label** to document the decision/expectation. ```json title=".synopkgrc.json" { "versionGroups": [ { "dependencies": ["@types/**"], "dependencyTypes": ["!dev"], "isBanned": true, "label": "@types packages should only be under devDependencies" } ] } ``` ### 2. Look for mismatches Any `@types` packages which are in the wrong location can then be found and manually moved: ```bash synopkg list-mismatches ```