Rename CSSLint rule config file & variable

This commit is contained in:
Rob Garrison 2017-08-26 10:42:38 -05:00
parent b00d9575f8
commit e96f0808ed
3 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@
* CSSLint Ruleset values
* 0 = disabled; 1 = warning; 2 = error
*/
window.csslintDefaultRuleset = {
window.csslintDefaultRuleConfig = {
// Default warnings
'display-property-grouping': 1,
'duplicate-properties': 1,

View File

@ -1,6 +1,6 @@
/* global CodeMirror messageBox */
/* global editors makeSectionVisible showCodeMirrorPopup showHelp */
/* global stylelintDefaultConfig csslintDefaultRuleset onDOMscripted injectCSS require */
/* global stylelintDefaultConfig csslintDefaultRuleConfig onDOMscripted injectCSS require */
'use strict';
function initLint() {
@ -28,8 +28,8 @@ function setStylelintRules(rules) {
}
function setCSSLintRules(ruleset) {
if (Object.keys(ruleset || []).length === 0 && typeof csslintDefaultRuleset !== 'undefined') {
ruleset = Object.assign({}, csslintDefaultRuleset);
if (Object.keys(ruleset || []).length === 0 && typeof csslintDefaultRuleConfig !== 'undefined') {
ruleset = Object.assign({}, csslintDefaultRuleConfig);
}
BG.chromeSync.setValue('editorCSSLintRules', ruleset);
return ruleset;
@ -317,7 +317,7 @@ function setupLinterSettingsEvents(popup) {
rules = stylelintDefaultConfig.rules;
} else {
setCSSLintRules();
rules = csslintDefaultRuleset;
rules = csslintDefaultRuleConfig;
}
popup.codebox.setValue(stringifyRules(rules));
updateLinter(linter);
@ -412,7 +412,7 @@ function loadSelectedLinter(name) {
}
if (name === 'csslint' && !window.CSSLint) {
scripts.push(
'edit/csslint-ruleset.js',
'edit/csslint-config.js',
'vendor-overwrites/csslint/csslint-worker.js'
);
} else if (name === 'stylelint' && !window.stylelint) {

View File

@ -4,7 +4,7 @@
// Depends on csslint.js from https://github.com/stubbornella/csslint
/* global CodeMirror require define */
/* global CSSLint stylelint stylelintDefaultConfig csslintDefaultRuleset */
/* global CSSLint stylelint stylelintDefaultConfig csslintDefaultRuleConfig */
'use strict';
(mod => {
@ -25,10 +25,10 @@
return found;
}
/* STYLUS: hack start (part 1) */
return BG.chromeSync.getValue('editorCSSLintRules').then((ruleset = csslintDefaultRuleset) => {
// csslintDefaultRuleset stored in csslint-ruleset.js & loaded by edit/lint.js
return BG.chromeSync.getValue('editorCSSLintRules').then((ruleset = csslintDefaultRuleConfig) => {
// csslintDefaultRuleConfig stored in csslint-config.js & loaded by edit/lint.js
if (Object.keys(ruleset).length === 0) {
ruleset = Object.assign({}, csslintDefaultRuleset);
ruleset = Object.assign({}, csslintDefaultRuleConfig);
}
const results = CSSLint.verify(text, ruleset);
const messages = results.messages;