Skip to content

Commit 42bc241

Browse files
Jeppe ReinholdBerkmann18
authored andcommitted
feat: Make markdownlint ignore generated contributors table (#194)
* add markdownlint-disable and scope prettier-ignore * re-generate contributors * set commitConvention to angular, sort .all-contributorsrc
1 parent 6932adb commit 42bc241

File tree

7 files changed

+122
-19
lines changed

7 files changed

+122
-19
lines changed

.all-contributorsrc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"repoType": "github",
66
"commit": false,
77
"contributorsPerLine": 6,
8+
"files": [
9+
"README.md"
10+
],
11+
"repoHost": "https://github.com",
12+
"commitConvention": "angular",
813
"contributors": [
914
{
1015
"login": "jfmengels",
@@ -311,10 +316,15 @@
311316
"contributions": [
312317
"doc"
313318
]
319+
},
320+
{
321+
"login": "JReinhold",
322+
"name": "Jeppe Reinhold",
323+
"avatar_url": "https://avatars1.githubusercontent.com/u/5678122?v=4",
324+
"profile": "https://reinhold.is",
325+
"contributions": [
326+
"code"
327+
]
314328
}
315-
],
316-
"files": [
317-
"README.md"
318-
],
319-
"repoHost": "https://github.com"
329+
]
320330
}

README.md

Lines changed: 67 additions & 3 deletions
Large diffs are not rendered by default.

src/generate/__tests__/__snapshots__/index.js.snap

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Description
88
## Contributors
99
These people contributed to the project:
1010
<!-- ALL-CONTRIBUTORS-LIST:START -->
11-
<!-- prettier-ignore -->
11+
<!-- prettier-ignore-start -->
12+
<!-- markdownlint-disable -->
1213
<table>
1314
<tr>
1415
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
@@ -17,6 +18,8 @@ These people contributed to the project:
1718
</tr>
1819
</table>
1920
21+
<!-- markdownlint-enable -->
22+
<!-- prettier-ignore-end -->
2023
<!-- ALL-CONTRIBUTORS-LIST:END -->
2124
2225
Thanks a lot everyone!"
@@ -30,7 +33,8 @@ Description
3033
## Contributors
3134
These people contributed to the project:
3235
<!-- ALL-CONTRIBUTORS-LIST:START -->
33-
<!-- prettier-ignore -->
36+
<!-- prettier-ignore-start -->
37+
<!-- markdownlint-disable -->
3438
<table>
3539
<tr>
3640
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
@@ -45,6 +49,8 @@ These people contributed to the project:
4549
</tr>
4650
</table>
4751
52+
<!-- markdownlint-enable -->
53+
<!-- prettier-ignore-end -->
4854
<!-- ALL-CONTRIBUTORS-LIST:END -->
4955
5056
Thanks a lot everyone!"

src/generate/__tests__/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ test('inject nothing if there are no contributors', () => {
119119
'## Contributors',
120120
'These people contributed to the project:',
121121
'<!-- ALL-CONTRIBUTORS-LIST:START -->',
122-
'<!-- prettier-ignore -->',
122+
'<!-- prettier-ignore-start -->',
123+
'<!-- markdownlint-disable -->',
124+
'<!-- markdownlint-enable -->',
125+
'<!-- prettier-ignore-end -->',
123126
'<!-- ALL-CONTRIBUTORS-LIST:END -->',
124127
'',
125128
'Thanks a lot everyone!',

src/generate/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ function injectListBetweenTags(newContent) {
2828
}
2929
return [
3030
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
31-
'\n<!-- prettier-ignore -->',
31+
'\n<!-- prettier-ignore-start -->',
32+
'\n<!-- markdownlint-disable -->',
3233
newContent,
34+
'<!-- markdownlint-enable -->',
35+
'\n<!-- prettier-ignore-end -->',
36+
'\n',
3337
previousContent.slice(startOfClosingTagIndex),
3438
].join('')
3539
}

src/init/__tests__/__snapshots__/add-contributors-list.js.snap

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ exports[`create contributors section if content is empty 1`] = `
77
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
88
99
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
10-
<!-- prettier-ignore -->
10+
<!-- prettier-ignore-start -->
11+
<!-- markdownlint-disable -->
12+
<!-- markdownlint-enable -->
13+
<!-- prettier-ignore-end -->
1114
<!-- ALL-CONTRIBUTORS-LIST:END -->
1215
1316
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!"
@@ -22,7 +25,10 @@ Description
2225
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
2326
2427
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
25-
<!-- prettier-ignore -->
28+
<!-- prettier-ignore-start -->
29+
<!-- markdownlint-disable -->
30+
<!-- markdownlint-enable -->
31+
<!-- prettier-ignore-end -->
2632
<!-- ALL-CONTRIBUTORS-LIST:END -->
2733
2834
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!"
@@ -36,6 +42,9 @@ Description
3642
## Contributors
3743
3844
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
39-
<!-- prettier-ignore -->
45+
<!-- prettier-ignore-start -->
46+
<!-- markdownlint-disable -->
47+
<!-- markdownlint-enable -->
48+
<!-- prettier-ignore-end -->
4049
<!-- ALL-CONTRIBUTORS-LIST:END -->"
4150
`;

src/init/init-content.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const headerContent =
77
'Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):'
88
const listContent = [
99
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->',
10-
'<!-- prettier-ignore -->',
10+
'<!-- prettier-ignore-start -->',
11+
'<!-- markdownlint-disable -->',
12+
'<!-- markdownlint-enable -->',
13+
'<!-- prettier-ignore-end -->',
1114
'<!-- ALL-CONTRIBUTORS-LIST:END -->',
1215
].join('\n')
1316
const footerContent =
@@ -18,7 +21,11 @@ function addBadge(lines) {
1821
}
1922

2023
function splitAndRejoin(fn) {
21-
return _.flow(_.split('\n'), fn, _.join('\n'))
24+
return _.flow(
25+
_.split('\n'),
26+
fn,
27+
_.join('\n'),
28+
)
2229
}
2330

2431
const findContributorsSection = _.findIndex(function isContributorsSection(
@@ -43,8 +50,8 @@ function addContributorsList(lines) {
4350
return injectContentBetween(
4451
lines,
4552
listContent,
46-
insertionLine + 2,
47-
insertionLine + 2,
53+
insertionLine + 3,
54+
insertionLine + 3,
4855
)
4956
}
5057

0 commit comments

Comments
 (0)