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 640dd74
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 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
2 changes: 2 additions & 0 deletions docs/rules/README.md
Expand Up @@ -6,6 +6,8 @@ No rules are enabled by default. The `"extends": "eslint:recommended"` property

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.

A rule has a lightbulb (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

These rules relate to possible syntax or logic errors in JavaScript code:
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 640dd74

Please sign in to comment.