Skip to content

Commit 3f275e3

Browse files
authored
docs: improve default exclusions render (#5661)
1 parent a395a3e commit 3f275e3

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

docs/src/@rocketseat/gatsby-theme-docs/src/styles/global.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default function GlobalStyle() {
6666
font-weight: 400;
6767
}
6868
69+
span.inline-code,
6970
code.inline-code {
7071
display: inline-block;
7172
vertical-align: middle;

scripts/website/expand_templates/exclusions.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@ import (
1010

1111
const exclusionTmpl = `{{- $tick := "` + "`" + `" -}}
1212
{{- range $name, $rules := . }}
13-
### {{ $tick }}{{ $name }}{{ $tick }}
14-
{{ range $rule := $rules }}
15-
{{ $tick }}{{ range $linter := $rule.Linters }}{{ $linter }}{{ end }}{{ $tick }}:
16-
{{ if $rule.Path -}}
17-
- Path: {{ $tick }}{{ $rule.Path }}{{ $tick }}
18-
{{ end -}}
19-
{{ if $rule.PathExcept -}}
20-
- Path Except: {{ $tick }}{{ $rule.PathExcept }}{{ $tick }}
21-
{{ end -}}
22-
{{ if $rule.Text -}}
23-
- Text: {{ $tick }}{{ $rule.Text }}{{ $tick }}
24-
{{ end -}}
25-
{{ if $rule.Source -}}
26-
- Source: {{ $tick }}{{ $rule.Source }}{{ $tick }}
27-
{{ end -}}
28-
{{ end }}{{ end }}`
13+
### Preset {{ $tick }}{{ $name }}{{ $tick }}
14+
15+
<table>
16+
<thead>
17+
<tr>
18+
<th>Linter</th>
19+
<th>Issue Text</th>
20+
</tr>
21+
</thead>
22+
<tbody>
23+
{{- range $rule := $rules }}
24+
<tr>
25+
<td>{{ range $linter := $rule.Linters }}{{ $linter }}{{ end }}</td>
26+
<td><span class="inline-code">{{ if $rule.Text }}{{ $rule.Text }}{{ end }}</span></td>
27+
</tr>
28+
{{- end }}
29+
</tbody>
30+
</table>
31+
32+
{{ end }}`
2933

3034
func getExclusionPresets() (string, error) {
3135
linterExclusionPresets, err := readJSONFile[map[string][]types.ExcludeRule](filepath.Join("assets", "exclusion-presets.json"))

0 commit comments

Comments
 (0)