Fix issue when CSSLint isn't loaded

This commit is contained in:
Rob Garrison 2017-08-25 18:54:37 -05:00
parent 988af5f1b8
commit e2228964d4

View File

@ -203,8 +203,6 @@ function toggleLintReport() {
} }
function showLintHelp() { function showLintHelp() {
const CSSLintRules = CSSLint.getRules();
const findCSSLintRule = id => CSSLintRules.find(rule => rule.id === id);
const makeLink = (url, txt) => `<a target="_blank" href="${url}">${txt}</a>`; const makeLink = (url, txt) => `<a target="_blank" href="${url}">${txt}</a>`;
const linter = prefs.get('editor.linter'); const linter = prefs.get('editor.linter');
const url = linter === 'stylelint' const url = linter === 'stylelint'
@ -216,6 +214,8 @@ function showLintHelp() {
let list = '<ul class="rules">'; let list = '<ul class="rules">';
let header = ''; let header = '';
if (linter === 'csslint') { if (linter === 'csslint') {
const CSSLintRules = CSSLint.getRules();
const findCSSLintRule = id => CSSLintRules.find(rule => rule.id === id);
header = t('issuesHelp', makeLink('https://github.com/CSSLint/csslint/wiki/Rules-by-ID', 'CSSLint')); header = t('issuesHelp', makeLink('https://github.com/CSSLint/csslint/wiki/Rules-by-ID', 'CSSLint'));
template = ruleID => { template = ruleID => {
const rule = findCSSLintRule(ruleID); const rule = findCSSLintRule(ruleID);