Useful pre-commit hooks based on NodeJS scripts.
Does not require to have NodeJS installed: pre-commit will fetch & install it under the hood.
The test Dockerfile in this repo was taken from here.
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
rev: v1.1.2
hooks:
- id: htmlhint
# optional custom config:
args: [--config, .htmlhintrc]
- id: htmllint
- id: markdown-toc
# optional custom config:
args: [--indent, " ", -i]
- id: dockerfile_lint
# optional custom config:
args: [--json, --verbose, --dockerfile]
Regex-based linter: https://github.com/yaniswang/HTMLHint
Uses htmlparser2-based linter: htmllint.
Requires you to have a config file like this default .htmllintrc.
By default, a table of content will be inserted in your repo root README.md,
injecting the TOC on lines containing the HTML comment <!-- toc -->.
When the TOC is added or updated, the hook will fail with Files were modified by this hook.
You then just have to git add your README.md and commit again (or git commit -a).
Simply call the latest version of dockerfile_lint