Skip to content

Commit

Permalink
configure husky and lint staged
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Phillips committed Oct 3, 2022
1 parent 06c7b58 commit 819c96a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "next/core-web-vitals"
"extends": ["next/core-web-vitals", "prettier"],
"rules": {
// prevent unused imports
"no-unused-vars": "error"
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,md}": [
"**/*.{js,jsx,ts,tsx,css}": [
"prettier --write",
"next lint"
"eslint --cache --cache-location .next/cache/eslint/"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"dependencies": {
"next": "12.3.1",
"react": "18.2.0",
Expand All @@ -34,6 +29,7 @@
"autoprefixer": "^10.4.12",
"eslint": "8.24.0",
"eslint-config-next": "12.3.1",
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"postcss": "^8.4.16",
Expand Down
1 change: 0 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const Home: NextPage = () => {
<main className="grid h-full place-content-center">
<h1 className="animate-bounce text-4xl font-bold">Hello Next.js!</h1>
<Countdown targetDate={EVENT_DATE} />
<p>test</p>
</main>
</>
);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,11 @@ [email protected]:
eslint-plugin-react "^7.31.7"
eslint-plugin-react-hooks "^4.5.0"

eslint-config-prettier@^8.5.0:
version "8.5.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1"
integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==

eslint-import-resolver-node@^0.3.6:
version "0.3.6"
resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz"
Expand Down

0 comments on commit 819c96a

Please sign in to comment.