Rename CSSLint rule config file & variable
This commit is contained in:
parent
b00d9575f8
commit
e96f0808ed
|
@ -4,7 +4,7 @@
|
||||||
* CSSLint Ruleset values
|
* CSSLint Ruleset values
|
||||||
* 0 = disabled; 1 = warning; 2 = error
|
* 0 = disabled; 1 = warning; 2 = error
|
||||||
*/
|
*/
|
||||||
window.csslintDefaultRuleset = {
|
window.csslintDefaultRuleConfig = {
|
||||||
// Default warnings
|
// Default warnings
|
||||||
'display-property-grouping': 1,
|
'display-property-grouping': 1,
|
||||||
'duplicate-properties': 1,
|
'duplicate-properties': 1,
|
10
edit/lint.js
10
edit/lint.js
|
@ -1,6 +1,6 @@
|
||||||
/* global CodeMirror messageBox */
|
/* global CodeMirror messageBox */
|
||||||
/* global editors makeSectionVisible showCodeMirrorPopup showHelp */
|
/* global editors makeSectionVisible showCodeMirrorPopup showHelp */
|
||||||
/* global stylelintDefaultConfig csslintDefaultRuleset onDOMscripted injectCSS require */
|
/* global stylelintDefaultConfig csslintDefaultRuleConfig onDOMscripted injectCSS require */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function initLint() {
|
function initLint() {
|
||||||
|
@ -28,8 +28,8 @@ function setStylelintRules(rules) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCSSLintRules(ruleset) {
|
function setCSSLintRules(ruleset) {
|
||||||
if (Object.keys(ruleset || []).length === 0 && typeof csslintDefaultRuleset !== 'undefined') {
|
if (Object.keys(ruleset || []).length === 0 && typeof csslintDefaultRuleConfig !== 'undefined') {
|
||||||
ruleset = Object.assign({}, csslintDefaultRuleset);
|
ruleset = Object.assign({}, csslintDefaultRuleConfig);
|
||||||
}
|
}
|
||||||
BG.chromeSync.setValue('editorCSSLintRules', ruleset);
|
BG.chromeSync.setValue('editorCSSLintRules', ruleset);
|
||||||
return ruleset;
|
return ruleset;
|
||||||
|
@ -317,7 +317,7 @@ function setupLinterSettingsEvents(popup) {
|
||||||
rules = stylelintDefaultConfig.rules;
|
rules = stylelintDefaultConfig.rules;
|
||||||
} else {
|
} else {
|
||||||
setCSSLintRules();
|
setCSSLintRules();
|
||||||
rules = csslintDefaultRuleset;
|
rules = csslintDefaultRuleConfig;
|
||||||
}
|
}
|
||||||
popup.codebox.setValue(stringifyRules(rules));
|
popup.codebox.setValue(stringifyRules(rules));
|
||||||
updateLinter(linter);
|
updateLinter(linter);
|
||||||
|
@ -412,7 +412,7 @@ function loadSelectedLinter(name) {
|
||||||
}
|
}
|
||||||
if (name === 'csslint' && !window.CSSLint) {
|
if (name === 'csslint' && !window.CSSLint) {
|
||||||
scripts.push(
|
scripts.push(
|
||||||
'edit/csslint-ruleset.js',
|
'edit/csslint-config.js',
|
||||||
'vendor-overwrites/csslint/csslint-worker.js'
|
'vendor-overwrites/csslint/csslint-worker.js'
|
||||||
);
|
);
|
||||||
} else if (name === 'stylelint' && !window.stylelint) {
|
} else if (name === 'stylelint' && !window.stylelint) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
||||||
|
|
||||||
/* global CodeMirror require define */
|
/* global CodeMirror require define */
|
||||||
/* global CSSLint stylelint stylelintDefaultConfig csslintDefaultRuleset */
|
/* global CSSLint stylelint stylelintDefaultConfig csslintDefaultRuleConfig */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
(mod => {
|
(mod => {
|
||||||
|
@ -25,10 +25,10 @@
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
/* STYLUS: hack start (part 1) */
|
/* STYLUS: hack start (part 1) */
|
||||||
return BG.chromeSync.getValue('editorCSSLintRules').then((ruleset = csslintDefaultRuleset) => {
|
return BG.chromeSync.getValue('editorCSSLintRules').then((ruleset = csslintDefaultRuleConfig) => {
|
||||||
// csslintDefaultRuleset stored in csslint-ruleset.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(ruleset).length === 0) {
|
||||||
ruleset = Object.assign({}, csslintDefaultRuleset);
|
ruleset = Object.assign({}, csslintDefaultRuleConfig);
|
||||||
}
|
}
|
||||||
const results = CSSLint.verify(text, ruleset);
|
const results = CSSLint.verify(text, ruleset);
|
||||||
const messages = results.messages;
|
const messages = results.messages;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user