From d4fac4416e56462457c2f28b96bad9f87520a485 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:35:24 -0700 Subject: [PATCH] Docs: Display emoji/notice for rules with suggestions (#860) * 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 --- _layouts/doc.liquid | 2 ++ _layouts/rule.liquid | 1 + _layouts/rules.liquid | 1 + docs/rules/README.md | 8 ++++---- docs/rules/index.liquid | 9 ++++++--- src/styles/lib/overrides.less | 4 ++++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/_layouts/doc.liquid b/_layouts/doc.liquid index 0925491caf..8722792c3c 100644 --- a/_layouts/doc.liquid +++ b/_layouts/doc.liquid @@ -28,8 +28,10 @@ | replace: '

(recommended) ', '

(removed) ', '

' | replace: '

(fixable) ', '

' + | replace: '

(hasSuggestions) ', '

' | replace: '(recommended)', '' | replace: '(fixable)', '🔧' + | replace: '(hasSuggestions)', '💡' }} diff --git a/_layouts/rule.liquid b/_layouts/rule.liquid index 1c444b445e..854f29814f 100644 --- a/_layouts/rule.liquid +++ b/_layouts/rule.liquid @@ -25,6 +25,7 @@ | replace: '

(removed) ', '

' | replace: '

(recommended) ', '

(fixable) ', '

' + | replace: '

(hasSuggestions) ', '

' }} diff --git a/_layouts/rules.liquid b/_layouts/rules.liquid index 536de582fe..2c9e1175f9 100644 --- a/_layouts/rules.liquid +++ b/_layouts/rules.liquid @@ -16,6 +16,7 @@ {{ content | replace: '(recommended)', '' | replace: '(fixable)', '🔧' + | replace: '(hasSuggestions)', '💡' }} diff --git a/docs/rules/README.md b/docs/rules/README.md index eba1b7be8d..02dde724b6 100644 --- a/docs/rules/README.md +++ b/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 diff --git a/docs/rules/index.liquid b/docs/rules/index.liquid index d130f0c03a..3bbf0eb20a 100644 --- a/docs/rules/index.liquid +++ b/docs/rules/index.liquid @@ -4,9 +4,10 @@ layout: doc ---

Rules

-

Rules in ESLint are grouped by category to help you understand their purpose.

-

No rules are enabled by default. The "extends": "eslint:recommended" property in a configuration file enables rules that report common problems, which have a check mark (recommended) below.

-

The --fix option on the command line automatically fixes problems (currently mostly whitespace) reported by rules which have a wrench (fixable) below.

+

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

+

(recommended) if the "extends": "eslint:recommended" property in a configuration file enables the rule

+

(fixable) if some problems reported by the rule are automatically fixable by the --fix command line option

+

(hasSuggestions) if some problems reported by the rule are manually fixable by editor suggestions

{% for category in rules.categories %}

{{ category.name }}

{{ category.description }} @@ -14,6 +15,7 @@ layout: doc + @@ -22,6 +24,7 @@ layout: doc {% if rule.recommended %}(recommended){% endif %} {% if rule.fixable %}(fixable){% endif %} + {% if rule.hasSuggestions %}(hasSuggestions){% endif %} {{ rule.name }} {{ rule.description }} diff --git a/src/styles/lib/overrides.less b/src/styles/lib/overrides.less index dcfd446a65..e395eb9b17 100644 --- a/src/styles/lib/overrides.less +++ b/src/styles/lib/overrides.less @@ -100,6 +100,10 @@ p { content: "🔧"; /* wrench */ } + &.hasSuggestions:before { + content: "💡"; /* lightbulb */ + } + &.incorrect:before { content: "\e126"; /* thumbs-down */ }