https://github.com/lucas-c/pre-commit-hooks-nodejs
Useful pre-commit hooks based on NodeJS scripts
https://github.com/lucas-c/pre-commit-hooks-nodejs
dockerfile git-hooks markdown nodejs pre-commit table-of-contents
Last synced: 10 months ago
JSON representation
Useful pre-commit hooks based on NodeJS scripts
- Host: GitHub
- URL: https://github.com/lucas-c/pre-commit-hooks-nodejs
- Owner: Lucas-C
- License: mit
- Created: 2017-07-28T08:43:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-19T08:52:48.000Z (almost 4 years ago)
- Last Synced: 2025-03-25T14:44:44.270Z (10 months ago)
- Topics: dockerfile, git-hooks, markdown, nodejs, pre-commit, table-of-contents
- Language: Roff
- Homepage:
- Size: 17.6 KB
- Stars: 10
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/Lucas-C/pre-commit-hooks-nodejs)
[](https://snyk.io/test/github/lucas-c/pre-commit-hooks-nodejs)
Useful [pre-commit](http://pre-commit.com) 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](https://github.com/docker-library/redis/blob/master/3.2/Dockerfile).
## Table of contents
- [Usage](#usage)
* [htmlhint](#htmlhint)
* [htmllint](#htmllint)
* [markdown-toc](#markdown-toc)
* [dockerfile_lint](#dockerfile_lint)
## Usage
```
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]
```
### htmlhint
Regex-based linter: https://github.com/yaniswang/HTMLHint
### htmllint
Uses [htmlparser2](https://github.com/fb55/htmlparser2)-based linter: [htmllint](https://github.com/htmllint/htmllint/wiki/Options).
Requires you to have a config file like [this default `.htmllintrc`](https://github.com/htmllint/htmllint-cli/blob/master/lib/default_cfg.json).
### markdown-toc
By default, a table of content will be inserted in your repo root `README.md`,
injecting the TOC on lines containing the HTML comment ``.
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`).
### dockerfile_lint
Simply call the latest version of [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)