@guidecx/config-branchlint
v0.0.1-alpha.0
Published
Branch linting script for use in GCX applications
Downloads
1
Readme
GCX Branchlint Script
Installing script into another project
The index.js
file exports the branchlint node script. In another project, you can do the following to include these linting rules:
- at the root of the other project, install the package with
npm install --save-dependency @guidecx/config-branchlint
- if you haven't installed
husky
andlint-staged
, install them. according to the lint-staged docs, the easiest way to do this is by runningnpx mrm lint-staged
. - in your
package.json
file, include the following to your husky commands:"husky": { "hooks": { "pre-commit": "node ./node_modules/@guidecx/config-branchlint" } }
- Alternatively, if the current app has a
.husky/
folder that manages your scripts, addnpm run branchlint
into the bash file forpre-commit
, and then create an npm script in yourpackage.json
like:"scripts": { "branchlint": "node ./node_modules/@guidecx/config-branchlint" }
- Alternatively, if the current app has a
- if everything was done correctly, making a
git commit
will now enforce our branch linting rules
Example branchlint patterns
When using this package, all branch names must match the following pattern:
currentUser/type/chStory/simple-description
where 'type' is an enum [chore, feat, fix, revert], chStory is a positive integer that matches a clubhouse story number prefaced with ch
, and simple-description is a brief description of the changes made.
Based on the rules file, these are some of the patterns that are considered valid:
agarvin/feat/ch1823/add-unit-tests-to-view
iclaw/chore/ch891/disable-time-entry-page
jgomez/revert/ch2761/revert-disable-time-entry-page