Rename CSSLint ruleset to config

This commit is contained in:
Rob Garrison 2017-08-27 10:23:35 -05:00
parent 1e03910b0b
commit 21e22c2b6f
4 changed files with 12 additions and 12 deletions

View File

@ -355,7 +355,7 @@
}, },
"linterCSSLintSettings": { "linterCSSLintSettings": {
"message": "(Set rules: 0 = disabled; 1 = warning; 2 = error)", "message": "(Set rules: 0 = disabled; 1 = warning; 2 = error)",
"description": "CSSLint rule settings values" "description": "CSSLint rule config values"
}, },
"linterInvalidRuleError": { "linterInvalidRuleError": {
"message": "Not saved due to these invalid rules:", "message": "Not saved due to these invalid rules:",

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
/** /**
* CSSLint Ruleset values * CSSLint Config values
* 0 = disabled; 1 = warning; 2 = error * 0 = disabled; 1 = warning; 2 = error
*/ */
window.csslintDefaultRuleConfig = { window.csslintDefaultRuleConfig = {

View File

@ -15,7 +15,7 @@ function initLint() {
} }
// initialize storage of rules // initialize storage of rules
BG.chromeSync.getValue('editorStylelintRules').then(rules => setStylelintRules(rules)); BG.chromeSync.getValue('editorStylelintRules').then(rules => setStylelintRules(rules));
BG.chromeSync.getValue('editorCSSLintRules').then(ruleset => setCSSLintRules(ruleset)); BG.chromeSync.getValue('editorCSSLintRules').then(config => setCSSLintRules(config));
} }
function setStylelintRules(rules) { function setStylelintRules(rules) {
@ -27,12 +27,12 @@ function setStylelintRules(rules) {
return rules; return rules;
} }
function setCSSLintRules(ruleset) { function setCSSLintRules(config) {
if (Object.keys(ruleset || []).length === 0 && typeof csslintDefaultRuleConfig !== 'undefined') { if (Object.keys(config || []).length === 0 && typeof csslintDefaultRuleConfig !== 'undefined') {
ruleset = Object.assign({}, csslintDefaultRuleConfig); config = Object.assign({}, csslintDefaultRuleConfig);
} }
BG.chromeSync.setValue('editorCSSLintRules', ruleset); BG.chromeSync.setValue('editorCSSLintRules', config);
return ruleset; return config;
} }
function getLinterConfigForCodeMirror(name) { function getLinterConfigForCodeMirror(name) {

View File

@ -25,12 +25,12 @@
return found; return found;
} }
/* STYLUS: hack start (part 1) */ /* STYLUS: hack start (part 1) */
return BG.chromeSync.getValue('editorCSSLintRules').then((ruleset = csslintDefaultRuleConfig) => { return BG.chromeSync.getValue('editorCSSLintRules').then((config = csslintDefaultRuleConfig) => {
// csslintDefaultRuleConfig stored in csslint-config.js & loaded by edit/lint.js // csslintDefaultRuleConfig stored in csslint-config.js & loaded by edit/lint.js
if (Object.keys(ruleset).length === 0) { if (Object.keys(config).length === 0) {
ruleset = Object.assign({}, csslintDefaultRuleConfig); config = Object.assign({}, csslintDefaultRuleConfig);
} }
const results = CSSLint.verify(text, ruleset); const results = CSSLint.verify(text, config);
const messages = results.messages; const messages = results.messages;
const hslRegex = /hsla?\(\s*(-?\d+)%?\s*,\s*(-?\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%(\s*,\s*(-?\d+|-?\d*.\d+))?\s*\)/; const hslRegex = /hsla?\(\s*(-?\d+)%?\s*,\s*(-?\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%(\s*,\s*(-?\d+|-?\d*.\d+))?\s*\)/;
let message = null; let message = null;