Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged --quiet
LATEST_HASH=$(git rev-parse --verify HEAD)

# Run commands only in packages with changed files compared to previous commit and on their dependants in parallel
pnpm -r --filter="...[$LATEST_HASH]" --parallel "/^format$|^lint$|^typecheck$/"
Comment on lines +4 to +7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is faster?

I'm a little skeptical of pre-commit jobs. I've tried using them in the past and it gets annoying having a delay post-commit and I end up --no-verifying relying on CI anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of it too but it's nice to keep the option for now. We can remove it down the road if it turns out too big a of a pain.

running with parallel recursive pnpm is faster right now, might become a bit slower than lint-staged down the road. But on the plus side, we can run tsc, which imho usually gives more info than eslint.

4 changes: 0 additions & 4 deletions .lintstagedrc.mjs

This file was deleted.

6 changes: 3 additions & 3 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"lint:fix": "pnpm lint --fix",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
"start": "expo start",
"typecheck": "tsc --noEmit",
"storybook-generate": "sb-rn-get-stories -js",
"storybook": "cross-env STORYBOOK_ENABLED='true' expo start",
"storybook-generate": "sb-rn-get-stories -js",
"storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android",
"storybook:ios": "cross-env STORYBOOK_ENABLED='true' expo start --ios",
"storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android"
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@expo/vector-icons": "14.0.0",
Expand Down
11 changes: 2 additions & 9 deletions docs/tools/HUSKY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The purpose of the `husky` is to run tasks on certain git actions. Initially it has been setup to run linting tasks on `commit` locally. This helps to ensure high standards and notify developers of failures soon.

It runs on staged files via `lint-staged`. As this is a clean project it is quite fast but as it grows we can consider running husky jobs only on `push`
It runs on changed files using `pnpm --filter=[$LATEST_HASH]`. As this is a clean project it is quite fast but as it grows we can consider running husky jobs only on `push`

## Contents

Expand All @@ -13,7 +13,6 @@ It runs on staged files via `lint-staged`. As this is a clean project it is quit

## Prerequisites

- [➡ lint-staged](./LINTSTAGED.md) - lint indexed files before commit
- [➡ commitlint](./COMMITLINT.md) - lint commit messages

## Setup
Expand Down Expand Up @@ -42,12 +41,6 @@ It runs on staged files via `lint-staged`. As this is a clean project it is quit
}
```

- Add `pre-commit` hook for linting and formatting indexed files using [lint-staged](./lint-staged.md):

```sh
pnpm husky add .husky/pre-commit 'pnpm lint-staged --quiet'
```

- Add `commit-msg` hook for linting of commit message using [commitlint](../../packages/commitlint/README.md):

```sh
Expand All @@ -56,7 +49,7 @@ It runs on staged files via `lint-staged`. As this is a clean project it is quit

## Usage

- **Automatic** execution [lint-staged](./lint-staged.md) and [commitlint](../../packages/commitlint/README.md) on commit.\
- **Automatic** execution of formating, linting, typechecking and [commitlint](../../packages/commitlint/README.md) on commit.\
In case of any failures, commit will be rejected.

## License
Expand Down
48 changes: 0 additions & 48 deletions docs/tools/LINTSTAGED.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0",
"author": "",
"scripts": {
"check:all": "pnpm -r --parallel \"/^format$|^lint$|^typecheck$/\"",
"clean": "git clean -dfX",
"format": "pnpm -r format",
"install:clean": "rm -rf \"**/node_modules\" && pnpm -r clean",
Expand All @@ -25,7 +26,6 @@
"@leather-wallet/tsconfig-config": "workspace:*",
"eslint": "8.53.0",
"husky": "8.0.3",
"lint-staged": "15.0.2",
"prettier": "3.0.3",
"syncpack": "12.3.0",
"typescript": "5.3.3"
Expand Down
Loading