From ff23c1049483fc18f67a5139e07e3adadfb0d7f1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 14 Jun 2022 21:17:13 +0200 Subject: [PATCH] feat(website): open issue with rule name if only one rule is enabled --- packages/website/src/components/lib/markdown.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/website/src/components/lib/markdown.ts b/packages/website/src/components/lib/markdown.ts index ab9175dc2f0..4009fb1f08b 100644 --- a/packages/website/src/components/lib/markdown.ts +++ b/packages/website/src/components/lib/markdown.ts @@ -1,3 +1,4 @@ +import { parseESLintRC } from '../config/utils'; import type { ConfigModel } from '../types'; export function createSummary( @@ -49,10 +50,18 @@ export function createMarkdown(state: ConfigModel): string { } export function createMarkdownParams(state: ConfigModel): string { + const { rules = {} } = parseESLintRC(state.eslintrc); + const ruleKeys = Object.keys(rules); + + const onlyRuleName = + ruleKeys.length === 1 + ? ruleKeys[0].replace('@typescript-eslint/', '') + : 'rule name here'; + const params = { labels: 'bug,package: eslint-plugin,triage', template: '1-bug-report-plugin.yaml', - title: 'Bug: [rule name here] ', + title: `Bug: [${onlyRuleName}] `, 'playground-link': document.location.toString(), 'repro-code': state.code, 'eslint-config': `module.exports = ${state.eslintrc ?? '{}'}`,