Skip to content

Commit 4e0aead

Browse files
authored
Fix location matching of contributing.md and code-of-conduct.md files (sindresorhus#111)
1 parent a0d9240 commit 4e0aead

File tree

7 files changed

+72
-2
lines changed

7 files changed

+72
-2
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const lint = options => {
3535
plugins: options.config
3636
}];
3737

38-
const codeOfConductFile = globby.sync(['{.github/,}{code-of-conduct,code_of_conduct}.md'], {nocase: true, cwd: dirname})[0];
38+
const codeOfConductFile = globby.sync(['{code-of-conduct,code_of_conduct}.md', '.github/{code-of-conduct,code_of_conduct}.md'], {nocase: true, cwd: dirname})[0];
3939
if (codeOfConductFile) {
4040
const codeOfConductVFile = toVfile.readSync(path.resolve(dirname, codeOfConductFile));
4141
codeOfConductVFile.repoURL = options.repoURL;

rules/contributing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const rule = require('unified-lint-rule');
77
module.exports = rule('remark-lint:awesome-contributing', (ast, file) => {
88
const {dirname} = file;
99

10-
const contributingFile = globby.sync(['{.github/,}contributing.md'], {nocase: true, cwd: dirname})[0];
10+
const contributingFile = globby.sync(['contributing.md', '.github/contributing.md'], {nocase: true, cwd: dirname})[0];
1111
// TODO: This doesn't work on Linux for some reason. Investigate and then open an issue on `fast-glob`.
1212
// const contributingFile = globby.sync('contributing.md', {case: false, cwd: dirname})[0];
1313

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contribution Guidelines
2+
3+
Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms.
4+
5+
---
6+
7+
Ensure your pull request adheres to the following guidelines:
8+
9+
- **If you just created something, wait at least 7 days before submitting.** This is to give it some time to mature and ensure it's not just a publish-and-forget type of project.
10+
- If you submit a project that is similar to an existing project in the list, argue how it's better.
11+
- Search previous suggestions before making a new one, as yours may be a duplicate.
12+
- Suggested packages should be tested and documented.
13+
- Make an individual pull request for each suggestion.
14+
- Use the following format: `[package](link) - Description.`
15+
- Additions should be added to the bottom of the relevant category.
16+
- Link to the GitHub repo, not npmjs.com.
17+
- Keep descriptions short and simple, but descriptive.
18+
- Don't mention `Node.js` in the description as it's implied.
19+
- Start the description with a capital and end with a full stop/period.
20+
- Don't start the description with `A` or `An`.
21+
- Check your spelling and grammar.
22+
- Make sure your text editor is set to remove trailing whitespace.
23+
- The pull request should have a useful title and include a link to the package and why it should be included.
24+
- New categories or improvements to the existing categorization are welcome, but should be done in a separate pull request.
25+
26+
Thank you for your suggestions!
27+
28+
### Updating your PR
29+
30+
A lot of times, making a PR adhere to the standards above can be difficult. If the maintainers notice anything that we'd like changed, we'll ask you to edit your PR before we merge it. If you're not sure how to do that, [here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md) on the different ways you can update your PR so that we can merge it.

test/fixtures/contributing/valid2/readme.md

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contribution Guidelines
2+
3+
Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms.
4+
5+
---
6+
7+
Ensure your pull request adheres to the following guidelines:
8+
9+
- **If you just created something, wait at least 7 days before submitting.** This is to give it some time to mature and ensure it's not just a publish-and-forget type of project.
10+
- If you submit a project that is similar to an existing project in the list, argue how it's better.
11+
- Search previous suggestions before making a new one, as yours may be a duplicate.
12+
- Suggested packages should be tested and documented.
13+
- Make an individual pull request for each suggestion.
14+
- Use the following format: `[package](link) - Description.`
15+
- Additions should be added to the bottom of the relevant category.
16+
- Link to the GitHub repo, not npmjs.com.
17+
- Keep descriptions short and simple, but descriptive.
18+
- Don't mention `Node.js` in the description as it's implied.
19+
- Start the description with a capital and end with a full stop/period.
20+
- Don't start the description with `A` or `An`.
21+
- Check your spelling and grammar.
22+
- Make sure your text editor is set to remove trailing whitespace.
23+
- The pull request should have a useful title and include a link to the package and why it should be included.
24+
- New categories or improvements to the existing categorization are welcome, but should be done in a separate pull request.
25+
26+
Thank you for your suggestions!
27+
28+
### Updating your PR
29+
30+
A lot of times, making a PR adhere to the standards above can be difficult. If the maintainers notice anything that we'd like changed, we'll ask you to edit your PR before we merge it. If you're not sure how to do that, [here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md) on the different ways you can update your PR so that we can merge it.

test/fixtures/contributing/valid3/readme.md

Whitespace-only changes.

test/rules/contributing.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ test('contributing - valid contributing.md', async t => {
3838
const messages = await lint({config, filename: 'test/fixtures/contributing/valid1/readme.md'});
3939
t.deepEqual(messages, []);
4040
});
41+
42+
test('contributing - valid .github/CONTRIBUTING.md', async t => {
43+
const messages = await lint({config, filename: 'test/fixtures/contributing/valid2/readme.md'});
44+
t.deepEqual(messages, []);
45+
});
46+
47+
test('contributing - valid .github/contributing.md', async t => {
48+
const messages = await lint({config, filename: 'test/fixtures/contributing/valid3/readme.md'});
49+
t.deepEqual(messages, []);
50+
});

0 commit comments

Comments
 (0)