@hannohealth/lint-docs v1.0.4
lint-docs
A linter for our package.json files - part of Hanno's standard project workflow.
Since most of our client projects built to be handed over to a client's own engineering team once up and running, we aspire to make them as self-documenting as possible. This plugin helps us to enforce this quite opinionated approach and cuts down on the need to try and reverse engineer why a script or dependency was introduced.
Inside our package.json files, we require that all dependencies and scripts are documented via inside a corresponding ...Comments object:
{
"dependencies": {
"some-dependency": "^4.3.8"
},
"dependenciesComments": {
"some-dependency": "Here, we will explain what the dependency does on the current project so that it's easier for future maintainers to understand"
}
}By default, the fields to be linted are:
scriptsdependenciesdevDependenciesresolutions
Any of these fields can be empty or non-existent. A field can be ignored as well - see Usage.
Installation
To install the package locally:
yarn add -D @hannohealth/lint-docs
npm install --save-dev @hannohealth/lint-docsUsage
Lint your repository's package.json by running:
yarn run lint-docs
npm run lint-docsTo ignore specific fields (e.g. if you don't want to have to document your scripts), you can pass in the ignoredFields flag:
yarn run lint-docs --ignoredFields scriptsDevelopment
- Run
yarn startto scan this module's own package.json. - Run
yarn testto run unit tests.
License
MIT