💼 This rule is enabled in the ✅ recommended
config.
npm issues warnings after install if the package.json
has a missing or invalid required property.
This rule uses package-json-validator
to validate all package.json
files against the npm specification, and add any violations to lint warnings.
This rule aims to ensure that package.json
complies with specifications.
Examples of incorrect code for this rule:
{
"author": "",
"description": "",
"keywords": [],
"license": "ISC",
"main": "index.js",
"name": "noncompliant-version",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.X.0"
}
Examples of correct code for this rule:
{
"author": "",
"description": "",
"keywords": [],
"license": "ISC",
"main": "index.js",
"name": "compliant-version",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.0"
}
npm may complain, but it works perfectly with many package files that do not violate spec. If you don't mind those complaints then you can disable this rule.