Skip to content

Commit 33601da

Browse files
authored
Merge pull request #132 from Web-Dev-Path/feature/husky-precommit
Implement husky pre-commit
2 parents 6109b8f + 58ef6ae commit 33601da

16 files changed

+1204
-40
lines changed

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
exec >/dev/tty 2>&1
5+
6+
npx lint-staged
7+

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.next
2+
public

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"jsxSingleQuote": true,
4-
"arrowParens": "avoid"
4+
"arrowParens": "avoid",
5+
"endOfLine": "auto"
56
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"git.ignoreLimitWarning": true
3-
}
3+
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4848
- About page content (first section)
4949
- About page "Wanna Learn More" and "How to get started?" section
5050
- An optional second column to TwoColumn instead of the image
51+
- .prettierignore file
52+
- husky, lint-staged to auto format with prettier on git commit
53+
- lint and format script to run prettier check and write on all files respectively
54+
5155

5256
### Fixed
5357

@@ -62,3 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6266
- updated 'about us' section (our goals, our purpose)
6367
- updated mobile nav to automatically close when page route change is completed
6468
- adjust flex-basis of a few sections in the about page to better match the design file
69+
- prettierrc "end of line" to auto
70+
71+
72+

components/layout/Nav.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ export default function Nav() {
4141

4242
useEffect(() => {
4343
const handleRouteChange = () => {
44-
setActive(false)
45-
}
44+
setActive(false);
45+
};
4646

47-
router.events.on('routeChangeComplete', handleRouteChange)
47+
router.events.on('routeChangeComplete', handleRouteChange);
4848

4949
return () => {
50-
router.events.off('routeChangeComplete', handleRouteChange)
51-
}
50+
router.events.off('routeChangeComplete', handleRouteChange);
51+
};
5252
}, []);
5353

54-
5554
return (
5655
<header className={styles.header} ref={headerRef}>
5756
<Container>

jsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@/components/*": ["components/*"],
66
"@/styles/*": ["styles/*"],
77
"@/hooks/*": ["hooks/*"],
8-
"@/utils/*": ["utils/*"],
8+
"@/utils/*": ["utils/*"]
99
}
1010
}
11-
}
11+
}

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
"open-browser-win": "start http://localhost:3010",
99
"open-browser-mac": "open http://localhost:3010",
1010
"build": "next build",
11-
"start": "next start"
11+
"start": "next start",
12+
"lint": "prettier --check .",
13+
"format": "prettier --write .",
14+
"prepare": "husky install"
15+
},
16+
"lint-staged": {
17+
"**/*.{js,jsx,ts,tsx,scss}": [
18+
"prettier --write"
19+
]
1220
},
1321
"dependencies": {
1422
"html-entities": "^2.3.2",
@@ -20,5 +28,11 @@
2028
"react-mailchimp-subscribe": "^2.1.3",
2129
"sass": "^1.35.1",
2230
"swiper": "^8.2.2"
31+
},
32+
"devDependencies": {
33+
"husky": "^8.0.0",
34+
"lint-staged": "^13.0.3",
35+
"prettier": "^2.7.1",
36+
"prettylint": "^1.0.0"
2337
}
2438
}

styles/CardsColumns.module.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,4 @@
1818
:global(.swiper-pagination-bullet-active) {
1919
background-color: $dark-bg-color;
2020
}
21-
2221
}
23-
24-
25-
26-

styles/Container.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
width: 90%;
66
max-width: $large-desktop-breakpoint;
77
}
8-

0 commit comments

Comments
 (0)