Skip to main content

require-dependabot-versioning-strategy-for-npm

Rule catalog ID: R088

Targeted pattern scopeโ€‹

Dependabot update entries with package-ecosystem: "npm".

What this rule reportsโ€‹

This rule reports npm update entries that omit versioning-strategy.

Why this rule existsโ€‹

versioning-strategy changes how Dependabot edits package manifests and lockfiles. Requiring the key makes npm range update behavior explicit, which is especially useful in monorepos and libraries with stricter dependency policies.

โŒ Incorrectโ€‹

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"

โœ… Correctโ€‹

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
versioning-strategy: "increase"
schedule:
interval: "weekly"

Additional examplesโ€‹

For application repositories, increase is a common choice because it keeps package ranges aligned with the updated resolved version.

ESLint flat config exampleโ€‹

import githubActions from "eslint-plugin-github-actions-2";

export default [githubActions.configs.dependabot];

When not to use itโ€‹

Disable this rule if the repository intentionally accepts Dependabot's default versioning strategy heuristics for npm.

Further readingโ€‹