Skip to content

Commit f053442

Browse files
authored
fix: update pattern format (#190)
1 parent 3b6e304 commit f053442

23 files changed

+32
-48
lines changed

.grit/patterns/css/aspect_ratio.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Aspect ratio
33
---
44

5-
# {{ page.title }}
6-
75
```grit
86
language css
97

.grit/patterns/go/cloudflare_go_v2.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ Future migrations will be more seamless as we will be automatically generating t
1111
{% /note %}
1212

1313

14+
This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):
15+
16+
```
17+
grit apply cloudflare_go_v2
18+
```
19+
20+
1421
```grit
1522
language go
1623
@@ -651,12 +658,6 @@ file($body) where {
651658
}
652659
```
653660

654-
This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):
655-
656-
```
657-
grit apply cloudflare_go_v2
658-
```
659-
660661
## Client construction with API key and email
661662

662663
Old:

.grit/patterns/java/no_big_decimal_double.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
2-
title: "BigDecimal(double)" should not be used
2+
title: "`BigDecimal(double)` should not be used"
33
tags: [java]
44
---
55

6-
# "BigDecimal(double)" should not be used
7-
86
Because of floating point imprecision, the `BigDecimal(double)` constructor can be somewhat unpredictable. It is better to use `BigDecimal.valueOf(double)`.
97

108

.grit/patterns/js/intelligent_useEffect_to_useLayoutEffect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: [React2Hooks] Intelligent useEffect vs useLayoutEffect
2+
title: "[React2Hooks] Intelligent useEffect vs useLayoutEffect"
33
tags: [fix]
44
---
55

.grit/patterns/js/no_return_assign.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ title: Hoist assignment out of `return` statement
33
tags: [good, se]
44
---
55

6-
# {{ page.title }}
7-
8-
This rule hoists the assignments out of `return`. Does not apply when assignment is wrapped in parentheses.
6+
This rule hoists the assignments out of `return`. Because an assignment, `=` is easy to confuse with a comparison, `==`, The best practice is not to use any assignments in return statements.
97

8+
This does not apply when assignment is wrapped in parentheses.
109

1110
```grit
1211
engine marzano(0.1)
@@ -21,10 +20,6 @@ language js
2120
} => `$assignment;\n return $left;`
2221
```
2322

24-
```
25-
An assignment, `=`, is easy to confuse with a comparison, `==`. The best practice is not to use any assignments in return statements.
26-
```
27-
2823
## Hoist `=` from `return` statement
2924

3025
```javascript

.grit/patterns/js/no_unsafe_negation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Rewrite `!key in col` ⇒ `!(key in col)`
33
tags: [fix]
44
---
55

6-
# {{ page.title }}
7-
86
Negates `key` instead of the entire expression, which is likely a bug.
97

108
The intent is usually to negate the entire relation expression.

.grit/patterns/js/prefer_early_return.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: PreferEarlyReturn
33
tags: [lint, style]
44
---
55

6-
# {{ page.title }}
7-
86
Prefer to use early returns to keep functions flat.
97

108

.grit/patterns/python/_test_add_multiple_bare_imports.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ language python
2121

2222

2323
```python
24+
# This is an empty block
2425
```
2526

2627
```python
2728
import math
2829
import re
2930
import json
3031

31-
32+
# This is an empty block
3233
```
3334

3435
## Add missing imports

.grit/patterns/python/_test_add_one_bare_import.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ language python
1717

1818

1919
```python
20+
# Add one
2021
```
2122

2223
```python
2324
import math
2425

25-
26+
# Add one
2627
```
2728

2829
## Do not add duplicate bare import

.grit/patterns/python/_test_ensure_import_from.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ language python
1717

1818

1919
```python
20+
# Empty block
2021
```
2122

2223
```python
2324
from math import prod
2425

25-
26+
# Empty block
2627
```
2728

2829
## Add one more name to source

0 commit comments

Comments
 (0)