@commitlint/is-ignored 7.5.1 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * config based is-ignored overrides ([#595](https://github.com/conventional-changelog/commitlint/issues/595)) ([2434d71](https://github.com/conventional-changelog/commitlint/commit/2434d71))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.5.1](https://github.com/conventional-changelog/commitlint/compare/v7.5.0...v7.5.1) (2019-02-09)
7
18
 
8
19
 
package/lib/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.WILDCARDS = undefined;
6
7
  exports.default = isIgnored;
7
8
 
8
9
  var _semver = require('semver');
@@ -11,10 +12,22 @@ var _semver2 = _interopRequireDefault(_semver);
11
12
 
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
 
14
- const WILDCARDS = [c => c.match(/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m), c => c.match(/^(R|r)evert (.*)/), c => c.match(/^(fixup|squash)!/), c => _semver2.default.valid(c.split('\n').shift().replace(/^chore(\([^)]+\))?:/, '').trim()), c => c.match(/^Merged (.*?)(in|into) (.*)/), c => c.match(/^Merge remote-tracking branch (.*)/), c => c.match(/^Automatic merge(.*)/), c => c.match(/^Auto-merged (.*?) into (.*)/)];
15
+ const WILDCARDS = exports.WILDCARDS = [c => c.match(/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m), c => c.match(/^(R|r)evert (.*)/), c => c.match(/^(fixup|squash)!/), c => _semver2.default.valid(c.split('\n').shift().replace(/^chore(\([^)]+\))?:/, '').trim()), c => c.match(/^Merged (.*?)(in|into) (.*)/), c => c.match(/^Merge remote-tracking branch (.*)/), c => c.match(/^Automatic merge(.*)/), c => c.match(/^Auto-merged (.*?) into (.*)/)];
15
16
 
