What is npm-package-json-lint?
npm-package-json-lint is a configurable linter that helps enforce standards for your package.json file. By default no rules are enabled. If you would like to use npm-package-json-lint's default ruleset, please see npm-package-json-lint-config-default.
Each rule contains the following properties:
- ID - example: require-author
- Node - example: author
- Message - example: author is required
- Rule Type - example: required
As of v2.7.0, there are multiple ways to provide a configuration object.
- Adding a
--configFile
to the command to specify a JSON file. This file is named.npmpackagejsonlintrc.json
. - Add a
npmpackagejsonlint
property inpackage.json
file - Add a
npmpackagejsonlint.config.js
file that exports a config object in the current working directory. - Add a global
.npmpackagejsonlintrc.json
file in the root of your user directory - Add a global
npmpackagejsonlint.config.js
file that exports a config object in the root of your user directory
Configuring rules
npm-package-json-lint rules can either be run as an error
, warning
, or off
.
- "warning" - run the rule as a warning
- "error" - run the rule as an error
- "off" - disables the rule
Ex: "require-author": "error"
For more details, please see rules.