Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

chore: Update rule docs format #943

Merged
merged 1 commit into from May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 32 additions & 2 deletions _layouts/doc.liquid
Expand Up @@ -23,7 +23,7 @@
<h1>{{ title }}</h1>
{% endunless %}

{{ content
{% assign all_content = content
| replace: '<p>Examples of <strong>incorrect</strong> code', '<p class="incorrect icon">Examples of <strong>incorrect</strong> code'
| replace: '<p>Example of <strong>incorrect</strong> code', '<p class="incorrect icon">Example of <strong>incorrect</strong> code'
| replace: '<p>Examples of additional <strong>incorrect</strong> code', '<p class="incorrect icon">Examples of additional <strong>incorrect</strong> code'
Expand All @@ -39,7 +39,37 @@
| replace: '(recommended)', '<span title="recommended" aria-label="recommended">✓</span>'
| replace: '(fixable)', '<span title="fixable" aria-label="fixable">🔧</span>'
| replace: '(hasSuggestions)', '<span title="hasSuggestions" aria-label="hasSuggestions">💡</span>'
}}
%}

{% if related_rules %}
{% capture related_rules_content %}
<h2 id="related-rules">Related Rules</h2>
<ul>
{% for rule_id in related_rules %}
<li><a href="{{ rule_id }}">{{ rule_id }}</a></li>
{% endfor %}
</ul>
<h2 id="version">Version</h2>
{% endcapture %}
{% assign all_content = all_content | replace: '<h2 id="version">Version</h2>', related_rules_content %}
{% endif %}

{% if further_reading %}
{% capture further_reading_content %}
<h2 id="further-reading">Further Reading</h2>
<ul>
{% for url in further_reading %}
<li><a href="{{ url }}">{{ url }}</a></li>
{% endfor %}
</ul>
<h2 id="version">Version</h2>

{% endcapture %}
{% assign all_content = all_content | replace: '<h2 id="version">Version</h2>', further_reading_content %}
{% endif %}

{{ all_content }}

</article>
</main>
{% include footer %}
Expand Down
8 changes: 3 additions & 5 deletions docs/rules/block-scoped-var.md
Expand Up @@ -3,6 +3,9 @@ title: block-scoped-var
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/block-scoped-var.md
rule_type: suggestion
further_reading:
- https://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting
---

Enforces treating `var` as block scoped.
Expand Down Expand Up @@ -112,11 +115,6 @@ class C {
}
```

## Further Reading

* [JavaScript Scoping and Hoisting](http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html)
* [var Hoisting](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting)

## Version

This rule was introduced in ESLint 0.1.0.
Expand Down
8 changes: 3 additions & 5 deletions docs/rules/no-ternary.md
Expand Up @@ -3,6 +3,9 @@ title: no-ternary
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-ternary.md
rule_type: suggestion
related_rules:
- no-nested-ternary
- no-unneeded-ternary
---

Disallows ternary operators.
Expand Down Expand Up @@ -51,11 +54,6 @@ function quux() {
}
```

## Related Rules

* [no-nested-ternary](no-nested-ternary)
* [no-unneeded-ternary](no-unneeded-ternary)

## Version

This rule was introduced in ESLint 0.0.9.
Expand Down