Skip to content
Open
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
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx tsc --noEmit
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.next
out
build
node_modules
public/mockServiceWorker.js
public/sw.js
package-lock.json
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 100,
"endOfLine": "lf"
}
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Contributing to ILN Frontend

## Pre-commit Hooks (Husky)

This project uses [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/lint-staged/lint-staged) to catch lint and formatting issues locally before they reach CI.

### First-time Setup

After cloning the repo, install dependencies to activate the hooks:

```bash
npm install
```

The `prepare` script runs `husky` automatically, registering the hooks in `.husky/`.

### What the hooks do

| Hook | Trigger | Action |
|------|---------|--------|
| `pre-commit` | `git commit` | Runs `eslint --fix` and `prettier --write` on staged files only |
| `pre-push` | `git push` | Runs `tsc --noEmit` to catch type errors before the branch is pushed |

Hooks are scoped to staged files via `lint-staged`, so they typically complete in well under 10 seconds.

### Skipping hooks (not recommended)

If you genuinely need to bypass a hook in an emergency:

```bash
# Skip pre-commit only
git commit --no-verify -m "your message"

# Skip pre-push only
git push --no-verify
```

Do not make a habit of skipping — the same checks run in CI and will block your PR.

### Prettier configuration

Formatting rules live in `.prettierrc.json`. Files and directories excluded from formatting are listed in `.prettierignore`.

To format the entire codebase manually:

```bash
npx prettier --write .
```

---

## Visual Regression Testing with Chromatic

This project uses Chromatic for visual regression testing to catch unintended UI changes before they reach production.
Expand Down
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"test:e2e": "playwright test",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"chromatic": "chromatic --exit-zero-on-changes"
"chromatic": "chromatic --exit-zero-on-changes",
"prepare": "husky"
},
"dependencies": {
"@stellar/freighter-api": "^6.0.1",
Expand Down Expand Up @@ -67,7 +68,19 @@
"eslint-plugin-storybook": "^10.4.1",
"playwright": "^1.60.0",
"@vitest/browser-playwright": "^4.1.5",
"@vitest/coverage-v8": "^4.1.5"
"@vitest/coverage-v8": "^4.1.5",
"husky": "9.1.7",
"lint-staged": "15.5.2",
"prettier": "3.5.3"
},
"lint-staged": {
"*.{ts,tsx,js,jsx,mjs,cjs}": [
"eslint --fix",
"prettier --write"
],
"*.{json,css,md}": [
"prettier --write"
]
},
"msw": {
"workerDirectory": [
Expand Down