This is a code dump of something I made a long time ago, but never had the time to finish. There are lots of things that could have been done better.
Lint your npm package
Makes sure your package is unicorn good.
$ npm install --global npmlint
Go to the package you want to lint and run npmlint
.
$ npm install --save npmlint
const npmlint = require('npmlint');
console.log(npmlint());
//=> ['suggestion', 'another suggestion']
You can try it out by cd
'ing into the test
folder and running ../cli.js
Rules are located in a rules
directory. These are loaded automatically.
A rule is initiated with an object containing:
cwd
: the current working directorypkg
: the target package' package.json
It's expected to return an object or an array of object containing:
name
: a slug name for the ruleseverity
:info
,warn
,error
. Use your best judgementmessage
: a message describing the violation
MIT © Sindre Sorhus