Skip to content

node-dependencies/prefer-caret-range-version

require caret(^) version instead of range version.

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces the use of the caret(^) ranges syntax.

jsonc
/* eslint "node-dependencies/prefer-caret-range-version": "error" */
{
  "dependencies": {
    /* ✓ GOOD */
    "a": "^1.0.0",

    /* ✗ BAD */
    "b": 
">=1.0.0 <2.0.
0",
"c":
">=0.1.0 <0.2.
0",
"d":
">=0.0.1 <0.0.
2",
"e":
"1.2.3 -
1",
"f":
"~
1",
"g":
"~1.
x"
}, }

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-node-dependencies v0.8.0

🔍 Implementation