@crowdstrike/commitlint 8.0.3 → 8.1.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/bin/index.js CHANGED
@@ -15,10 +15,18 @@ const { argv } = require('yargs')
15
15
  default: defaultBranch,
16
16
  description: `Use a different branch point other than ${defaultBranch}`,
17
17
  },
18
+ 'lint-every-commit': {
19
+ type: 'boolean',
20
+ default: false,
21
+ description: 'lint every commit including normally ignored errors',
22
+ },
18
23
  });
19
24
 
20
25
  (async () => {
21
- let formatted = await commitlint(argv);
26
+ let formatted = await commitlint({
27
+ ...argv,
28
+ shouldLintEveryCommit: argv['lint-every-commit'],
29
+ });
22
30
 
23
31
  console.log(formatted);
24
32
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/commitlint",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
4
4
  "description": "commitlint settings for CrowdStrike",
5
5
  "bin": {
6
6
  "commitlint": "bin/index.js"
package/src/index.js CHANGED
@@ -18,7 +18,7 @@ function doesReportMatchErrorSchema(report, schema) {
18
18
  && report.errors.every(error => schema.includes(error.name));
19
19
  }
20
20
 
21
- async function runCommitLint(commit) {
21
+ async function runCommitLint(commit, { shouldLintEveryCommit }) {
22
22
  const { default: load } = await import('@commitlint/load');
23
23
  const { default: read } = await import('@commitlint/read');
24
24
  const { default: lint } = await import('@commitlint/lint');
@@ -46,7 +46,7 @@ async function runCommitLint(commit) {
46
46
  if (report.valid) {
47
47
  hasValidReports = true;
48
48
  orderedValidAndErrorReports.push(report);
49
- } else if (!doesReportMatchErrorSchema(report, IGNORED_ERROR_REPORT_SCHEMA)) {
49
+ } else if (shouldLintEveryCommit || !doesReportMatchErrorSchema(report, IGNORED_ERROR_REPORT_SCHEMA)) {
50
50
  hasErrorReports = true;
51
51
  orderedValidAndErrorReports.push(report);
52
52
  errorCount++;
@@ -102,9 +102,7 @@ async function succeedWithLatestCommit() {
102
102
  });
103
103
  }
104
104
 
105
- async function commitlint({
106
- defaultBranch,
107
- }) {
105
+ async function commitlint({ defaultBranch, shouldLintEveryCommit } = {}) {
108
106
  let currentBranch = await getCurrentBranch();
109
107
  if (currentBranch === defaultBranch) {
110
108
  return await succeedWithLatestCommit();
@@ -125,8 +123,7 @@ async function commitlint({
125
123
  return await succeedWithLatestCommit();
126
124
  }
127
125
 
128
- let formatted = await runCommitLint(commitSinceBranchPoint);
129
-
126
+ let formatted = await runCommitLint(commitSinceBranchPoint, { shouldLintEveryCommit });
130
127
  return formatted;
131
128
  }
132
129