solhint
solhint copied to clipboard
Add pre-commit hook definition with test
pre-commit became pretty popular as framework to combine linters / code-formatters via hooks across different languages. It can be enabled as actual git hook or just used by running pre-commit run -a
. pre-commit does its own dependency management (+cashing) and installs each hook into its own isolated folder.
This adds a .pre-commit-hooks.yaml
(+ doc + test), which allows other projects to run Solhint via pre-commit.
Tested it also via my solhint fork with custom test tag, see https://github.com/dbast/sol-press/pull/16
pre-commit installs a hook by cloning the repo
, checking out the specified git rev
(=tag, branch, commit hash), parsing the .pre-commit-hooks.yaml and installing the hook (in case of node based hooks: run npm pack
(produces a tarball + npm install $tarball
). Installed hooks are cached based on the rev for later repeated runs.
Had to remove the prepare
script in package.json as that prevents npm pack
from working with a plain node install (which is used by pre-commit during isolated hook installations). prepare
is afaik not the right place to run husky install
.