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

Commit

Permalink
Docs: Display emoji/notice for rules with suggestions (#860)
Browse files Browse the repository at this point in the history
* Docs: Display emoji/notice for rules with suggestions

* no-op

* Update rules/index.liquid

* add replace for hasSuggestions

* relative link

* fix label

* undo change to rules.yml
  • Loading branch information
bmish committed Jul 30, 2021
1 parent 09c63b6 commit d4fac44
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions _layouts/doc.liquid
Expand Up @@ -28,8 +28,10 @@
| replace: '<p>(recommended) ', '<p class="recommended icon">'
| replace: '<p>(removed) ', '<p class="removed icon">'
| replace: '<p>(fixable) ', '<p class="fixable icon">'
| replace: '<p>(hasSuggestions) ', '<p class="hasSuggestions icon">'
| 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>'
}}
</article>
</main>
Expand Down
1 change: 1 addition & 0 deletions _layouts/rule.liquid
Expand Up @@ -25,6 +25,7 @@
| replace: '<p>(removed) ', '<p class="removed icon">'
| replace: '<p>(recommended) ', '<p class="recommended icon">'
| replace: '<p>(fixable) ', '<p class="fixable icon">'
| replace: '<p>(hasSuggestions) ', '<p class="hasSuggestions icon">'
}}
</article>
</main>
Expand Down
1 change: 1 addition & 0 deletions _layouts/rules.liquid
Expand Up @@ -16,6 +16,7 @@
{{ content
| 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>'
}}
</article>
</main>
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/README.md
@@ -1,10 +1,10 @@
# Rules

Rules in ESLint are grouped by category to help you understand their purpose.
Rules in ESLint are grouped by category to help you understand their purpose. Each rule has emojis denoting:

No rules are enabled by default. The `"extends": "eslint:recommended"` property in a [configuration file](../user-guide/configuring#extending-configuration-files) enables rules that report common problems, which have a check mark (recommended) below.

The `--fix` option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems (currently mostly whitespace) reported by rules which have a wrench (fixable) below.
* (recommended) if the `"extends": "eslint:recommended"` property in a [configuration file](../user-guide/configuring#extending-configuration-files) enables the rule
* (fixable) if some problems reported by the rule are automatically fixable by the `--fix` [command line](../user-guide/command-line-interface#--fix) option
* (hasSuggestions) if some problems reported by the rule are manually fixable by editor [suggestions](../developer-guide/working-with-rules#providing-suggestions)

## Possible Errors

Expand Down
9 changes: 6 additions & 3 deletions docs/rules/index.liquid
Expand Up @@ -4,16 +4,18 @@ layout: doc
---

<h1>Rules</h1>
<p>Rules in ESLint are grouped by category to help you understand their purpose.</p>
<p>No rules are enabled by default. The <code>"extends": "eslint:recommended"</code> property in a <a href="../user-guide/configuring#extending-configuration-files">configuration file</a> enables rules that report common problems, which have a check mark (recommended) below.</p>
<p>The <code>--fix</code> option on the <a href="../user-guide/command-line-interface#--fix">command line</a> automatically fixes problems (currently mostly whitespace) reported by rules which have a wrench (fixable) below.</p>
<p>Rules in ESLint are grouped by category to help you understand their purpose. Each rule has emojis denoting:</p>
<p>(recommended) if the <code>"extends": "eslint:recommended"</code> property in a <a href="../user-guide/configuring#extending-configuration-files">configuration file</a> enables the rule</p>
<p>(fixable) if some problems reported by the rule are automatically fixable by the <code>--fix</code> <a href="../user-guide/command-line-interface#--fix">command line</a> option</p>
<p>(hasSuggestions) if some problems reported by the rule are manually fixable by editor <a href="../developer-guide/working-with-rules#providing-suggestions">suggestions</a></p>
{% for category in rules.categories %}
<h2>{{ category.name }}</h2>
{{ category.description }}
<table class="rule-list table table-striped">
<colgroup>
<col class="recommended" />
<col class="fixable" />
<col class="hasSuggestions" />
<col class="name" />
<col class="description" />
</colgroup>
Expand All @@ -22,6 +24,7 @@ layout: doc
<tr>
<td>{% if rule.recommended %}(recommended){% endif %}</td>
<td>{% if rule.fixable %}(fixable){% endif %}</td>
<td>{% if rule.hasSuggestions %}(hasSuggestions){% endif %}</td>
<td markdown="1"><a href="{{ rule.name }}">{{ rule.name }}</a> </td>
<td markdown="1">{{ rule.description }} </td>
</tr>
Expand Down
4 changes: 4 additions & 0 deletions src/styles/lib/overrides.less
Expand Up @@ -100,6 +100,10 @@ p {
content: "🔧"; /* wrench */
}

&.hasSuggestions:before {
content: "💡"; /* lightbulb */
}

&.incorrect:before {
content: "\e126"; /* thumbs-down */
}
Expand Down

0 comments on commit d4fac44

Please sign in to comment.