-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add lefthook and commitlint config
- Loading branch information
Showing
5 changed files
with
1,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ cache/** | |
!cache/.gitkeep | ||
config.yaml | ||
bin/** | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import type { UserConfig } from "@commitlint/types"; | ||
import { RuleConfigSeverity } from "@commitlint/types"; | ||
|
||
const Configuration: UserConfig = { | ||
extends: ["@commitlint/config-conventional"], | ||
formatter: "@commitlint/format", | ||
rules: { | ||
"header-max-length": [ | ||
RuleConfigSeverity.Error, | ||
"always", | ||
Infinity, | ||
] as const, | ||
"body-max-length": [RuleConfigSeverity.Error, "always", Infinity] as const, | ||
"body-max-line-length": [ | ||
RuleConfigSeverity.Error, | ||
"always", | ||
Infinity, | ||
] as const, | ||
"type-enum": [ | ||
RuleConfigSeverity.Error, | ||
"always", | ||
[ | ||
"feat", | ||
"fix", | ||
"perf", | ||
"revert", | ||
"docs", | ||
"chore", | ||
"ref", | ||
"test", | ||
"ci", | ||
"deps", | ||
"build", | ||
], | ||
], | ||
}, | ||
prompt: { | ||
questions: { | ||
type: { | ||
description: "Select the type of change that you're committing", | ||
enum: { | ||
feat: { | ||
description: "A new feature", | ||
title: "Features", | ||
emoji: "🆕", | ||
}, | ||
fix: { | ||
description: "A bug fix", | ||
title: "Bug Fixes", | ||
emoji: "🪲", | ||
}, | ||
perf: { | ||
description: "A code change that improves performance", | ||
title: "Performance Improvements", | ||
emoji: "🚀", | ||
}, | ||
revert: { | ||
description: "Reverts a previous commit", | ||
title: "Reverts", | ||
emoji: "⏪", | ||
}, | ||
docs: { | ||
description: "Documentation only changes", | ||
title: "Documentation", | ||
emoji: "📑", | ||
}, | ||
chore: { | ||
description: "Other changes that don't modify src or test files", | ||
title: "Chores", | ||
emoji: "⚓", | ||
}, | ||
ref: { | ||
description: | ||
"A code change that neither fixes a bug nor adds a feature", | ||
title: "Code Refactoring", | ||
emoji: "🧹", | ||
}, | ||
test: { | ||
description: "Adding missing tests or correcting existing tests", | ||
title: "Tests", | ||
emoji: "⌛", | ||
}, | ||
ci: { | ||
description: | ||
"Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)", | ||
title: "Continuous Integrations", | ||
emoji: "♾️", | ||
}, | ||
deps: { | ||
description: "Dependencies", | ||
title: "Dependencies", | ||
emoji: "🛠️", | ||
}, | ||
build: { | ||
description: "Build", | ||
title: "Build", | ||
emoji: "🏗️", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default Configuration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pre-push: | ||
commands: | ||
backend-lint: | ||
root: backend/ | ||
tags: backend | ||
glob: "*.go" | ||
run: golangci-lint run | ||
|
||
commitlint: | ||
tags: commandlint | ||
run: | | ||
_HEAD=$(git rev-parse HEAD) | ||
_COMMITS=$(git rev-list --count HEAD ^main) | ||
npx commitlint --from "${_HEAD}"~"${_COMMITS}" --to "${_HEAD}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"lefthook": "^1.6.15" | ||
} | ||
} |
Oops, something went wrong.