16
- function isIgnored(commit = '') {
17
- return WILDCARDS.some(w => w(commit));
17
+ function isIgnored(commit = '', opts = {}) {
18
+ const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;
19
+
20
+ if (!Array.isArray(ignores)) {
21
+ throw new Error(`ignores must be of type array, received ${ignores} of type ${typeof ignores}`);
22
+ }
23
+
24
+ const invalids = ignores.filter(c => typeof c !== 'function');
25
+
26
+ if (invalids.length > 0) {
27
+ throw new Error(`ignores must be array of type function, received items of type: ${invalids.map(i => typeof i).join(', ')}`);
28
+ }
29
+
30
+ const base = opts.defaults === false ? [] : WILDCARDS;
31
+ return [...base, ...ignores].some(w => w(commit));
18
32
  }
19
- module.exports = exports['default'];
20
33
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["isIgnored","WILDCARDS","c","match","valid","split","shift","replace","trim","commit","some","w"],"mappings":";;;;;kBAuBwBA,S;;AAvBxB;;;;;;AAEA,MAAMC,YAAY,CACjBC,KACCA,EAAEC,KAAF,CACC,mFADD,CAFgB,EAKjBD,KAAKA,EAAEC,KAAF,CAAQ,kBAAR,CALY,EAMjBD,KAAKA,EAAEC,KAAF,CAAQ,kBAAR,CANY,EAOjBD,KACC,iBAAOE,KAAP,CACCF,EACEG,KADF,CACQ,IADR,EAEEC,KAFF,GAGEC,OAHF,CAGU,qBAHV,EAGiC,EAHjC,EAIEC,IAJF,EADD,CARgB,EAejBN,KAAKA,EAAEC,KAAF,CAAQ,6BAAR,CAfY,EAgBjBD,KAAKA,EAAEC,KAAF,CAAQ,oCAAR,CAhBY,EAiBjBD,KAAKA,EAAEC,KAAF,CAAQ,sBAAR,CAjBY,EAkBjBD,KAAKA,EAAEC,KAAF,CAAQ,8BAAR,CAlBY,CAAlB;;AAqBe,SAASH,SAAT,CAAmBS,SAAS,EAA5B,EAAgC;AAC9C,QAAOR,UAAUS,IAAV,CAAeC,KAAKA,EAAEF,MAAF,CAApB,CAAP;AACA","file":"index.js","sourcesContent":["import semver from 'semver';\n\nconst WILDCARDS = [\n\tc =>\n\t\tc.match(\n\t\t\t/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\\r?\\n)*$)/m\n\t\t),\n\tc => c.match(/^(R|r)evert (.*)/),\n\tc => c.match(/^(fixup|squash)!/),\n\tc =>\n\t\tsemver.valid(\n\t\t\tc\n\t\t\t\t.split('\\n')\n\t\t\t\t.shift()\n\t\t\t\t.replace(/^chore(\\([^)]+\\))?:/, '')\n\t\t\t\t.trim()\n\t\t),\n\tc => c.match(/^Merged (.*?)(in|into) (.*)/),\n\tc => c.match(/^Merge remote-tracking branch (.*)/),\n\tc => c.match(/^Automatic merge(.*)/),\n\tc => c.match(/^Auto-merged (.*?) into (.*)/)\n];\n\nexport default function isIgnored(commit = '') {\n\treturn WILDCARDS.some(w => w(commit));\n}\n"]}
1
+ {"version":3,"sources":["../src/index.js"],"names":["isIgnored","WILDCARDS","c","match","valid","split","shift","replace","trim","commit","opts","ignores","Array","isArray","Error","invalids","filter","length","map","i","join","base","defaults","some","w"],"mappings":";;;;;;kBAuBwBA,S;;AAvBxB;;;;;;AAEO,MAAMC,gCAAY,CACxBC,KACCA,EAAEC,KAAF,CACC,mFADD,CAFuB,EAKxBD,KAAKA,EAAEC,KAAF,CAAQ,kBAAR,CALmB,EAMxBD,KAAKA,EAAEC,KAAF,CAAQ,kBAAR,CANmB,EAOxBD,KACC,iBAAOE,KAAP,CACCF,EACEG,KADF,CACQ,IADR,EAEEC,KAFF,GAGEC,OAHF,CAGU,qBAHV,EAGiC,EAHjC,EAIEC,IAJF,EADD,CARuB,EAexBN,KAAKA,EAAEC,KAAF,CAAQ,6BAAR,CAfmB,EAgBxBD,KAAKA,EAAEC,KAAF,CAAQ,oCAAR,CAhBmB,EAiBxBD,KAAKA,EAAEC,KAAF,CAAQ,sBAAR,CAjBmB,EAkBxBD,KAAKA,EAAEC,KAAF,CAAQ,8BAAR,CAlBmB,CAAlB;;AAqBQ,SAASH,SAAT,CAAmBS,SAAS,EAA5B,EAAgCC,OAAO,EAAvC,EAA2C;AACzD,OAAMC,UAAU,OAAOD,KAAKC,OAAZ,KAAwB,WAAxB,GAAsC,EAAtC,GAA2CD,KAAKC,OAAhE;;AAEA,KAAI,CAACC,MAAMC,OAAN,CAAcF,OAAd,CAAL,EAA6B;AAC5B,QAAM,IAAIG,KAAJ,CACJ,2CAA0CH,OAAQ,YAAW,OAAOA,OAAQ,EADxE,CAAN;AAGA;;AAED,OAAMI,WAAWJ,QAAQK,MAAR,CAAed,KAAK,OAAOA,CAAP,KAAa,UAAjC,CAAjB;;AAEA,KAAIa,SAASE,MAAT,GAAkB,CAAtB,EAAyB;AACxB,QAAM,IAAIH,KAAJ,CACJ,mEAAkEC,SACjEG,GADiE,CAC7DC,KAAK,OAAOA,CADiD,EAEjEC,IAFiE,CAE5D,IAF4D,CAEtD,EAHR,CAAN;AAKA;;AAED,OAAMC,OAAOX,KAAKY,QAAL,KAAkB,KAAlB,GAA0B,EAA1B,GAA+BrB,SAA5C;AACA,QAAO,CAAC,GAAGoB,IAAJ,EAAU,GAAGV,OAAb,EAAsBY,IAAtB,CAA2BC,KAAKA,EAAEf,MAAF,CAAhC,CAAP;AACA","file":"index.js","sourcesContent":["import semver from 'semver';\n\nexport const WILDCARDS = [\n\tc =>\n\t\tc.match(\n\t\t\t/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\\r?\\n)*$)/m\n\t\t),\n\tc => c.match(/^(R|r)evert (.*)/),\n\tc => c.match(/^(fixup|squash)!/),\n\tc =>\n\t\tsemver.valid(\n\t\t\tc\n\t\t\t\t.split('\\n')\n\t\t\t\t.shift()\n\t\t\t\t.replace(/^chore(\\([^)]+\\))?:/, '')\n\t\t\t\t.trim()\n\t\t),\n\tc => c.match(/^Merged (.*?)(in|into) (.*)/),\n\tc => c.match(/^Merge remote-tracking branch (.*)/),\n\tc => c.match(/^Automatic merge(.*)/),\n\tc => c.match(/^Auto-merged (.*?) into (.*)/)\n];\n\nexport default function isIgnored(commit = '', opts = {}) {\n\tconst ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;\n\n\tif (!Array.isArray(ignores)) {\n\t\tthrow new Error(\n\t\t\t`ignores must be of type array, received ${ignores} of type ${typeof ignores}`\n\t\t);\n\t}\n\n\tconst invalids = ignores.filter(c => typeof c !== 'function');\n\n\tif (invalids.length > 0) {\n\t\tthrow new Error(\n\t\t\t`ignores must be array of type function, received items of type: ${invalids\n\t\t\t\t.map(i => typeof i)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t}\n\n\tconst base = opts.defaults === false ? [] : WILDCARDS;\n\treturn [...base, ...ignores].some(w => w(commit));\n}\n"]}
package/lib/index.test.js CHANGED
@@ -92,4 +92,32 @@ const AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce((results, message) => {
92
92
  (0, _ava2.default)('should return false for commits containing, but not starting, with merge branch', t => {
93
93
  t.false((0, _2.default)('foo bar Merge branch xxx'));
94
94
  });
95
+
96
+ (0, _ava2.default)('should return false for ignored message if defaults is false', t => {
97
+ t.false((0, _2.default)('Auto-merged develop into master', {
98
+ defaults: false
99
+ }));
100
+ });
101
+
102
+ (0, _ava2.default)('should return false for ignored message if custom ignores and defaults is false', t => {
103
+ t.false((0, _2.default)('Auto-merged develop into master', {
104
+ defaults: false
105
+ }));
106
+ });
107
+
108
+ (0, _ava2.default)('should throw error if ignores is not an array', t => {
109
+ const ignoredString = 'this should be ignored';
110
+ t.throws(() => {
111
+ (0, _2.default)(ignoredString, {
112
+ ignores: 'throws error'
113
+ });
114
+ });
115
+ });
116
+
117
+ (0, _ava2.default)('should return true for custom ignores as function', t => {
118
+ const ignoredString = 'this should be ignored';
119
+ t.true((0, _2.default)(ignoredString, {
120
+ ignores: [c => c === ignoredString]
121
+ }));
122
+ });
95
123
  //# sourceMappingURL=index.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.test.js"],"names":["VERSION_MESSAGES","AMENDMENTS","AMENDED_VERSION_MESSAGES","reduce","results","message","map","amendment","t","false","true","forEach"],"mappings":";;AAAA;;;;AACA;;;;;;AAEA,MAAMA,mBAAmB,CACxB,OADwB,EAExB,OAFwB,EAGxB,OAHwB,EAIxB,aAJwB,EAKxB,sBALwB,EAMxB,SANwB,EAOxB,WAPwB,EAQxB,eARwB,EASxB,iBATwB,EAUxB,wBAVwB,EAWxB,0BAXwB,EAYxB,eAZwB,EAaxB,QAbwB,EAcxB,SAdwB,CAAzB;;AAiBA,MAAMC,aAAa,CAClB,gDADkB,EAElB,sDAFkB,EAGlB,sGAHkB,CAAnB;;AAMA,MAAMC,2BAA2BF,iBAAiBG,MAAjB,CAAwB,CAACC,OAAD,EAAUC,OAAV,KAAsB;AAC9E,QAAO,CACN,GAAGD,OADG,EAEN,GAAGH,WAAWK,GAAX,CAAeC,aAAc,GAAEF,OAAQ,OAAME,SAAU,EAAvD,CAFG,CAAP;AAIA,CALgC,EAK9B,EAL8B,CAAjC;;AAOA,mBAAK,mDAAL,EAA0DC,KAAK;AAC9DA,GAAEC,KAAF,CAAQ,iBAAR;AACA,CAFD;;AAIA,mBAAK,mDAAL,EAA0DD,KAAK;AAC9DA,GAAEC,KAAF,CAAQ,gBAAU,EAAV,CAAR;AACA,CAFD;;AAIA,mBAAK,uCAAL,EAA8CD,KAAK;AAClDA,GAAEC,KAAF,CAAQ,gBAAU,gBAAV,CAAR;AACA,CAFD;;AAIA,mBAAK,sCAAL,EAA6CD,KAAK;AACjDA,GAAEE,IAAF,CAAO,gBAAU,sBAAV,CAAP;AACA,CAFD;;AA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,CAAP;AACA,CAFD;;AAIA,mBAAK,mCAAL,EAA0CF,KAAK;AAC9CA,GAAEE,IAAF,CAAO,gBAAU,wBAAV,CAAP;AACA,CAFD;;AAIA,mBAAK,gDAAL,EAAuDF,KAAK;AAC3DA,GAAEE,IAAF,CACC,gBAAU,2DAAV,CADD;AAGAF,GAAEE,IAAF,CAAO,gBAAU,wDAAV,CAAP;AACAF,GAAEE,IAAF,CAAO,gBAAU,iBAAV,CAAP;AACA,CAND;;AAQA,mBAAK,gDAAL,EAAuDF,KAAK;AAC3DA,GAAEE,IAAF,CAAO,gBAAU,iCAAV,CAAP;AACA,CAFD;;AAIA,mBAAK,iFAAL,EAAwFF,KAAK;AAC5FA,GAAEC,KAAF,CAAQ,gBAAU,0BAAV,CAAR;AACA,CAFD","file":"index.test.js","sourcesContent":["import test from 'ava';\nimport isIgnored from '.';\n\nconst VERSION_MESSAGES = [\n\t'0.0.1',\n\t'0.1.0',\n\t'1.0.0',\n\t'0.0.1-alpha',\n\t'0.0.1-some-crazy-tag',\n\t'0.0.1-0',\n\t'0.0.1-999',\n\t'0.0.1-alpha.0',\n\t'0.0.1-alpha.999',\n\t'0.0.1-some-crazy-tag.0',\n\t'0.0.1-some-crazy-tag.999',\n\t'0.0.1-1e69d54',\n\t'v0.0.1',\n\t' v3.0.0'\n];\n\nconst AMENDMENTS = [\n\t'Signed-off-by: Developer <example@example.com>',\n\t'Change-Id: I895114872a515a269487a683124b63303818e19c',\n\t'Signed-off-by: Developer <example@example.com>\\nChange-Id: I895114872a515a269487a683124b63303818e19c'\n];\n\nconst AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce((results, message) => {\n\treturn [\n\t\t...results,\n\t\t...AMENDMENTS.map(amendment => `${message}\\n\\n${amendment}`)\n\t];\n}, []);\n\ntest('should return false when called without arguments', t => {\n\tt.false(isIgnored());\n});\n\ntest('should return false when called with empty string', t => {\n\tt.false(isIgnored(''));\n});\n\ntest('should return false for normal commit', t => {\n\tt.false(isIgnored('initial commit'));\n});\n\ntest('should return true for branch merges', t => {\n\tt.true(isIgnored(\"Merge branch 'iss53'\"));\n});\n\ntest('should return true for branch merges with newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\"));\n});\n\ntest('should return true for branch merges with multiple newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\\n\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\\r\\n\\r\\n\"));\n});\n\ntest('should return true for merged PRs', t => {\n\tt.true(isIgnored('Merge pull request #369'));\n});\n\ntest('should return true for branch merges with newline characters and more characters after it', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n \"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n # some comment\"));\n});\n\ntest('should return true for revert commits', t => {\n\tt.true(\n\t\tisIgnored(\n\t\t\t`Revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n\tt.true(\n\t\tisIgnored(\n\t\t\t`revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n});\n\ntest('should ignore npm semver commits', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should ignore npm semver commits with chore', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(`chore: ${message}`)));\n\tVERSION_MESSAGES.forEach(message =>\n\t\tt.true(isIgnored(`chore(release): ${message}`))\n\t);\n});\n\ntest('should ignore npm semver commits with footers', t => {\n\tAMENDED_VERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should return true fixup commits', t => {\n\tt.true(isIgnored('fixup! initial commit'));\n});\n\ntest('should return true squash commits', t => {\n\tt.true(isIgnored('squash! initial commit'));\n});\n\ntest('should return true for bitbucket merge commits', t => {\n\tt.true(\n\t\tisIgnored('Merged in feature/facebook-friends-sync (pull request #8)')\n\t);\n\tt.true(isIgnored('Merged develop into feature/component-form-select-card'));\n\tt.true(isIgnored('Automatic merge'));\n});\n\ntest('should return true for automatic merge commits', t => {\n\tt.true(isIgnored('Auto-merged develop into master'));\n});\n\ntest('should return false for commits containing, but not starting, with merge branch', t => {\n\tt.false(isIgnored('foo bar Merge branch xxx'));\n});\n"]}
1
+ {"version":3,"sources":["../src/index.test.js"],"names":["VERSION_MESSAGES","AMENDMENTS","AMENDED_VERSION_MESSAGES","reduce","results","message","map","amendment","t","false","true","forEach","defaults","ignoredString","throws","ignores","c"],"mappings":";;AAAA;;;;AACA;;;;;;AAEA,MAAMA,mBAAmB,CACxB,OADwB,EAExB,OAFwB,EAGxB,OAHwB,EAIxB,aAJwB,EAKxB,sBALwB,EAMxB,SANwB,EAOxB,WAPwB,EAQxB,eARwB,EASxB,iBATwB,EAUxB,wBAVwB,EAWxB,0BAXwB,EAYxB,eAZwB,EAaxB,QAbwB,EAcxB,SAdwB,CAAzB;;AAiBA,MAAMC,aAAa,CAClB,gDADkB,EAElB,sDAFkB,EAGlB,sGAHkB,CAAnB;;AAMA,MAAMC,2BAA2BF,iBAAiBG,MAAjB,CAAwB,CAACC,OAAD,EAAUC,OAAV,KAAsB;AAC9E,QAAO,CACN,GAAGD,OADG,EAEN,GAAGH,WAAWK,GAAX,CAAeC,aAAc,GAAEF,OAAQ,OAAME,SAAU,EAAvD,CAFG,CAAP;AAIA,CALgC,EAK9B,EAL8B,CAAjC;;AAOA,mBAAK,mDAAL,EAA0DC,KAAK;AAC9DA,GAAEC,KAAF,CAAQ,iBAAR;AACA,CAFD;;AAIA,mBAAK,mDAAL,EAA0DD,KAAK;AAC9DA,GAAEC,KAAF,CAAQ,gBAAU,EAAV,CAAR;AACA,CAFD;;AAIA,mBAAK,uC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MAAMH,aAAZ;AADe,EAAzB,CADD;AAKA,CAPD","file":"index.test.js","sourcesContent":["import test from 'ava';\nimport isIgnored from '.';\n\nconst VERSION_MESSAGES = [\n\t'0.0.1',\n\t'0.1.0',\n\t'1.0.0',\n\t'0.0.1-alpha',\n\t'0.0.1-some-crazy-tag',\n\t'0.0.1-0',\n\t'0.0.1-999',\n\t'0.0.1-alpha.0',\n\t'0.0.1-alpha.999',\n\t'0.0.1-some-crazy-tag.0',\n\t'0.0.1-some-crazy-tag.999',\n\t'0.0.1-1e69d54',\n\t'v0.0.1',\n\t' v3.0.0'\n];\n\nconst AMENDMENTS = [\n\t'Signed-off-by: Developer <example@example.com>',\n\t'Change-Id: I895114872a515a269487a683124b63303818e19c',\n\t'Signed-off-by: Developer <example@example.com>\\nChange-Id: I895114872a515a269487a683124b63303818e19c'\n];\n\nconst AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce((results, message) => {\n\treturn [\n\t\t...results,\n\t\t...AMENDMENTS.map(amendment => `${message}\\n\\n${amendment}`)\n\t];\n}, []);\n\ntest('should return false when called without arguments', t => {\n\tt.false(isIgnored());\n});\n\ntest('should return false when called with empty string', t => {\n\tt.false(isIgnored(''));\n});\n\ntest('should return false for normal commit', t => {\n\tt.false(isIgnored('initial commit'));\n});\n\ntest('should return true for branch merges', t => {\n\tt.true(isIgnored(\"Merge branch 'iss53'\"));\n});\n\ntest('should return true for branch merges with newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\"));\n});\n\ntest('should return true for branch merges with multiple newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\\n\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\\r\\n\\r\\n\"));\n});\n\ntest('should return true for merged PRs', t => {\n\tt.true(isIgnored('Merge pull request #369'));\n});\n\ntest('should return true for branch merges with newline characters and more characters after it', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n \"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n # some comment\"));\n});\n\ntest('should return true for revert commits', t => {\n\tt.true(\n\t\tisIgnored(\n\t\t\t`Revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n\tt.true(\n\t\tisIgnored(\n\t\t\t`revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n});\n\ntest('should ignore npm semver commits', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should ignore npm semver commits with chore', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(`chore: ${message}`)));\n\tVERSION_MESSAGES.forEach(message =>\n\t\tt.true(isIgnored(`chore(release): ${message}`))\n\t);\n});\n\ntest('should ignore npm semver commits with footers', t => {\n\tAMENDED_VERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should return true fixup commits', t => {\n\tt.true(isIgnored('fixup! initial commit'));\n});\n\ntest('should return true squash commits', t => {\n\tt.true(isIgnored('squash! initial commit'));\n});\n\ntest('should return true for bitbucket merge commits', t => {\n\tt.true(\n\t\tisIgnored('Merged in feature/facebook-friends-sync (pull request #8)')\n\t);\n\tt.true(isIgnored('Merged develop into feature/component-form-select-card'));\n\tt.true(isIgnored('Automatic merge'));\n});\n\ntest('should return true for automatic merge commits', t => {\n\tt.true(isIgnored('Auto-merged develop into master'));\n});\n\ntest('should return false for commits containing, but not starting, with merge branch', t => {\n\tt.false(isIgnored('foo bar Merge branch xxx'));\n});\n\ntest('should return false for ignored message if defaults is false', t => {\n\tt.false(\n\t\tisIgnored('Auto-merged develop into master', {\n\t\t\tdefaults: false\n\t\t})\n\t);\n});\n\ntest('should return false for ignored message if custom ignores and defaults is false', t => {\n\tt.false(\n\t\tisIgnored('Auto-merged develop into master', {\n\t\t\tdefaults: false\n\t\t})\n\t);\n});\n\ntest('should throw error if ignores is not an array', t => {\n\tconst ignoredString = 'this should be ignored';\n\tt.throws(() => {\n\t\tisIgnored(ignoredString, {\n\t\t\tignores: 'throws error'\n\t\t});\n\t});\n});\n\ntest('should return true for custom ignores as function', t => {\n\tconst ignoredString = 'this should be ignored';\n\tt.true(\n\t\tisIgnored(ignoredString, {\n\t\t\tignores: [c => c === ignoredString]\n\t\t})\n\t);\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commitlint/is-ignored",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "description": "Lint your commit messages",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -8,7 +8,6 @@
8
8
  ],
9
9
  "scripts": {
10
10
  "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
11
- "clean": "npx rimraf lib",
12
11
  "deps": "dep-check",
13
12
  "pkg": "pkg-check",
14
13
  "start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
@@ -57,19 +56,17 @@
57
56
  },
58
57
  "license": "MIT",
59
58
  "devDependencies": {
60
- "@commitlint/parse": "^7.5.0",
61
- "@commitlint/test": "^7.5.0",
62
- "@commitlint/utils": "^7.5.0",
59
+ "@commitlint/parse": "^7.6.0",
60
+ "@commitlint/test": "^7.6.0",
61
+ "@commitlint/utils": "^7.6.0",
63
62
  "ava": "0.22.0",
64
63
  "babel-cli": "6.26.0",
65
- "babel-preset-commitlint": "^7.5.0",
64
+ "babel-preset-commitlint": "^7.6.0",
66
65
  "babel-register": "6.26.0",
67
66
  "concurrently": "3.5.1",
68
- "cross-env": "5.1.1",
69
- "rimraf": "2.6.1"
67
+ "cross-env": "5.1.1"
70
68
  },
71
69
  "dependencies": {
72
- "semver": "5.6.0"
73
- },
74
- "gitHead": "b9d06522a2611c5a7405938a3b5216a1de963c7b"
70
+ "semver": "6.0.0"
71
+ }
75
72
  }