From 21e22c2b6fde4bb45049f9c12551417fa3cb14ec Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 27 Aug 2017 10:23:35 -0500 Subject: [PATCH] Rename CSSLint ruleset to config --- _locales/en/messages.json | 2 +- edit/csslint-config.js | 2 +- edit/lint.js | 12 ++++++------ vendor-overwrites/codemirror/addon/lint/css-lint.js | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4774b077..92ecafc0 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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:", diff --git a/edit/csslint-config.js b/edit/csslint-config.js index 34be3368..a6168828 100644 --- a/edit/csslint-config.js +++ b/edit/csslint-config.js @@ -1,7 +1,7 @@ 'use strict'; /** - * CSSLint Ruleset values + * CSSLint Config values * 0 = disabled; 1 = warning; 2 = error */ window.csslintDefaultRuleConfig = { diff --git a/edit/lint.js b/edit/lint.js index ae5c5b7a..94f740a6 100644 --- a/edit/lint.js +++ b/edit/lint.js @@ -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) { diff --git a/vendor-overwrites/codemirror/addon/lint/css-lint.js b/vendor-overwrites/codemirror/addon/lint/css-lint.js index f3aed094..245e7239 100644 --- a/vendor-overwrites/codemirror/addon/lint/css-lint.js +++ b/vendor-overwrites/codemirror/addon/lint/css-lint.js @@ -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;