Skip to content

Commit

Permalink
feat: Make markdownlint ignore generated contributors table (#194)
Browse files Browse the repository at this point in the history
* add markdownlint-disable and scope prettier-ignore

* re-generate contributors

* set commitConvention to angular, sort .all-contributorsrc
  • Loading branch information
Jeppe Reinhold authored and Berkmann18 committed Jul 16, 2019
1 parent 6932adb commit 42bc241
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 19 deletions.
20 changes: 15 additions & 5 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"repoType": "github",
"commit": false,
"contributorsPerLine": 6,
"files": [
"README.md"
],
"repoHost": "https://github.com",
"commitConvention": "angular",
"contributors": [
{
"login": "jfmengels",
Expand Down Expand Up @@ -311,10 +316,15 @@
"contributions": [
"doc"
]
},
{
"login": "JReinhold",
"name": "Jeppe Reinhold",
"avatar_url": "https://avatars1.githubusercontent.com/u/5678122?v=4",
"profile": "https://reinhold.is",
"contributions": [
"code"
]
}
],
"files": [
"README.md"
],
"repoHost": "https://github.com"
]
}
70 changes: 67 additions & 3 deletions README.md

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/generate/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Description
## Contributors
These people contributed to the project:
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
Expand All @@ -17,6 +18,8 @@ These people contributed to the project:
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
Thanks a lot everyone!"
Expand All @@ -30,7 +33,8 @@ Description
## Contributors
These people contributed to the project:
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
Expand All @@ -45,6 +49,8 @@ These people contributed to the project:
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
Thanks a lot everyone!"
Expand Down
5 changes: 4 additions & 1 deletion src/generate/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ test('inject nothing if there are no contributors', () => {
'## Contributors',
'These people contributed to the project:',
'<!-- ALL-CONTRIBUTORS-LIST:START -->',
'<!-- prettier-ignore -->',
'<!-- prettier-ignore-start -->',
'<!-- markdownlint-disable -->',
'<!-- markdownlint-enable -->',
'<!-- prettier-ignore-end -->',
'<!-- ALL-CONTRIBUTORS-LIST:END -->',
'',
'Thanks a lot everyone!',
Expand Down
6 changes: 5 additions & 1 deletion src/generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function injectListBetweenTags(newContent) {
}
return [
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
'\n<!-- prettier-ignore -->',
'\n<!-- prettier-ignore-start -->',
'\n<!-- markdownlint-disable -->',
newContent,
'<!-- markdownlint-enable -->',
'\n<!-- prettier-ignore-end -->',
'\n',
previousContent.slice(startOfClosingTagIndex),
].join('')
}
Expand Down
15 changes: 12 additions & 3 deletions src/init/__tests__/__snapshots__/add-contributors-list.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ exports[`create contributors section if content is empty 1`] = `
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!"
Expand All @@ -22,7 +25,10 @@ Description
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!"
Expand All @@ -36,6 +42,9 @@ Description
## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->"
`;
15 changes: 11 additions & 4 deletions src/init/init-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const headerContent =
'Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):'
const listContent = [
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->',
'<!-- prettier-ignore -->',
'<!-- prettier-ignore-start -->',
'<!-- markdownlint-disable -->',
'<!-- markdownlint-enable -->',
'<!-- prettier-ignore-end -->',
'<!-- ALL-CONTRIBUTORS-LIST:END -->',
].join('\n')
const footerContent =
Expand All @@ -18,7 +21,11 @@ function addBadge(lines) {
}

function splitAndRejoin(fn) {
return _.flow(_.split('\n'), fn, _.join('\n'))
return _.flow(
_.split('\n'),
fn,
_.join('\n'),
)
}

const findContributorsSection = _.findIndex(function isContributorsSection(
Expand All @@ -43,8 +50,8 @@ function addContributorsList(lines) {
return injectContentBetween(
lines,
listContent,
insertionLine + 2,
insertionLine + 2,
insertionLine + 3,
insertionLine + 3,
)
}

Expand Down

0 comments on commit 42bc241

Please sign in to comment.