You'll first need to install npm-package-json-lint:
$ npm i npm-package-json-lint --save-dev
Next, install npm-package-json-lint-config-itgalaxy
:
$ npm install npm-package-json-lint-config-itgalaxy --save-dev
Add the following to your .npmpackagejsonlintrc.json
or npmpackagejsonlint.config.js
file:
.npmpackagejsonlintrc.json
{
"extends": "npm-package-json-lint-config-itgalaxy"
}
npmpackagejsonlint.config.js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy",
};
If you need to override a rule, your .npmpackagejsonlintrc.json
or npmpackagejsonlint.config.js
file should look like the example below. All shared rules will be used, but license-type
will be turned off.
npmpackagejsonlint.config.js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy",
rules: {
"license-type": "off",
},
};
Q: My package contains only one file (for example: index.js
)
A: Just use empty array of files
:
package.json
{
"files": []
}
Q: Do I need to list all files in files
field
A: No. Some files always included in package. More information.
Q: My package does not contain js
files, it is just font/image/etc set.
A: Just disable require-main
rule.
npmpackagejsonlint.config.js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy",
rules: {
"require-main": "off",
},
};