Skip to content

Commit

Permalink
chore(config): update pre-commit configuration with commitlint setup
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Oct 21, 2022
1 parent 1bebaea commit 6fbb3b5
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 74 deletions.
133 changes: 68 additions & 65 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,71 @@
/** @type {import('cz-git').UserConfig} */
module.exports = {
rules: {
// @see: https://commitlint.js.org/#/reference-rules
},
// https://cz-git.qbenben.com/guide/options-show.html
prompt: {
messages: {
type: "Select the type of change that you're committing:",
scope: "Denote the SCOPE of this change (optional):",
customScope: "Denote the SCOPE of this change:",
subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
customFooterPrefixs: "Input ISSUES prefix:",
footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
confirmCommit: "Are you sure you want to proceed with the commit above?"
},
// https://github.com/sindresorhus/xterm-colors
themeColorCode: "38;5;160",
types: [
{ value: "feat", name: "feat: A new feature", emoji: ":sparkles:" },
{ value: "fix", name: "fix: A bug fix", emoji: ":bug:" },
{ value: "docs", name: "docs: Documentation only changes", emoji: ":memo:" },
{ value: "style", name: "style: Changes that do not affect the meaning of the code", emoji: ":lipstick:" },
{ value: "refactor", name: "refactor: A code change that neither fixes a bug nor adds a feature", emoji: ":recycle:" },
{ value: "perf", name: "perf: A code change that improves performance", emoji: ":zap:" },
{ value: "test", name: "test: Adding missing tests or correcting existing tests", emoji: ":white_check_mark:" },
{ value: "build", name: "build: Changes that affect the build system or external dependencies", emoji: ":package:" },
{ value: "ci", name: "ci: Changes to our CI configuration files and scripts", emoji: ":ferris_wheel:" },
{ value: "chore", name: "chore: Other changes that don't modify src or test files", emoji: ":hammer:" },
{ value: "revert", name: "revert: Reverts a previous commit", emoji: ":rewind:" }
],
useEmoji: false,
customScopesAlign: "bottom-top",
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlias: "custom",
emptyScopesAlias: "empty",
upperCaseSubject: false,
markBreakingChangeMode: true,
allowBreakingChanges: ['feat', 'fix'],
breaklineNumber: 100,
breaklineChar: "|",
skipQuestions: [],
issuePrefixs: [
{ value: "closed", name: "closed: ISSUE has been resolved" },
{ value: "see", name: "see: ISSUE is connected to this commit" }
],
customIssuePrefixsAlign: "top",
emptyIssuePrefixsAlias: "skip",
customIssuePrefixsAlias: "custom",
allowCustomIssuePrefixs: true,
allowEmptyIssuePrefixs: true,
confirmColorize: true,
maxHeaderLength: Infinity,
maxSubjectLength: Infinity,
minSubjectLength: 0,
scopeOverrides: undefined,
defaultBody: "",
defaultIssues: "",
defaultScope: "",
defaultSubject: "",
// https://cz-git.qbenben.com/config/engineer.html
}
extends: [
"@davidsneighbour/commitlint-config"
],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
},
// https://cz-git.qbenben.com/guide/options-show.html
prompt: {
messages: {
type: "Select the type of change that you're committing:",
scope: "Denote the SCOPE of this change (optional):",
customScope: "Denote the SCOPE of this change:",
subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
customFooterPrefixs: "Input ISSUES prefix:",
footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
confirmCommit: "Are you sure you want to proceed with the commit above?"
},
// https://github.com/sindresorhus/xterm-colors
themeColorCode: "38;5;160",
types: [
{ value: "feat", name: "feat: A new feature", emoji: ":sparkles:" },
{ value: "fix", name: "fix: A bug fix", emoji: ":bug:" },
{ value: "docs", name: "docs: Documentation only changes", emoji: ":memo:" },
{ value: "style", name: "style: Changes that do not affect the meaning of the code", emoji: ":lipstick:" },
{ value: "refactor", name: "refactor: A code change that neither fixes a bug nor adds a feature", emoji: ":recycle:" },
{ value: "perf", name: "perf: A code change that improves performance", emoji: ":zap:" },
{ value: "test", name: "test: Adding missing tests or correcting existing tests", emoji: ":white_check_mark:" },
{ value: "build", name: "build: Changes that affect the build system or external dependencies", emoji: ":package:" },
{ value: "ci", name: "ci: Changes to our CI configuration files and scripts", emoji: ":ferris_wheel:" },
{ value: "chore", name: "chore: Other changes that don't modify src or test files", emoji: ":hammer:" },
{ value: "revert", name: "revert: Reverts a previous commit", emoji: ":rewind:" }
],
useEmoji: false,
customScopesAlign: "bottom-top",
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlias: "custom",
emptyScopesAlias: "empty",
upperCaseSubject: false,
markBreakingChangeMode: true,
allowBreakingChanges: ['feat', 'fix'],
breaklineNumber: 100,
breaklineChar: "|",
skipQuestions: [],
issuePrefixs: [
{ value: "closed", name: "closed: ISSUE has been resolved" },
{ value: "see", name: "see: ISSUE is connected to this commit" }
],
customIssuePrefixsAlign: "top",
emptyIssuePrefixsAlias: "skip",
customIssuePrefixsAlias: "custom",
allowCustomIssuePrefixs: true,
allowEmptyIssuePrefixs: true,
confirmColorize: true,
maxHeaderLength: Infinity,
maxSubjectLength: Infinity,
minSubjectLength: 0,
scopeOverrides: undefined,
defaultBody: "",
defaultIssues: "",
defaultScope: "",
defaultSubject: "",
// https://cz-git.qbenben.com/config/engineer.html
}
}
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.1.0
# install with `pre-commit install --hook-type commit-msg`
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@davidsneighbour/commitlint-config']
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.2.0
rev: v4.3.0
hooks:
- id: check-byte-order-marker #- forbids files which have a utf-8 byte-order marker.
- id: check-case-conflict #- checks for files that would conflict in case-insensitive filesystems.
Expand Down Expand Up @@ -46,14 +53,14 @@ repos:
- id: blocklint

- repo: 'https://github.com/adrienverge/yamllint'
rev: v1.26.3
rev: v1.28.0
hooks:
- id: yamllint
args: [-c=tests/config/yamllint.yaml]
exclude: ^(_vendor|.github/workflows|.pre-commit-config.yaml)

- repo: 'https://github.com/jumanjihouse/pre-commit-hooks'
rev: 2.1.6
rev: 3.0.0
hooks:
- id: check-mailmap
- id: script-must-have-extension
Expand All @@ -66,7 +73,7 @@ repos:
- id: shfmt

- repo: 'https://github.com/zricethezav/gitleaks'
rev: v8.8.4
rev: v8.15.0
hooks:
- id: gitleaks

Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@
"not opera > 0",
"not IE > 0"
],
"commitlint": {
"extends": [
"@davidsneighbour/config/commitlint"
]
},
"eslintConfig": {
"extends": "@davidsneighbour/eslint-config"
},
Expand Down

0 comments on commit 6fbb3b5

Please sign in to comment.