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: Make markdownlint ignore generated contributors table #194

Merged
merged 3 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 11 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,20 @@
"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"
"repoHost": "https://github.com",
"commitConvention": "none"
}
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