1.0.5 • Published 5 years ago

commitlint-scope v1.0.5

Weekly downloads
-
License
GPL-3.0
Repository
gitlab
Last release
5 years ago

Commitlint - Scope Addon

This is not for beginners, please make sure you have experience with the required tools and devops management. Please make sure you have applicable experience with Commitlint as a base product.

Installation

npm i --saveDev commitlint-scope
yarn add --dev commitlint-scope

Recommendations

We recommend using node-husky, which integrates with Git Hooks in order to perform pre-commit and pre-push checks. Which is powerful for this case.

npm install --saveDev husky

In the end though, you must execute commitlint && commitlint-scope in order to verify commit integrity.

Setup and Configuration

commitlint.config.js

module.exports = {
  extends: [ '@commitlint/config-conventional' ],
  scopes: {
    // type(scope): subject <- we access the "scope", which only matching patterns or blobs may be commited
      // future plans to allow type as well as scope and proper commit amend proceedings
    'yarn': { files: [ 'package.json', 'yarn.lock', '.yarnclean' ] },
    'lint': { files: [ '.eslintrc', '.huskyrc.js', '.editorconfig', 'commitlint.config.js' ] },

    'core': { files: [ 'index.js', 'bin/*', 'bin/**' ] },
    'sources': { files: [ 'src/*', 'src/**' ] },

    'meta': { files: [ '**', '**/*' ] }
  }
}

.huskyrc.js

const tasks = arr => arr.join(' && ')
module.exports = {
  hooks: {
    'commit-msg': tasks([
      'commitlint -E HUSKY_GIT_PARAMS', // run commitlint first, to verify the message is valid
      'commitlint-scope' // run commitlint-scope, which hooks into commitlint-api to verify the blob integrity of the scope and types
    ])
  }
}

Built with Love for Commit Linting

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago