1.0.4 • Published 3 years ago

@hannohealth/lint-docs v1.0.4

Weekly downloads
152
License
MIT
Repository
github
Last release
3 years ago

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:

  • scripts
  • dependencies
  • devDependencies
  • resolutions

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-docs

Usage

Lint your repository's package.json by running:

yarn run lint-docs
npm run lint-docs

To 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 scripts

Development

  • Run yarn start to scan this module's own package.json.
  • Run yarn test to run unit tests.

License

MIT

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago