diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..a5332a08 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,46 @@ + +# Refer for explanation to following link: +# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md +pre-commit: + parallel: true + commands: + lint: + # Only runs when any file with filename + # matching the glob is being committed + glob: "*.{js,vue}" + run: yarn run eslint --no-color {staged_files} + + + +# EXAMPLE USAGE +# +# pre-push: +# commands: +# packages-audit: +# tags: frontend security +# run: yarn audit +# gems-audit: +# tags: backend security +# run: bundle audit +# +# pre-commit: +# parallel: true +# commands: +# eslint: +# glob: "*.{js,ts}" +# run: yarn eslint {staged_files} +# rubocop: +# tags: backend style +# glob: "*.rb" +# exclude: "application.rb|routes.rb" +# run: bundle exec rubocop --force-exclusion {all_files} +# govet: +# tags: backend style +# files: git ls-files -m +# glob: "*.go" +# run: go vet {files} +# scripts: +# "hello.js": +# runner: node +# "any.go": +# runner: go run diff --git a/package.json b/package.json index e8861bcb..c554ea78 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "ytsr": "^3.8.0" }, "devDependencies": { + "@arkweid/lefthook": "^0.7.7", "@babel/core": "^7.17.10", "@babel/plugin-proposal-class-properties": "^7.16.7", "@babel/preset-env": "^7.17.10", diff --git a/yarn.lock b/yarn.lock index 6b46bc35..2ac81053 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,6 +15,11 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" +"@arkweid/lefthook@^0.7.7": + version "0.7.7" + resolved "https://registry.yarnpkg.com/@arkweid/lefthook/-/lefthook-0.7.7.tgz#12951b09b955d8054885ffe929aa07a49f39027c" + integrity sha512-Eq30OXKmjxIAIsTtbX2fcF3SNZIXS8yry1u8yty7PQFYRctx04rVlhOJCEB2UmfTh8T2vrOMC9IHHUvvo5zbaQ== + "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"