Skip to content

Instantly share code, notes, and snippets.

@Addono
Last active October 4, 2020 20:35
Show Gist options
  • Save Addono/fd0546bbb95820640aafe3437a54d26a to your computer and use it in GitHub Desktop.
Save Addono/fd0546bbb95820640aafe3437a54d26a to your computer and use it in GitHub Desktop.
Installs yaml-lint as a dependency and creates a pre-commit hook which invokes it using husky.
#!/bin/sh
# Add yaml-lint as a dependency
yarn add -D yaml-lint
# Add a lint script
npx json -I -f package.json -e "this.scripts.lint='yamllint *.{yaml,yml}'"
# Add husky as a dependency
yarn add -D husky
# Add yaml lint as a pre-commit hook by husky
npx json -I -f package.json -e "this.husky.hooks['pre-commit']='yarn lint'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment