@commitlint/cli
Advanced tools
Comparing version 17.0.0 to 17.0.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [17.0.1](https://github.com/conventional-changelog/commitlint/compare/v17.0.0...v17.0.1) (2022-05-25) | ||
### Bug Fixes | ||
* **cli:** use `core.commentChar` from git config with `--edit` flag ([#3191](https://github.com/conventional-changelog/commitlint/issues/3191)) ([e5fee05](https://github.com/conventional-changelog/commitlint/commit/e5fee05301ab7441b6091e4ee6fc095d26bbd589)), closes [#3190](https://github.com/conventional-changelog/commitlint/issues/3190) [#3190](https://github.com/conventional-changelog/commitlint/issues/3190) [#3190](https://github.com/conventional-changelog/commitlint/issues/3190) | ||
# [17.0.0](https://github.com/conventional-changelog/commitlint/compare/v16.3.0...v17.0.0) (2022-05-16) | ||
@@ -8,0 +19,0 @@ |
@@ -13,2 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const execa_1 = __importDefault(require("execa")); | ||
const load_1 = __importDefault(require("@commitlint/load")); | ||
@@ -24,2 +25,3 @@ const lint_1 = __importDefault(require("@commitlint/lint")); | ||
const pkg = require('../package'); | ||
const gitDefaultCommentChar = '#'; | ||
const cli = yargs_1.default | ||
@@ -201,7 +203,18 @@ .options({ | ||
const format = loadFormatter(loaded, flags); | ||
// Strip comments if reading from `.git/COMMIT_EDIT_MSG` using the | ||
// commentChar from the parser preset falling back to a `#` if that is not | ||
// set | ||
if (flags.edit && typeof opts.parserOpts.commentChar !== 'string') { | ||
opts.parserOpts.commentChar = '#'; | ||
// If reading from `.git/COMMIT_EDIT_MSG`, strip comments using | ||
// core.commentChar from git configuration, falling back to '#'. | ||
if (flags.edit) { | ||
try { | ||
const { stdout } = await (0, execa_1.default)('git', ['config', 'core.commentChar']); | ||
opts.parserOpts.commentChar = stdout.trim() || gitDefaultCommentChar; | ||
} | ||
catch (e) { | ||
const execaError = e; | ||
// git config returns exit code 1 when the setting is unset, | ||
// don't warn in this case. | ||
if (!execaError.failed || execaError.exitCode !== 1) { | ||
console.warn('Could not determine core.commentChar git configuration', e); | ||
} | ||
opts.parserOpts.commentChar = gitDefaultCommentChar; | ||
} | ||
} | ||
@@ -208,0 +221,0 @@ const results = await Promise.all(messages.map((message) => (0, lint_1.default)(message, loaded.rules, opts))); |
{ | ||
"name": "@commitlint/cli", | ||
"version": "17.0.0", | ||
"version": "17.0.1", | ||
"description": "Lint your commit messages", | ||
@@ -44,3 +44,2 @@ "files": [ | ||
"@types/yargs": "^17.0.0", | ||
"execa": "^5.0.0", | ||
"fs-extra": "^10.0.0" | ||
@@ -54,2 +53,3 @@ }, | ||
"@commitlint/types": "^17.0.0", | ||
"execa": "^5.0.0", | ||
"lodash": "^4.17.19", | ||
@@ -60,3 +60,3 @@ "resolve-from": "5.0.0", | ||
}, | ||
"gitHead": "ed437d29464ab1b239deecb84ce4d1f2a5e471c6" | ||
"gitHead": "b0bc456903a9e74d0b0db1028b5265a8bf01d26f" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57379
5
396
10
+ Addedexeca@^5.0.0