diff --git a/commitlint.js b/commitlint.js index 05e4f13..eae5db9 100644 --- a/commitlint.js +++ b/commitlint.js @@ -1,6 +1,7 @@ 'use strict'; -var VALID_TYPES; +var VALID_TYPES, + VALID_PREFIXES; VALID_TYPES = [ 'build', @@ -17,6 +18,11 @@ VALID_TYPES = [ 'test', ]; +VALID_PREFIXES = [ + 'Merge', + 'Revert', +]; + module.exports = { rules: { 'body-leading-blank': [ 2, 'always' ], @@ -43,4 +49,15 @@ module.exports = { VALID_TYPES.concat([ 'sub' ]), ], }, + // The default ignores of commitlint allow prefixes like fixup! and squash!, + // which we don't allow. Therefore, we're turning off defaultIgnores and + // explicitly ignoring only auto-generated merge commit and revert messages + defaultIgnores: false, + ignores: [ + (commit) => { + return VALID_PREFIXES.some((prefix) => { + return commit.startsWith(prefix); + }); + }, + ], };