@commitlint/rules
Advanced tools
Comparing version 18.4.3 to 18.4.4
@@ -32,4 +32,4 @@ "use strict"; | ||
const message_1 = __importDefault(require("@commitlint/message")); | ||
const scopeEnum = (parsed, when = 'always', value = []) => { | ||
if (!parsed.scope) { | ||
const scopeEnum = ({ scope }, when = 'always', value = []) => { | ||
if (!scope || !value.length) { | ||
return [true, '']; | ||
@@ -40,16 +40,16 @@ } | ||
const delimiters = /\/|\\|, ?/g; | ||
const scopeSegments = parsed.scope.split(delimiters); | ||
const negated = when === 'never'; | ||
const result = value.length === 0 || | ||
scopeSegments.every((scope) => ensure.enum(scope, value)); | ||
return [ | ||
negated ? !result : result, | ||
(0, message_1.default)([ | ||
`scope must`, | ||
negated ? `not` : null, | ||
`be one of [${value.join(', ')}]`, | ||
]), | ||
]; | ||
const messageScopes = scope.split(delimiters); | ||
const errorMessage = ['scope must', `be one of [${value.join(', ')}]`]; | ||
const isScopeInEnum = (scope) => ensure.enum(scope, value); | ||
let isValid; | ||
if (when === 'never') { | ||
isValid = !messageScopes.some(isScopeInEnum); | ||
errorMessage.splice(1, 0, 'not'); | ||
} | ||
else { | ||
isValid = messageScopes.every(isScopeInEnum); | ||
} | ||
return [isValid, (0, message_1.default)(errorMessage)]; | ||
}; | ||
exports.scopeEnum = scopeEnum; | ||
//# sourceMappingURL=scope-enum.js.map |
@@ -15,3 +15,6 @@ "use strict"; | ||
const negated = when === 'never'; | ||
const hasStop = input[input.length - 1] === value; | ||
let hasStop = input[input.length - 1] === value; | ||
if (input.slice(-3) === '...') { | ||
hasStop = false; | ||
} | ||
return [ | ||
@@ -18,0 +21,0 @@ negated ? !hasStop : hasStop, |
{ | ||
"name": "@commitlint/rules", | ||
"version": "18.4.3", | ||
"version": "18.4.4", | ||
"description": "Lint your commit messages", | ||
@@ -38,5 +38,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@commitlint/parse": "^18.4.3", | ||
"@commitlint/parse": "^18.4.4", | ||
"@commitlint/test": "^18.0.0", | ||
"@commitlint/utils": "^18.4.3", | ||
"@commitlint/utils": "^18.4.4", | ||
"conventional-changelog-angular": "7.0.0", | ||
@@ -46,9 +46,9 @@ "glob": "^8.0.3" | ||
"dependencies": { | ||
"@commitlint/ensure": "^18.4.3", | ||
"@commitlint/message": "^18.4.3", | ||
"@commitlint/to-lines": "^18.4.3", | ||
"@commitlint/types": "^18.4.3", | ||
"@commitlint/ensure": "^18.4.4", | ||
"@commitlint/message": "^18.4.4", | ||
"@commitlint/to-lines": "^18.4.4", | ||
"@commitlint/types": "^18.4.4", | ||
"execa": "^5.0.0" | ||
}, | ||
"gitHead": "970b806bdd338e8b3e4529f21f20e795e66cd48f" | ||
"gitHead": "ad2637f3cf23c5579e600950594e4d8d47d79864" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
84082
1075
+ Addedcross-spawn@7.0.5(transitive)
- Removedcross-spawn@7.0.3(transitive)
Updated@commitlint/ensure@^18.4.4
Updated@commitlint/message@^18.4.4
Updated@commitlint/to-lines@^18.4.4
Updated@commitlint/types@^18.4.4