@forsakringskassan/commitlint-config

2.0.1 • Public • Published

@forsakringskassan/commitlint-config

Based on Conventional Commits with additional checks for JIRA.

[optional scope]: ()

[optional body]

[optional footer(s)]

  1. fix: fixes a bug and results in a PATCH release.
  2. feat: introduces a new feature and results in a MINOR release.
  3. BREAKING CHANGE: in the footer followed by a description results in a MAJOR release. The description is added to the changelog.
  4. types other than fix and feat is allowed, see list at @commitlint/config-conventional
  5. (fixes XYZ-123) or (refs XYZ-123) JIRA reference must be included after subject.

Install

$ npm install --save-dev @forsakringskassan/commitlint-config

This package bundles @commitlint/cli so it does not have to be installed separately.

Configuration

This package provides two variants:

  • @forsakringskassan/commitlint-config/default
  • @forsakringskassan/commitlint-config/no-jira

The default configuration enforces a JIRA reference at the end of the header. The no-jira variant does not enforce it.

npm pkg set commitlint.extends=@forsakringskassan/commitlint-config/default

or manually edit package.json:

{
    "commitlint": {
        "extends": "@forsakringskassan/commitlint-config/default"
    }
}

Usage

As a husky hook:

echo 'npm exec commitlint -- --edit "$1"' > .husky/commit-msg

Lint staged

This package bundles lint-staged and can be used with a preconfigured setup. Assuming husky is used add .husky/pre-commit with:

configfile=$(node -p 'require.resolve("@forsakringskassan/commitlint-config/lint-staged")')
npm exec lint-staged -- --config "${configfile}" "$@"

If you already have lint-staged in your package.json you should remove it:

npm rm lint-staged

Readme

Keywords

Package Sidebar

Install

npm i @forsakringskassan/commitlint-config

Weekly Downloads

4,836

Version

2.0.1

License

MIT

Unpacked Size

13.5 MB

Total Files

19

Last publish

Collaborators

  • ext
  • fk-jonatan-haqgglund