Skip to content

Commit faa8b12

Browse files
committed
fix: do not lint commit types with scopes
1 parent 56e21ed commit faa8b12

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "git-commit-formatter",
33
"displayName": "Git Commit Message Formatter",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"description": "Format commit messages from the source control input box",
66
"main": "./out/extension.js",
77
"scripts": {

src/subjectLineCompletionItemProvider.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ export class SummaryLineTypeCompletionItemProvider implements vscode.CompletionI
9494
return true;
9595
}
9696

97-
const prefix = text.includes(':') ? text.split(':')[0] : '';
97+
let prefix = text.includes(':') ? text.split(':')[0] : '';
98+
// Strip scope from prefix, if any
99+
const scopeRegex = /^([a-zA-Z]+)\(([a-zA-Z]+)\)/g;
100+
prefix = scopeRegex.exec(prefix)?.[1] ?? prefix;
98101
const allowedPrefixes = this._getAllowedPrefixes();
99102
return allowedPrefixes.includes(prefix) ? true : prefix;
100103
}

0 commit comments

Comments
 (0)