Created
April 16, 2022 23:45
-
-
Save crutch12/5430853b09aca4d305b8e4b6cfd6b4e4 to your computer and use it in GitHub Desktop.
Branch name lint config (+ .husky/pre-push hook file)
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
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const branchNameLint = require('@web-bee-ru/branch-name-lint'); | |
// See: https://github.com/barzik/branch-name-lint#options | |
const options = { | |
prefixes: ['feature', 'hotfix', 'release'], | |
suggestions: { | |
features: 'feature', | |
feat: 'feature', | |
fix: 'hotfix', | |
releases: 'release', | |
}, | |
banned: ['wip', 'bugfix'], | |
skip: ['master', 'develop', 'main'], | |
disallowed: ['staging'], | |
separator: '/', | |
msgBranchBanned: 'Branches with the name "%s" are not allowed.', | |
msgBranchDisallowed: 'Pushing to "%s" is not allowed, use git-flow.', | |
msgPrefixNotAllowed: 'Branch prefix "%s" is not allowed.', | |
msgPrefixSuggestion: 'Instead of "%s" try "%s".', | |
msgseparatorRequired: 'Branch "%s" must contain a separator "%s".', | |
msgDoesNotMatchRegex: 'Branch "%s" does not match the allowed pattern: "%s"', | |
}; | |
const answer = new branchNameLint(options).doValidation(); | |
if (answer === 1) { | |
process.exit(1); | |
} |
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
#!/bin/sh | |
. "$(dirname "$0")/_/husky.sh" | |
node ./branchNameLint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment