Skip to content

Commit

Permalink
Add Husky
Browse files Browse the repository at this point in the history
  • Loading branch information
EshaanAgg committed Mar 1, 2023
1 parent c45736e commit 9d382c4
Show file tree
Hide file tree
Showing 4 changed files with 9,006 additions and 9,166 deletions.
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn format:fix
yarn lint:fix
yarn typecheck
20 changes: 19 additions & 1 deletion INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This document provides instructions on how to set up and start a running instanc
- [Sign in to talawa-admin](#sign-in-to-talawa-admin)
- [Running tests](#running-tests)
- [Linting code files](#linting-code-files)
- [Husky for Git Hooks](#husky-for-git-hooks)
- [Setting up Talawa-Admin and API for Talawa App](#setting-up-talawa-admin-and-api-for-talawa-app)
- [On Your Local Machine](#on-your-local-machine)

Expand Down Expand Up @@ -147,7 +148,24 @@ You can run the tests for `talawa-admin` using this command:-

You can lint your code files using this command:-

yarn lint
yarn lint:fix

## Husky for Git Hooks

We are using the package `Husky` to automatically run the following scripts on your changes whenever you make a commit:

```
yarn format:fix
yarn lint:fix
yarn typecheck
```

This is done to improve developer experience and to make sure that your commits do not fail on the automated workflow runs. Still you can manually opt-out of the same using the `--no-verify` flag as follows:

```
git commit -m "Commit message" --no-verify
```


## Setting up Talawa-Admin and API for Talawa App

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"lint:fix": "eslint \"**/*.{ts,tsx}\" --fix",
"format:fix": "prettier --write \"**/*.{ts,tsx,json,scss,css}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,json,scss,css}\"",
"typecheck": "tsc --project tsconfig.json --noEmit"
"typecheck": "tsc --project tsconfig.json --noEmit",
"prepare": "husky install"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -103,6 +104,7 @@
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^8.0.3",
"jest-localstorage-mock": "^2.4.19",
"jest-location-mock": "^1.0.9",
"jquery": "^3.2.1"
Expand Down
Loading

0 comments on commit 9d382c4

Please sign in to comment.