Hooks for Use With the pre-commit Framework
Pre-commit only supports Git and no other version control system (VCS). The defaults for the Yarn hooks are configured for use with a Zero-Installs TypeScript project. They assume Yarn and Node.js are managed by asdf, but the file patterns may be overridden.
Prevent new merge commits. Useful for enforcing rebase workflows. Does not stop merge committing in CI.
Install tools (based on .tool-versions
unless otherwise configured) by running
asdf install
.
Validate structure of pyproject.toml
by running
poetry check
. Run when
Poetry dependencies or version changes (assuming
Poetry is managed by asdf, but the file pattern may be overridden).
Update poetry.lock
to match pyproject.toml
without upgrading already locked
dependencies by running
poetry lock --no-update
. Run when
Poetry dependencies or version changes (assuming Poetry is managed by asdf, but
the file pattern may be overridden).
Install Poetry dependencies from poetry.lock
by running
poetry install --sync
.
Uninstall any dependencies not found in the lock file. Requires Poetry 1.2+.
Install pre-commit hooks by running
pre-commit install --install-hooks
.
See also the documentation for
default_install_hook_types
.
Install Yarn dependencies, and update yarn.lock
by running
yarn install
.
Deduplicate Yarn dependencies by running
yarn dedupe
.
Perform security audit of Yarn dependencies by running
yarn npm audit --all --recursive
.
Generate SDKs and settings for editors specified in
.yarn/sdks/integrations.yml
by running
yarn run sdks && yarn run prettier --write .vscode/settings.json
.
Format VSCode settings with Prettier to prevent formatting conflicts with
MegaLinter.
Run the build
script in package.json
via
yarn run build
.
Run the test
script in package.json
via
yarn run test --passWithNoTests --findRelatedTests
.
Useful for running
Jest tests that check the modified files,
but the flag can be overridden.
This hook is intended for MegaLinter v6. Run MegaLinter (skipping linters that run in project mode) by running:
npx -- mega-linter-runner@v7.7.0 \
--container-name megalinter-incremental \
--remove-container \
--fix \
--env LOG_LEVEL=warning \
--filesonly
See the documentation for
mega-linter-runner
and
MegaLinter configuration.
This hook is intended for MegaLinter v6. Run MegaLinter by running:
npx -- mega-linter-runner@v7.7.0 \
--container-name megalinter-full \
--remove-container \
--fix \
--env LOG_LEVEL=warning \
See the documentation for
mega-linter-runner
and
MegaLinter configuration.
Please refer to CHANGELOG.md
.