Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mol commitlint config package #1

Merged
merged 3 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "mailonline",
"rules": {
"import/unambiguous": "off",
"import/no-commonjs": "off",
"sort-keys": "off"
}
}
72 changes: 13 additions & 59 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,15 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
*.swo
*.swp
.DS_Store
.idea/
.scripts/
.vagrant/
bin/
dist/
bower_components/
coverage/
dev/
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
config/databag.json
package-lock.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
script:
- yarn lint
deploy:
- provider: script
skip-cleanup: true
script:
- yarn semantic-release
on:
branch: master

91 changes: 90 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,91 @@
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

# mol-commitlint-config
commitlint configuration for mol-conventional-changelog
[commitlint](https://github.com/marionebl/commitlint) configuration for [mol-conventional-changelog](https://github.com/MailOnline/mol-conventional-changelog)

## Setup

``sh
# Install commitlint cli and mol commitlint config
npm install --save-dev mol-commitlint-config @commitlint/cli

# Configure commitlint to use mol commitlint config
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
``

To lint commits before they are created you can use the 'commitmsg' hook as described [here](https://github.com/typicode/husky/blob/master/HOOKS.md#hooks)

``json
{
"scripts": {
"commitmsg": "commitlint -E GIT_PARAMS"
}
}
```

**Detailed Setup instructions**

* [Local setup](http://marionebl.github.io/commitlint/#/guides-local-setup) - Lint messages on commit with husky
* [CI setup](http://marionebl.github.io/commitlint/#/guides-ci-setup) - Lint messages during CI builds


## Commit Message Format

* A commit message consists of a **header**, **body** and **footer**.
* The header has a **type** and a **subject**:

```
{{type}}: {{subject}}
<BLANK LINE>
{{body}}
<BLANK LINE>
{{breaking changes}}
<BLANK LINE>
{{footer}}
```

The **header** is the only mandatory part of the commit message.

The first line (type + subject) is limited to 50 characters **[enforced]**

Any other line should be limited to 72 character **[automatic wrapping]**

This allows the message to be easier to read on GitHub as well as in various git tools.

### Type

Must be one of the following:

* `feat`: A new feature.
* `fix`: A bug fix.
* `docs`: Documentation only changes.
* `style`: Markup-only changes (white-space, formatting, missing semi-colons, etc).
* `refactor`: A code change that neither fixes a bug or adds a feature.
* `perf`: A code change that improves performance.
* `test`: Adding or updating tests.
* `chore`: Build process or auxiliary tool changes.
* `ci`: CI related changes.

### Subject

The subject contains succinct description of the change:

* Use the imperative, present tense: "change" not "changed" nor "changes"
* No dot (.) at the end.

### Body

Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

#### Affects [only on [lerna](https://lernajs.io/) environments]

Select the packages the commit affected.

### Breaking Changes

**Breaking Changes** must start with the words `BREAKING CHANGE: `.

### Footer

The footer is the place to reference any tasks related to this commit.
32 changes: 32 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
rules: {
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 50],
'scope-empty': [2, 'always'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case']
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'style',
'refactor',
'perf',
'test',
'chore',
'ci'
]
]
}
};
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "mol-commitlint-config",
"version": "0.0.0-development",
"description": "Shareable commitlint config enforcing MOL conventional commits",
"files": [
"index.js"
],
"scripts": {
"test": "echo \"No test specified\" && exit 0",
"lint": "eslint ./",
"semantic-release": "semantic-release"
},
"repository": {
"type": "git",
"url": "git+https://github.com:MailOnline/mol-commitlint-config.git"
},
"keywords": [
"mol-conventional-changelog",
"commitlint",
"commitlint-config"
],
"author": "MailOnline <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/MailOnline/mol-commitlint-config/issues"
},
"homepage": "https://github.com/MailOnline/mol-commitlint-config#readme",
"devDependencies": {
"eslint": "^5.1.0",
"eslint-config-mailonline": "^9.0.0",
"husky": "^0.14.3",
"semantic-release": "^15.8.0"
}
}
Loading