Skip to content

Commit

Permalink
Revert "chore: Refactor rule docs format (eslint#15869)"
Browse files Browse the repository at this point in the history
This reverts commit f8cb53c.
  • Loading branch information
srijan-deepsource committed May 30, 2022
1 parent c867110 commit c6cbf8a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 36 deletions.
2 changes: 2 additions & 0 deletions docs/.eleventy.js
Expand Up @@ -126,6 +126,8 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addNunjucksAsyncShortcode("link", async function(link) {
const { body: html, url } = await got(link);
const metadata = await metascraper({ html, url });

const encodedURL = encodeURIComponent(link);
const the_url = (new URL(link)); // same as url
const domain = the_url.hostname;

Expand Down
4 changes: 2 additions & 2 deletions docs/src/_includes/components/docs-toc.html
@@ -1,8 +1,8 @@
<nav class="docs-toc c-toc" aria-labelledby="js-toc-label">
{%- if all_content | toc | safe -%}
{%- if content | toc | safe -%}
<h2 class="c-toc__label" id="js-toc-label">Table of Contents</h2>
<div class="c-toc__panel" id="js-toc-panel">
{{ all_content | toc | safe }}
{{ content | toc | safe }}
</div>
{%- endif -%}
</nav>
29 changes: 1 addition & 28 deletions docs/src/_includes/layouts/doc.html
Expand Up @@ -13,39 +13,12 @@
{% include 'components/docs-index.html' %}
</div>

{# Add in related rules and further reading sections to content so TOC is accurate #}
{% set all_content = content %}
{% if related_rules %}
{% set related_rules_content %}
<h2 id="related-rules">Related Rules</h2>
{% related_rules related_rules %}
{% endset %}

{% set all_content = [all_content, related_rules_content] | join %}
{% endif %}

{% if further_reading %}
{% set further_reading_content %}
<h2 id="further-reading">Further Reading</h2>
{# async shortcodes don't work here so need to manually insert later #}
{% endset %}

{% set all_content = [all_content, further_reading_content] | join %}
{% endif %}

<div class="docs-content">
<main id="main" tabindex="-1" class="docs-main">
<h1>{{ title }}</h1>
{% include 'components/docs-toc.html' %}

{{ all_content | safe }}

{# now insert the async-fetched link data if necessary #}
{% if further_reading %}
{% for url in further_reading %}
{% link url %}
{% endfor %}
{% endif %}
{{ content | safe }}

<div class="docs-edit-link">
<a href="{{ edit_link }}" class="c-btn c-btn--secondary">Edit this page</a>
Expand Down
8 changes: 5 additions & 3 deletions docs/src/rules/block-scoped-var.md
Expand Up @@ -3,9 +3,6 @@ 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 @@ -114,3 +111,8 @@ 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)
8 changes: 5 additions & 3 deletions docs/src/rules/no-ternary.md
Expand Up @@ -3,9 +3,6 @@ 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 @@ -53,3 +50,8 @@ function quux() {
}
}
```

## Related Rules

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

0 comments on commit c6cbf8a

Please sign in to comment.