Skip to content

Commit 23e7ee7

Browse files
committed
Add husky commit hook for linting and formatting
1 parent f2765ec commit 23e7ee7

File tree

7 files changed

+753
-30
lines changed

7 files changed

+753
-30
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/backend/.env
2-
__pycache__
2+
__pycache__
3+
node_modules

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd compass
2+
npm run lint
3+
npm run prettier

compass/middleware.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { type NextRequest } from "next/server";
2+
import { updateSession } from "@/utils/supabase/middleware";
3+
4+
export async function middleware(request: NextRequest) {
5+
return await updateSession(request);
6+
}
7+
8+
export const config = {
9+
matcher: [
10+
/*
11+
* Match all request paths except for the ones starting with:
12+
* - _next/static (static files)
13+
* - _next/image (image optimization files)
14+
* - favicon.ico (favicon file)
15+
* Feel free to modify this pattern to include more paths.
16+
*/
17+
"/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
18+
],
19+
};

compass/package-lock.json

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compass/package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",
10-
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
10+
"prettier": "npx prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
1111
},
1212
"dependencies": {
1313
"@heroicons/react": "^2.1.1",
@@ -24,20 +24,9 @@
2424
"autoprefixer": "^10",
2525
"eslint": "^8",
2626
"eslint-config-next": "13.5.6",
27-
"husky": "^9.0.11",
2827
"lint-staged": "^15.2.2",
2928
"postcss": "^8",
3029
"tailwindcss": "^3",
3130
"typescript": "^5"
32-
},
33-
"husky": {
34-
"hooks": {
35-
"pre-commit": "lint-staged"
36-
}
37-
},
38-
"lint-staged": {
39-
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
40-
"prettier --write"
41-
]
42-
}
31+
}
4332
}

0 commit comments

Comments
 (0)