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

Add a configuration for linting commit messages #44

Merged
merged 4 commits into from
Feb 28, 2019
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ before_install: if [[ `npm -v` != 6* ]]; then npm i -g [email protected]; fi

script:
- grunt standards
- commitlint-travis
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ Shareable [ESLint](http://eslint.org/) configuration for all Silvermine projects
Because we need it. Whitespace errors are evil. As are the other hundreds of
types of errors this protects us from.

## Other Configuration Files Available

In addition to the ESLint rules, this package provides configuration for the following:

* [EditorConfig](https://editorconfig.org/)
* Provides a default set of editor configuration values to use in Silvermine projects
* Usage: Symlink the .editorconfig file to the root of your project and use the
appropriate extension for your editor.
* `ln -s ./node_modules/@silvermine/eslint-config/.editorconfig`
* [commitlint](https://conventional-changelog.github.io/commitlint/)
* Provides linting for commit messages of Silvermine projects
* Usage: Add a `commitlint.config.js` file to the root of the project with the
following and then set up commitlint in the project:
```javascript
'use strict';

module.exports = {
extends: [ '@silvermine/eslint-config/commitlint' ],
};
```



## Notes on Semantic Versioning

Expand Down
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a weird comment here:

image

GitHub won't let me comment on that file because there's no lines in it ... and it doesn't really indicate what it is. Is it a symlink to allow for referencing @silvermine/eslint-config/commitlint without needing to reference the *.config.js file specifically?

Copy link
Contributor Author

@jimjenkins5 jimjenkins5 Feb 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That shouldn't be there. I must have created it by accident somehow. I removed it.


module.exports = {
extends: [ './commitlint.js' ],
};
39 changes: 39 additions & 0 deletions commitlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

module.exports = {
rules: {
'body-leading-blank': [ 2, 'always' ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As team decided on Slack: add body-max-line-length of 90

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity: this matches our comments max line length

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And thus, let's also add footer-max-line-length of 90

'body-max-line-length': [ 2, 'always', 90 ],
'footer-leading-blank': [ 2, 'always' ],
'footer-max-line-length': [ 2, 'always', 90 ],
'header-max-length': [ 2, 'always', 72 ],
'scope-case': [ 2, 'always', [ 'lower-case', 'kebab-case' ] ],
'scope-empty': [ 2, 'always' ],
'subject-case': [
2,
'never',
[ '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',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
],
],
},
};
Loading