From 81e672034195f145531be884f1d2f4002e7011a1 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 28 Aug 2017 16:33:45 +0300 Subject: [PATCH] use $element in showLintHelp --- edit/lint.js | 55 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/edit/lint.js b/edit/lint.js index 8c7b1ad7..802d8196 100644 --- a/edit/lint.js +++ b/edit/lint.js @@ -299,37 +299,50 @@ function toggleLintReport() { } function showLintHelp() { - const makeLink = (url, txt) => `${txt}`; + const makeLink = (href, textContent) => $element({ + tag: 'a', + target: '_blank', + href, + textContent, + }); const linter = prefs.get('editor.linter'); - const url = linter === 'stylelint' + const baseUrl = linter === 'stylelint' ? 'https://stylelint.io/user-guide/rules/' // some CSSLint rules do not have a url : 'https://github.com/CSSLint/csslint/issues/535'; - const rules = []; - let template; - let list = ''); + const header = t('linterIssuesHelp', '\x01').split('\x01'); + const activeRules = new Set($$('#lint td[role="severity"]').map(el => el.dataset.rule)); + return showHelp(t('linterIssues'), + $element({appendChild: [ + header[0], headerLink, header[1], + $element({ + tag: 'ul', + className: 'rules', + appendChild: [...activeRules.values()].map(template), + }), + ]}) + ); } function showLinterErrorMessage(title, contents) {