Skip to content

Commit 5549cea

Browse files
committed
chore: setup husky, commitlint, lint-staged, cspell
1 parent c673190 commit 5549cea

8 files changed

+938
-17
lines changed

.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+
yarn commitlint ${1}

.husky/pre-commit

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

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
- Setup husky + commitlint + lint-staged
21
- Disparar notificação quando uma pergunta receber um comentário.
32
- Disparar notificação quando uma resposta receber um comentário.

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'] }

cspell.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"language": "en, pt-br",
3+
"import": ["@cspell/dict-pt-br/cspell-ext.json"],
4+
"ignorePaths": ["mocks"],
5+
"words": ["dayjs"]
6+
}

lint-staged.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint-disable perfectionist/sort-objects */
2+
3+
module.exports = {
4+
'*': ['yarn prettify'],
5+
'**/*.{ts,tsx}': ['yarn check-spell', 'yarn lint'],
6+
'**/*': ["bash -c 'yarn check-types'", "bash -c 'yarn test'"],
7+
}

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
"scripts": {
88
"check-spell": "cspell \"src/**/*.{ts,tsx}\" --no-must-find-files --gitignore --unique --no-progress",
99
"check-types": "tsc --noEmit",
10+
"commitlint": "commitlint --edit",
1011
"lint": "eslint --max-warnings 0",
1112
"lint:fix": "eslint --fix",
13+
"lint-staged": "lint-staged --concurrent false",
14+
"prepare": "husky install",
1215
"prettify": "prettier --write --ignore-unknown",
1316
"test": "vitest run",
1417
"test:cov": "yarn test --coverage",
@@ -19,6 +22,8 @@
1922
"dayjs": "^1.11.9"
2023
},
2124
"devDependencies": {
25+
"@commitlint/cli": "^17.6.7",
26+
"@commitlint/config-conventional": "^17.6.7",
2227
"@cspell/dict-pt-br": "^2.1.4",
2328
"@faker-js/faker": "^8.0.2",
2429
"@rdgomt/eslint-config": "latest",
@@ -29,6 +34,8 @@
2934
"cspell": "^6.31.1",
3035
"eslint": "^8.44.0",
3136
"eslint-plugin-perfectionist": "^1.5.1",
37+
"husky": "^8.0.3",
38+
"lint-staged": "^13.2.3",
3239
"prettier": "^2.8.8",
3340
"typescript": "^5.1.6",
3441
"vite-tsconfig-paths": "^4.2.0",

yarn.lock

Lines changed: 908 additions & 16 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)