Remove duplicate rules in issue modal

This commit is contained in:
Rob Garrison 2018-11-20 18:56:33 -06:00
parent 17339e933b
commit 81d27288f2

View File

@ -33,18 +33,18 @@ function createLinterHelpDialog(getIssues) {
}; };
} else { } else {
headerLink = $createLink(baseUrl, 'stylelint'); headerLink = $createLink(baseUrl, 'stylelint');
template = ({rule}) => template = rule =>
$create('li', $create('li',
rule === 'CssSyntaxError' ? rule : $createLink(baseUrl + rule, rule)); rule === 'CssSyntaxError' ? rule : $createLink(baseUrl + rule, rule));
} }
const header = t('linterIssuesHelp', '\x01').split('\x01'); const header = t('linterIssuesHelp', '\x01').split('\x01');
const activeRules = getIssues(); const activeRules = new Set([...getIssues()].map(issue => issue.rule));
Promise.resolve(linter === 'csslint' && prepareCsslintRules()) Promise.resolve(linter === 'csslint' && prepareCsslintRules())
.then(() => .then(() =>
showHelp(t('linterIssues'), showHelp(t('linterIssues'),
$create([ $create([
header[0], headerLink, header[1], header[0], headerLink, header[1],
$create('ul.rules', [...activeRules.values()].map(template)), $create('ul.rules', [...activeRules].map(template)),
]) ])
) )
); );