Skip to content

Commit 1292c92

Browse files
committed
Add contribution guidelines
1 parent 0ded4b5 commit 1292c92

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

.github/contributing.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributing guidelines
2+
3+
## I have an idea for a new rule
4+
5+
Open an issue with your proposal. Make sure you elaborate on what problem it solves and include fail/pass examples. [(Example)](https://github.com/sindresorhus/eslint-plugin-unicorn/issues/166)
6+
7+
## I have an idea for a new rule and I also want to implement it
8+
9+
First open an issue with your proposal. When the rule is accepted, see the [docs on creating and submitting a new rule](../docs/new-rule.md).
10+
11+
## I want to implement a rule from an open issue
12+
13+
See the [docs on creating and submitting a new rule](../docs/new-rule.md).

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
If you're adding a new rule, please follow [these steps](../docs/new-rule.md).

docs/new-rule.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Creating a new rule
2+
3+
## Prerequisite
4+
5+
- [Read the ESLint docs on creating a new rule.](https://eslint.org/docs/developer-guide/working-with-rules)
6+
- Look at the commit for how previous rules were added as inspiration. For example, the [`no-async-fn-without-await` rule](https://github.com/avajs/eslint-plugin-ava/commit/a443d7a9c94165f42749938e6b491a7c10749b6c).
7+
8+
9+
## Tip
10+
11+
Use the [`astexplorer` site](https://astexplorer.net) with the `espree` parser and `ESLint v4` transform to interactively create the initial rule implementation. It lets you inspect the full AST as you would get from ESLint and you can even see the result of your auto-fixer implementation.
12+
13+
14+
## Steps
15+
16+
- Go to the `test` directory and duplicate the `no-todo-test.js` file and rename it to the name of your rule. Then write some tests before starting to implement the rule.
17+
- Go to the `rules` directory and duplicate the `no-todo-test.js` file and rename it to the name of your rule. Then start implementing the new rule logic.
18+
- Add the correct [`meta.type`](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) to the rule.
19+
- Go to the `docs/rules` directory and duplicate the `no-todo-test.md` file and rename it to the name of your rule. Then write some documentation.
20+
- Add the rule in alphabetically sorted order to:
21+
- [The recommended config](https://github.com/avajs/eslint-plugin-ava/blob/0ded4b5c3cd09504e846309760566c9499a24196/index.js#L19)
22+
- [The recommended config in the readme](https://github.com/avajs/eslint-plugin-ava/blame/0ded4b5c3cd09504e846309760566c9499a24196/readme.md#L35)
23+
- [The rule listing in the readme](https://github.com/avajs/eslint-plugin-ava/blame/0ded4b5c3cd09504e846309760566c9499a24196/readme.md#L73)<br>
24+
*(The description should be the same as the heading of the documentation file).*
25+
- Run `$ npm test` to ensure the tests pass.
26+
- Run `$ npm run integration` to run the rules against real projects to ensure your rule does not fail on real-world code.
27+
- Open a pull request with a title in exactly the format `` Add `rule-name` rule ``, for example, `` Add `no-unused-properties` rule ``.
28+
- The pull request description should include the issue it fixes, for example, `Fixes #123`.

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/re
66

77
This plugin is bundled in [XO](https://github.com/xojs/xo). No need to do anything if you're using it.
88

9+
[**Propose or contribute a new rule ➡**](.github/contributing.md)
10+
911

1012
## Install
1113

0 commit comments

Comments
 (0)