Skip to content

Commit

Permalink
feat: implement husky and lint-stage
Browse files Browse the repository at this point in the history
  • Loading branch information
damla committed Apr 17, 2022
1 parent a671849 commit 12271b8
Show file tree
Hide file tree
Showing 8 changed files with 391 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
node_modules
.github
12 changes: 12 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

#!/bin/sh
if ! head -1 "$1" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+?\))?: .{1,}$"; then
echo "Aborting commit. Your commit message is invalid." >&2
exit 1
fi
if ! head -1 "$1" | grep -qE "^.{1,88}$"; then
echo "Aborting commit. Your commit message is too long." >&2
exit 1
fi
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.(js|jsx|ts|tsx)": "eslint --fix"
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
node_modules
.github
19 changes: 17 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"prepare": "husky install"
},
"dependencies": {
"next": "12.1.5",
"react": "18.0.0",
"react-dom": "18.0.0"
"react-dom": "18.0.0",
"classnames": "^2.3.1"
},
"devDependencies": {
"@types/node": "17.0.24",
Expand All @@ -23,8 +25,21 @@
"eslint-config-next": "12.1.5",
"eslint-config-prettier": "^8.5.0",
"postcss": "^8.4.12",
"husky": "^7.0.0",
"lint-staged": "^12.1.2",
"prettier": "^2.6.2",
"tailwindcss": "^3.0.24",
"typescript": "4.6.3"
},
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --quiet --fix"
],
"./src/**/*.{js,ts,jsx,tsx}": [
"prettier --write"
],
"./src/components/**/*.{js,ts,jsx,tsx}": [
"prettier --write"
]
}
}
2 changes: 2 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Home: NextPage = () => {
<link rel="icon" href="/favicon.ico" />
</Head>
</>


);
};

Expand Down
Loading

0 comments on commit 12271b8

Please sign in to comment.