From 9d12b13db42973065e1297205194a130c6dc488a Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Fri, 23 Jul 2021 13:38:44 -0700 Subject: [PATCH 1/7] Docs: Display emoji/notice for rules with suggestions --- _data/rules.yml | 4 ++++ _layouts/doc.liquid | 1 + _layouts/rules.liquid | 1 + docs/rules/README.md | 8 ++++---- docs/rules/index.liquid | 2 ++ src/styles/lib/overrides.less | 4 ++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/_data/rules.yml b/_data/rules.yml index f967cd825b..e63165aad3 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/_layouts/doc.liquid b/_layouts/doc.liquid index 0925491caf..ede7955454 100644 --- a/_layouts/doc.liquid +++ b/_layouts/doc.liquid @@ -30,6 +30,7 @@ | replace: '

(fixable) ', '

' | replace: '(recommended)', '' | replace: '(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..8ab471cbc4 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](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions) ## Possible Errors diff --git a/docs/rules/index.liquid b/docs/rules/index.liquid index e0909272c2..df5c8a9db4 100644 --- a/docs/rules/index.liquid +++ b/docs/rules/index.liquid @@ -14,6 +14,7 @@ layout: doc + @@ -22,6 +23,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 */ } From 74fbfc68171d2e5003e724f8de0a01be9c1ae03b Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Fri, 23 Jul 2021 21:38:21 -0700 Subject: [PATCH 2/7] no-op From cabf6491e7e9559d7c1f9664ff210412de863340 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Sun, 25 Jul 2021 23:21:31 -0700 Subject: [PATCH 3/7] Update rules/index.liquid --- docs/rules/index.liquid | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/rules/index.liquid b/docs/rules/index.liquid index df5c8a9db4..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 }} From ed6fee71b8a00bb6d190f5bf2fc73c813a29cf15 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Sun, 25 Jul 2021 23:29:04 -0700 Subject: [PATCH 4/7] add replace for hasSuggestions --- _layouts/doc.liquid | 1 + _layouts/rule.liquid | 1 + 2 files changed, 2 insertions(+) diff --git a/_layouts/doc.liquid b/_layouts/doc.liquid index ede7955454..9b2c2da386 100644 --- a/_layouts/doc.liquid +++ b/_layouts/doc.liquid @@ -28,6 +28,7 @@ | 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) ', '

' }} From 6c03c2e1d347380b39c42809d04138d9f27d33f2 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Sun, 25 Jul 2021 23:35:54 -0700 Subject: [PATCH 5/7] relative link --- docs/rules/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/README.md b/docs/rules/README.md index 8ab471cbc4..02dde724b6 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -4,7 +4,7 @@ Rules in ESLint are grouped by category to help you understand their purpose. Ea * (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) +* (hasSuggestions) if some problems reported by the rule are manually fixable by editor [suggestions](../developer-guide/working-with-rules#providing-suggestions) ## Possible Errors From f77ede9814d1b859f4a455287adc11a6560fbc4e Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Sun, 25 Jul 2021 23:44:31 -0700 Subject: [PATCH 6/7] fix label --- _layouts/doc.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_layouts/doc.liquid b/_layouts/doc.liquid index 9b2c2da386..8722792c3c 100644 --- a/_layouts/doc.liquid +++ b/_layouts/doc.liquid @@ -31,7 +31,7 @@ | replace: '

(hasSuggestions) ', '

' | replace: '(recommended)', '' | replace: '(fixable)', '🔧' - | replace: '(hasSuggestions)', '💡' + | replace: '(hasSuggestions)', '💡' }} From b6ceb5f8bae95c6524f2229b7a2136a6de58ddf4 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin Date: Thu, 29 Jul 2021 11:07:18 -0700 Subject: [PATCH 7/7] undo change to rules.yml --- _data/rules.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/_data/rules.yml b/_data/rules.yml index e63165aad3..f967cd825b 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -164,7 +164,6 @@ 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 @@ -388,7 +387,6 @@ categories: fixable: false name: no-nonoctal-decimal-escape recommended: false - hasSuggestions: true - description: disallow octal literals fixable: false name: no-octal @@ -469,7 +467,6 @@ categories: fixable: false name: no-useless-escape recommended: true - hasSuggestions: true - description: disallow redundant return statements fixable: true name: no-useless-return @@ -506,7 +503,6 @@ categories: fixable: false name: radix recommended: false - hasSuggestions: true - description: disallow async functions which have no `await` expression fixable: false name: require-await