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
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Jul 23, 2021
1 parent 4dd81b3 commit afe7bf3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions _data/rules.yml
Expand Up @@ -164,6 +164,7 @@ categories:
fixable: false
name: no-unsafe-negation
recommended: true
hasSuggestions: true
- description: >-
disallow use of optional chaining in contexts where the `undefined`
value is not allowed
Expand Down Expand Up @@ -387,6 +388,7 @@ categories:
fixable: false
name: no-nonoctal-decimal-escape
recommended: false
hasSuggestions: true
- description: disallow octal literals
fixable: false
name: no-octal
Expand Down Expand Up @@ -467,6 +469,7 @@ categories:
fixable: false
name: no-useless-escape
recommended: true
hasSuggestions: true
- description: disallow redundant return statements
fixable: true
name: no-useless-return
Expand Down Expand Up @@ -503,6 +506,7 @@ categories:
fixable: false
name: radix
recommended: false
hasSuggestions: true
- description: disallow async functions which have no `await` expression
fixable: false
name: require-await
Expand Down
1 change: 1 addition & 0 deletions _layouts/doc.liquid
Expand Up @@ -30,6 +30,7 @@
| replace: '<p>(fixable) ', '<p class="fixable 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="fixable">💡</span>'
}}
</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](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)

## Possible Errors

Expand Down
2 changes: 2 additions & 0 deletions docs/rules/index.liquid
Expand Up @@ -14,6 +14,7 @@ layout: doc
<colgroup>
<col class="recommended" />
<col class="fixable" />
<col class="hasSuggestions" />
<col class="name" />
<col class="description" />
</colgroup>
Expand All @@ -22,6 +23,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 afe7bf3

Please sign in to comment.