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": {
"message": "(Set rules: 0 = disabled; 1 = warning; 2 = error)",
"description": "CSSLint rule settings values"
"description": "CSSLint rule config values"
},
"linterInvalidRuleError": {
"message": "Not saved due to these invalid rules:",

View File

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

View File

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

View File

@ -25,12 +25,12 @@
return found;
}
/* 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
if (Object.keys(ruleset).length === 0) {
ruleset = Object.assign({}, csslintDefaultRuleConfig);
if (Object.keys(config).length === 0) {
config = Object.assign({}, csslintDefaultRuleConfig);
}
const results = CSSLint.verify(text, ruleset);
const results = CSSLint.verify(text, config);
const messages = results.messages;
const hslRegex = /hsla?\(\s*(-?\d+)%?\s*,\s*(-?\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%(\s*,\s*(-?\d+|-?\d*.\d+))?\s*\)/;
let message = null;