Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 4cecc46

Browse files
authored
docs: update contributing guide
1 parent d19a1e4 commit 4cecc46

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ PR titles should follow the format below:
1919
To create a new rule:
2020

2121
1. Choose a rule name according to our naming guide or take it from existing issue for the rule.
22-
2. Add an `.md` file with the rule documentation to `website/docs/rules`. If the rule supports configuration add ![Configurable](https://img.shields.io/badge/-configurable-informational) badge, if it has auto-fixes add ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) badge.
23-
3. Add rule entry into rule index file `website/docs/rules/index.mdx`.
24-
4. Create a rule `.dart` file under `lib/src/analyzers/lint_analyzer/rules/rules_list`.
25-
5. Create a class that extends an abstract rule class depending on your rule type. Available classes: `FlutterRule`, `CommonRule`, `IntlRule`, `AngularRule`. Add a public field with rule id, documentation url.
22+
2. Create a rule `.dart` file under `lib/src/analyzers/lint_analyzer/rules/rules_list`.
23+
3. Create a class that extends an abstract rule class depending on your rule type. Available classes: `FlutterRule`, `CommonRule`, `IntlRule`, `AngularRule`. Add a public field with rule id, documentation url.
2624

2725
The class constructor should take `Map<String, Object> config` parameter which represents config that is passed to the rule from the `analysis_options.yaml`. Example:
2826

@@ -36,10 +34,10 @@ To create a new rule:
3634
);
3735
```
3836
39-
6. Add a visitor class which extends any of the base visitors. Usually you will need `RecursiveAstVisitor`. All visitors are [listed there](https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/dart/ast/visitor.dart). Visitor should be added to a separate file and imported with `part` directive.
40-
7. Add methods overrides to the visitor class for nodes that you want to check (ex. `visitBinaryExpression`, `visitBlock`).
41-
8. Collect all data needed for the rule (we usually use a private field for data storage and public getter to access it from the `check` method).
42-
9. In the rule class add override to `check` method. Create a visitor instance and visit all compilation unit children with it.
37+
4. Add a visitor class which extends any of the base visitors. Usually you will need `RecursiveAstVisitor`. All visitors are [listed there](https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/dart/ast/visitor.dart). Visitor should be added to a separate file and imported with `part` directive.
38+
5. Add methods overrides to the visitor class for nodes that you want to check (ex. `visitBinaryExpression`, `visitBlock`).
39+
6. Collect all data needed for the rule (we usually use a private field for data storage and public getter to access it from the `check` method).
40+
7. In the rule class add override to `check` method. Create a visitor instance and visit all compilation unit children with it.
4341
4442
Convert data to `Issue`'s and return them from the method. Example:
4543
@@ -65,7 +63,7 @@ To create a new rule:
6563
```
6664
6765
> Override `toJson` method if the rule is configurable.
68-
10. Add the rule to the `lib/src/analyzers/lint_analyzer/rules/rules_factory.dart`. Example:
66+
8. Add the rule to the `lib/src/analyzers/lint_analyzer/rules/rules_factory.dart`. Example:
6967
7068
```dart
7169
final _implementedRules = <String, Rule Function(Map<String, Object>)>{
@@ -76,8 +74,9 @@ To create a new rule:
7674
}
7775
```
7876
79-
11. Add the rule tests under `test/analyzers/lint_analyzer/rules/rules_list/`. Prefer to split test examples to a correct/incorrect groups.
80-
12. Add rule into appropriate presets file: `lib/presets/dart_all.yaml` or `lib/presets/flutter_all.yaml`.
77+
9. Add the rule tests under `test/analyzers/lint_analyzer/rules/rules_list/`. Prefer to split test examples to a correct/incorrect groups.
78+
10. Add rule into appropriate presets file: `lib/presets/dart_all.yaml` or `lib/presets/flutter_all.yaml`.
79+
11. Before submitting the PR, add the rule documentation to the PR's description. Refer [to this rule](https://dcm.dev/docs/individuals/rules/common/prefer-trailing-comma/) as an example.
8180
8281
## Run the plugin in IDE
8382

0 commit comments

Comments
 (0)