Skip to content

Commit

Permalink
feat: add catalog rule template
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Jul 10, 2023
1 parent 9bf37cc commit da29111
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 42 deletions.
27 changes: 0 additions & 27 deletions website/catalog/Catalog.vue

This file was deleted.

9 changes: 0 additions & 9 deletions website/catalog/RuleItem.vue

This file was deleted.

7 changes: 1 addition & 6 deletions website/catalog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ Get confused what ast-grep is? This is a list of rewriting rule to inspire you!

Explore the power of ast-grep with these rewriting rules that can transform your code in seconds!

----
<script setup>
import Catalog from './Catalog.vue'
</script>

<Catalog/>
<!--@include: ./rule-template.md-->
50 changes: 50 additions & 0 deletions website/catalog/rule-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
language: JavaScript # please fully spell the language
playgroundLink: '[TODO]'
command: 'sg -p [TODO] -r [TODO]'
hasFix: true
ruleType: 'pattern' # 'pattern' or 'yaml'
---

## Your Rule Name

### Description

Some Description for your rule!


<!-- Use pattern in the example. Delete this section if use YAML. -->
### Pattern

```js
var i = 123
```

<!-- Optional Fix. Delete this section if no fix available -->
### Fix

```js
let i = 123
```


<!-- Use YAML in the example. Delete this section if use pattern. -->
### YAML
```yaml
```

### Example

```js
var a = 123
```

### Diff
<!-- use // [!code --] and // [!code ++] to annotate diff -->
```js
var a = 123 // [!code --]
let a = 123 // [!code ++]
```

### Contributed by
[Author Name](https://your-social.link)

0 comments on commit da29111

Please sign in to comment.