From bec4339686b7cd6c2d1c7876493a3ef458919e21 Mon Sep 17 00:00:00 2001 From: David Wessman Date: Sun, 2 Jul 2023 12:48:02 +0200 Subject: [PATCH] Adds pre-commit hooks using Husky (#46) --- .husky/pre-commit | 4 ++++ README.md | 15 +++++++++++++++ package.json | 10 ++++++++++ 3 files changed, 29 insertions(+) create mode 100755 .husky/pre-commit create mode 100644 package.json diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..d24fdfc --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/README.md b/README.md index 13bd369..19fbfb9 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,21 @@ Dir puts failures ``` +## Development + +Setup linting: + +```sh +npm run prepare +``` + +Install dependencies and run tests: + +```sh +bundle +bundle exec rake +``` + ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/davidwessman/syntax_tree-erb. diff --git a/package.json b/package.json new file mode 100644 index 0000000..7651411 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "prepare": "husky install" + }, + "lint-staged": { + "lib/**/*.rb": [ + "bundle exec stree write" + ] + } +}