Skip to content

Commit ff27f94

Browse files
committed
feat(commitzen): add husky-lint-staged-commitzen to commit
1 parent 7f09e2b commit ff27f94

File tree

8 files changed

+72
-5
lines changed

8 files changed

+72
-5
lines changed

.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
extends: ['next', 'prettier', 'next/core-web-vitals'],
3+
plugins: ['react', 'react-hooks', 'prettier'],
4+
rules: {
5+
quotes: ['error', 'single'],
6+
semi: ['error', 'always'],
7+
'no-unused-vars': [
8+
'error',
9+
{
10+
args: 'after-used',
11+
caughtErrors: 'none',
12+
ignoreRestSiblings: true,
13+
vars: 'all'
14+
}
15+
],
16+
'prefer-const': 'error',
17+
'react-hooks/exhaustive-deps': 'error'
18+
}
19+
}

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

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

.husky/prepare-commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
exec < /dev/tty && npx git-cz --hook || true

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] }

package.json

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,25 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"lint:fix": "next lint --fix",
11+
"prepare": "husky install",
12+
"commit": "git-cz"
13+
},
14+
"lint-staged": {
15+
"*.{js,ts,jsx,tsx}": [
16+
"eslint --fix",
17+
"eslint",
18+
"prettier --write"
19+
],
20+
"*.json": [
21+
"prettier --write"
22+
]
23+
},
24+
"config": {
25+
"commitizen": {
26+
"path": "./node_modules/cz-conventional-changelog"
27+
}
1028
},
1129
"dependencies": {
1230
"@tailwindcss/container-queries": "^0.1.1",
@@ -15,7 +33,6 @@
1533
"@types/react-dom": "18.2.7",
1634
"autoprefixer": "10.4.16",
1735
"clsx": "^2.0.0",
18-
"eslint": "8.49.0",
1936
"eslint-config-next": "13.5.2",
2037
"next": "13.5.2",
2138
"next-themes": "^0.2.1",
@@ -24,5 +41,17 @@
2441
"react-dom": "18.2.0",
2542
"tailwindcss": "3.3.3",
2643
"typescript": "5.2.2"
44+
},
45+
"devDependencies": {
46+
"@commitlint/cli": "^17.7.2",
47+
"@commitlint/config-conventional": "^17.7.0",
48+
"commitizen": "^4.3.0",
49+
"cz-conventional-changelog": "^3.3.0",
50+
"eslint": "^8.50.0",
51+
"eslint-config-prettier": "^9.0.0",
52+
"eslint-plugin-prettier": "^5.0.0",
53+
"husky": "^8.0.0",
54+
"lint-staged": "^14.0.1",
55+
"prettier": "^3.0.3"
2756
}
2857
}

prettier.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
singleQuote: true,
3+
arrowParens: 'always',
4+
trailingComma: 'none',
5+
jsxBracketSameLine: true,
6+
printWidth: 100,
7+
tabWidth: 2,
8+
semi: false
9+
}

0 commit comments

Comments
 (0)