0.0.1-alpha.0 • Published 3 years ago

@guidecx/config-branchlint v0.0.1-alpha.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

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:

  1. at the root of the other project, install the package with npm install --save-dependency @guidecx/config-branchlint
  2. if you haven't installed husky and lint-staged, install them. according to the lint-staged docs, the easiest way to do this is by running npx mrm lint-staged.
  3. 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, add npm run branchlint into the bash file for pre-commit, and then create an npm script in your package.json like:
        "scripts": {
          "branchlint": "node ./node_modules/@guidecx/config-branchlint"
        }
  4. 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