diff --git a/.all-contributorsrc b/.all-contributorsrc index 26cfaf8..37600e6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -62,6 +62,15 @@ "code", "doc" ] + }, + { + "login": "jerodsanto", + "name": "Jerod Santo", + "avatar_url": "https://avatars3.githubusercontent.com/u/8212?v=3", + "profile": "https://jerodsanto.net", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index ffc025b..e698269 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # all-contributors-cli [![version](https://img.shields.io/npm/v/all-contributors-cli.svg)](http://npm.im/all-contributors-cli) -[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors) This is a tool to help automate adding contributor acknowledgements according to the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. @@ -93,8 +93,8 @@ These are the keys you can specify: Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): -| [
Jeroen Engels](https://github.com/jfmengels)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) | [
Kent C. Dodds](http://kentcdodds.com/)
[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) [πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) | [
JoΓ£o GuimarΓ£es](https://github.com/jccguimaraes)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jccguimaraes) | [
Ben Briggs](http://beneb.info)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=ben-eb) | [
Itai Steinherz](https://github.com/itaisteinherz)
[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) [πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) | [
Alex Jover](https://github.com/alexjoverm)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) [πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) | -| :---: | :---: | :---: | :---: | :---: | :---: | +| [
Jeroen Engels](https://github.com/jfmengels)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) | [
Kent C. Dodds](http://kentcdodds.com/)
[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) [πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) | [
JoΓ£o GuimarΓ£es](https://github.com/jccguimaraes)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jccguimaraes) | [
Ben Briggs](http://beneb.info)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=ben-eb) | [
Itai Steinherz](https://github.com/itaisteinherz)
[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) [πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) | [
Alex Jover](https://github.com/alexjoverm)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) [πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) | [
Jerod Santo](https://jerodsanto.net)
[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jerodsanto) | +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. diff --git a/lib/generate/format-contribution-type.js b/lib/generate/format-contribution-type.js index 26393a0..d4778eb 100644 --- a/lib/generate/format-contribution-type.js +++ b/lib/generate/format-contribution-type.js @@ -12,6 +12,11 @@ function getType(options, contribution) { module.exports = function formatContribution(options, contributor, contribution) { var type = getType(options, contribution); + + if (!type) { + throw new Error('Unknown contribution type ' + contribution + ' for contributor ' + contributor.login); + } + var templateData = { symbol: type.symbol, contributor: contributor, diff --git a/lib/generate/format-contribution-type.test.js b/lib/generate/format-contribution-type.test.js index a0ce89b..c3bdd04 100644 --- a/lib/generate/format-contribution-type.test.js +++ b/lib/generate/format-contribution-type.test.js @@ -116,3 +116,9 @@ test('should be able to override existing templates', t => { url: 'www.foo.bar' }), '[:web:](www.foo.bar)'); }); + +test('should throw a helpful error on unknown type', t => { + const contributor = contributors.kentcdodds; + const {options} = fixtures(); + t.throws(() => formatContributionType(options, contributor, 'docs'), 'Unknown contribution type docs for contributor kentcdodds'); +});