Skip to content

Commit

Permalink
maint/dev ~ (CommitLint) update config; add relaxed linting for devel…
Browse files Browse the repository at this point in the history
…opment
  • Loading branch information
rivy committed Nov 5, 2022
1 parent e95838d commit 7ce9767
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// CommitLint configuration
// ref: <https://commitlint.js.org/#/reference-configuration>
// v2022-08-09 [rivy]
// v2022-08-20 [rivy]

// spell-checker:ignore (names) commitLint (people) Roy Ivy III * rivy (words) maint

/* @prettier */ // note: (dprint) {.dprint.json}.prettier.associations should contain the name of this file

const isNPMTestDist = !!process.env['npm_config_test_dist'];
const relaxedReview = !isNPMTestDist;
const isTestDist = !!process.env['test_dist'];
const isTestRelease = !!process.env['test_release'];

/** Relax linting rules/strictures (for development; *not* when submitting for distribution/release). */
const relaxedReview = !(isNPMTestDist || isTestDist || isTestRelease);

const commitTags = [
'Add',
Expand All @@ -15,6 +21,7 @@ const commitTags = [
'Change',
'Changed',
'Chore',
'Deps',
'Docs',
'Feat',
'Fix',
Expand All @@ -30,14 +37,14 @@ const commitTags = [
'Update',
'Updated',
'Upkeep',
'VERSION',
'WIP',
// * git automated messages
'Automatic',
'Auto-merged',
'Merge',
'Merged',
'Revert',
// * ok for relaxed review (ie, development), otherwise *not ok*
...(relaxedReview ? ['VERSION', 'WIP', 'X'] : []),
];

module.exports = {
Expand Down Expand Up @@ -73,8 +80,10 @@ module.exports = {
// ## maint [2020-01-07; rivy] ~ 'footer-leading-blank' disabled until <https://github.com/conventional-changelog/commitlint/issues/896> is fixed
// ## ... refs: <https://github.com/conventional-changelog/commitlint/issues/896#issuecomment-671865868> , <https://github.com/rook/rook/pull/6499#issuecomment-717267089>
'footer-leading-blank': [0],
'scope-case': [2, 'always', ['lower-case', 'upper-case']],
'header-max-length': [1, 'always', 90],
'scope-case': [2, 'always', ['camel-case', 'lower-case', 'pascal-case', 'upper-case']],
'subject-case': [0],
'subject-empty': [relaxedReview ? 1 : 2, 'never'],
'type-case': [2, 'always', ['lower-case', 'sentence-case']],
'type-enum': [2, 'always', [...commitTags.map((v) => v.toLowerCase()), ...commitTags]],
},
Expand Down

0 comments on commit 7ce9767

Please sign in to comment.