npm-ci-over-npm-install
Detects workflows that use npm install instead of npm ci when package-lock.json exists in the repository.
Why this rule exists:
npm ciis faster and deterministic for CI because it installs exactly what is inpackage-lock.jsonnpm installmay update the lock file and re-resolve dependencies, adding unnecessary overhead- CI environments benefit from reproducible installs
Current MVP heuristic:
package-lock.jsonexists at the repository root- a workflow step runs
npm installwithout options that change its behavior (e.g.--save,--global,--workspace) - the step is not a lockfile-only or dry-run invocation
Conservative bias:
- only flags bare
npm installwithout additional flags - ignores
npm install --package-lock-only,npm install --dry-run, and similar non-install variants - does not flag
npm installwith workspace, global, or save-related flags that indicate intentional non-CI usage
Typical remediation:
- replace
npm installwithnpm ciin CI workflows - verify that
package-lock.jsonis committed and up to date - measure total job duration before and after the change