Skip to main content

no-absolute-version-devDependencies

Enabling this rule will result in an error being generated if one of the dependencies in devDependencies uses absolute versions.

Example .npmpackagejsonlintrc configuration

{
"rules": {
"no-absolute-version-devDependencies": "error"
}
}

With exceptions

{
"rules": {
"no-absolute-version-devDependencies": ["error", {
"exceptions": ["myModule"]
}]
}
}

Rule Details

Incorrect example(s)

{
"devDependencies": {
"grunt-npm-package-json-lint": "0.3.0"
}
}
{
"devDependencies": {
"grunt-npm-package-json-lint": "=0.3.0"
}
}

Correct example(s)

{
"devDependencies": {
"gulp-npm-package-json-lint": "^0.3.0"
}
}
{
"devDependencies": {
"gulp-npm-package-json-lint": "~0.3.0"
}
}
{
"devDependencies": {
"gulp-npm-package-json-lint": ">=0.3.0"
}
}
{
"devDependencies": {
"gulp-npm-package-json-lint": "<=0.3.0"
}
}
{
"devDependencies": {
"gulp-npm-package-json-lint": "*"
}
}

Shorthand for disabling the rule in .npmpackagejsonlintrc configuration

{
"rules": {
"no-absolute-version-devDependencies": "off"
}
}

History

  • Improved messaging when an invalid configuration is detected in version 6.3.0
  • Introduced in version 3.2.0