"ignores" commit is not trimmed
#3.162 aberto em 3 de mai. de 2022
Métricas do repositório
- Stars
- (15.497 stars)
- Métricas de merge de PR
- (Mesclagem média 5d 19h) (65 fundiu PRs em 30d)
Description
Hi all,
I am trying to use the ignores option in the configuration file to ignore a specific commit message.
Expected Behavior
Defining a function in the ignores array should ignore a specific commit message and allow it to pass if it is not conventional.
Current Behavior
echo "Initialize project using Create React App" | yarn commitlint
⧗ input: Initialize project using Create React App
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
Affected packages
- cli
- core
- prompt
- config-angular
module.exports = {
extends: ["@commitlint/config-conventional"],
ignores: [
(commit) => commit === "Initialize project using Create React App",
],
};
Context
I would like to ignore this specific commit that is made by Create React App.
I am using a custom template that installs some Husky git hooks that uses commitlint during the bootstrap, prior to Create React App making the commit.
Currently, the commit is failing, and then Create React App deletes the .git directory.
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
at checkExecSyncError (node:child_process:828:11)
at execSync (node:child_process:899:15)
at tryGitCommit (/Users/damienbutt/Projects/test-husky-postinstall-yarn/node_modules/react-scripts/scripts/init.js:62:5)
at module.exports (/Users/damienbutt/Projects/test-husky-postinstall-yarn/node_modules/react-scripts/scripts/init.js:350:25)
at [eval]:3:14
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:305:38)
at node:internal/process/execution:76:19
at [eval]-wrapper:6:22 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 71554,
stdout: null,
stderr: null
}
Removing .git directory...
It doesn't say it fails because of commitlint but I think that is because the execSync function is not set up to output to stdout. However, in testing, if I stop the Husky git hooks from being installed during the bootstrap of Create React App, it is able to successfully make the commit.
I would like to just ignore and allow this specific commit message from Create React App.
Your Environment
| Executable | Version |
|---|---|
commitlint --version |
@commitlint/cli@16.2.4 |
git --version |
2.36.0 |
node --version |
16.15.0 |