Skip to content

Commit d53d906

Browse files
bmishmdjermanovic
andauthored
Docs: Prepare data for website to indicate rules with suggestions (#14830)
Co-authored-by: Milos Djermanovic <[email protected]>
1 parent d28f2ff commit d53d906

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Makefile.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ function generateRuleIndexPage() {
197197
name: basename,
198198
description: rule.meta.docs.description,
199199
recommended: rule.meta.docs.recommended || false,
200-
fixable: !!rule.meta.fixable
200+
fixable: !!rule.meta.fixable,
201+
hasSuggestions: !!rule.meta.docs.suggestion
201202
},
202203
category = categoriesData.categories.find(c => c.name === rule.meta.docs.category);
203204

@@ -640,6 +641,7 @@ target.gensite = function(prereleaseVersion) {
640641

641642
const RECOMMENDED_TEXT = "\n\n(recommended) The `\"extends\": \"eslint:recommended\"` property in a configuration file enables this rule.";
642643
const FIXABLE_TEXT = "\n\n(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.";
644+
const HAS_SUGGESTIONS_TEXT = "\n\n(hasSuggestions) Some problems reported by this rule are manually fixable by editor [suggestions](../developer-guide/working-with-rules#providing-suggestions).";
643645

644646
// 4. Loop through all files in temporary directory
645647
process.stdout.write("> Updating files (Steps 4-9): 0/... - ...\r");
@@ -669,13 +671,14 @@ target.gensite = function(prereleaseVersion) {
669671
const rule = rules.get(ruleName);
670672
const isRecommended = rule && rule.meta.docs.recommended;
671673
const isFixable = rule && rule.meta.fixable;
674+
const hasSuggestions = rule && rule.meta.docs.suggestion;
672675

673676
// Incorporate the special portion into the documentation content
674677
const textSplit = text.split("\n");
675678
const ruleHeading = textSplit[0];
676679
const ruleDocsContent = textSplit.slice(1).join("\n");
677680

678-
text = `${ruleHeading}${isRecommended ? RECOMMENDED_TEXT : ""}${isFixable ? FIXABLE_TEXT : ""}\n${ruleDocsContent}`;
681+
text = `${ruleHeading}${isRecommended ? RECOMMENDED_TEXT : ""}${isFixable ? FIXABLE_TEXT : ""}${hasSuggestions ? HAS_SUGGESTIONS_TEXT : ""}\n${ruleDocsContent}`;
679682
title = `${ruleName} - Rules`;
680683

681684
if (rule && rule.meta) {

0 commit comments

Comments
 (0)