Skip to content

Commit 6e29c11

Browse files
Refactor list of custom lints (#509)
1 parent e749b3b commit 6e29c11

1 file changed

Lines changed: 76 additions & 9 deletions

File tree

packages/leancode_lint/README.md

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,8 @@ include: package:leancode_lint/analysis_options_package.yaml
115115

116116
## Custom lint rules
117117

118-
To disable a particular custom lint rule, set the rule to false in `analysis_options.yaml`. For example, to disable `prefix_widgets_returning_slivers`:
119-
120-
```yaml
121-
plugins:
122-
leancode_lint:
123-
version: ^20.0.0
124-
diagnostics:
125-
prefix_widgets_returning_slivers: false
126-
```
118+
<details>
119+
<summary><code>add_cubit_suffix_for_your_cubits</code></summary>
127120

128121
### `add_cubit_suffix_for_your_cubits`
129122

@@ -145,6 +138,11 @@ class MyClassCubit extends Cubit<int> {}
145138

146139
None.
147140

141+
</details>
142+
143+
<details>
144+
<summary><code>avoid_conditional_hooks</code></summary>
145+
148146
### `avoid_conditional_hooks`
149147

150148
**AVOID** using hooks conditionally
@@ -218,6 +216,11 @@ Widget build(BuildContext context) {
218216

219217
None.
220218

219+
</details>
220+
221+
<details>
222+
<summary><code>catch_parameter_names</code></summary>
223+
221224
### `catch_parameter_names`
222225

223226
**DO** name catch clause parameters consistently
@@ -272,6 +275,11 @@ final plugin = LeanCodeLintPlugin(
272275
);
273276
```
274277

278+
</details>
279+
280+
<details>
281+
<summary><code>hook_widget_does_not_use_hooks</code></summary>
282+
275283
### `hook_widget_does_not_use_hooks`
276284

277285
**AVOID** extending `HookWidget` if no hooks are used.
@@ -329,6 +337,11 @@ Widget build(BuildContext context) {
329337

330338
None.
331339

340+
</details>
341+
342+
<details>
343+
<summary><code>prefix_widgets_returning_slivers</code></summary>
344+
332345
### `prefix_widgets_returning_slivers`
333346

334347
**DO** prefix widget names with 'Sliver' if the widget returns slivers.
@@ -371,6 +384,11 @@ final plugin = LeanCodeLintPlugin(
371384
);
372385
```
373386

387+
</details>
388+
389+
<details>
390+
<summary><code>start_comments_with_space</code></summary>
391+
374392
### `start_comments_with_space`
375393

376394
**DO** start comments/docs with an empty space.
@@ -393,6 +411,11 @@ final plugin = LeanCodeLintPlugin(
393411

394412
None.
395413

414+
</details>
415+
416+
<details>
417+
<summary><code>use_design_system_item</code></summary>
418+
396419
### `use_design_system_item`
397420

398421
**AVOID** using items disallowed by the design system.
@@ -423,6 +446,11 @@ final plugin = LeanCodeLintPlugin(
423446
424447
```
425448

449+
</details>
450+
451+
<details>
452+
<summary><code>avoid_single_child_in_multi_child_widgets</code></summary>
453+
426454
### `avoid_single_child_in_multi_child_widgets`
427455

428456
**AVOID** using `Column`, `Row`, `Flex`, `Wrap`, `SliverList`, `MultiSliver`, `SliverChildListDelegate`, `SliverMainAxisGroup`, and `SliverCrossAxisGroup` with a single child.
@@ -451,6 +479,11 @@ Widget build(BuildContext context) {
451479

452480
None.
453481

482+
</details>
483+
484+
<details>
485+
<summary><code>use_dedicated_media_query_methods</code></summary>
486+
454487
### `use_dedicated_media_query_methods`
455488

456489
**AVOID** using `MediaQuery.of` or `MediaQuery.maybeOf` to access only one property. Instead, prefer dedicated methods, for example `MediaQuery.paddingOf(context)`.
@@ -479,6 +512,11 @@ Widget build(BuildContext context) {
479512

480513
None.
481514

515+
</details>
516+
517+
<details>
518+
<summary><code>use_align</code></summary>
519+
482520
### `use_align`
483521

484522
**DO** Use the Align widget instead of the Container widget with only the alignment parameter.
@@ -515,6 +553,11 @@ class MyWidget extends StatelessWidget {
515553

516554
None
517555

556+
</details>
557+
558+
<details>
559+
<summary><code>use_padding</code></summary>
560+
518561
### `use_padding`
519562

520563
**DO** Use Padding widget instead of the Container widget with only the margin parameter
@@ -551,6 +594,11 @@ class MyWidget extends StatelessWidget {
551594

552595
None
553596

597+
</details>
598+
599+
<details>
600+
<summary><code>prefer_center_over_align</code></summary>
601+
554602
### `prefer_center_over_align`
555603

556604
**DO** Use the Center widget instead of the Align widget with the alignment parameter set to Alignment.center
@@ -585,6 +633,11 @@ class MyWidget extends StatelessWidget {
585633

586634
None
587635

636+
</details>
637+
638+
<details>
639+
<summary><code>prefer_equatable_mixin</code></summary>
640+
588641
### `prefer_equatable_mixin`
589642

590643
**DO** mix in `EquatableMixin` instead of extending `Equatable`.
@@ -623,6 +676,20 @@ class Foobar with EquatableMixin {
623676

624677
None.
625678

679+
</details>
680+
681+
## Disabling custom lint rules
682+
683+
To disable a particular custom lint rule, set the rule to false in `analysis_options.yaml`. For example, to disable `prefix_widgets_returning_slivers`:
684+
685+
```yaml
686+
plugins:
687+
leancode_lint:
688+
version: ^20.0.0
689+
diagnostics:
690+
prefix_widgets_returning_slivers: false
691+
```
692+
626693
## Assists
627694

628695
Assists are IDE refactorings not related to a particular issue. They can be triggered by placing your cursor over a relevant piece of code and opening the code actions dialog. For instance, in VSCode this is done with <kbd>ctrl</kbd>+<kbd>.</kbd> or <kbd>⌘</kbd>+<kbd>.</kbd>.

0 commit comments

Comments
 (0)