Fix: script order of loadLinterAssets
This commit is contained in:
parent
411df8b051
commit
40a5dab311
|
@ -2,7 +2,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
CodeMirror.registerHelper('lint', 'csslint', code =>
|
CodeMirror.registerHelper('lint', 'csslint', code =>
|
||||||
window.CSSLint && CSSLint.verify(code, deepCopy(linterConfig.getCurrent('csslint')))
|
CSSLint.verify(code, deepCopy(linterConfig.getCurrent('csslint')))
|
||||||
.messages.map(message => ({
|
.messages.map(message => ({
|
||||||
from: CodeMirror.Pos(message.line - 1, message.col - 1),
|
from: CodeMirror.Pos(message.line - 1, message.col - 1),
|
||||||
to: CodeMirror.Pos(message.line - 1, message.col),
|
to: CodeMirror.Pos(message.line - 1, message.col),
|
||||||
|
@ -13,7 +13,7 @@ CodeMirror.registerHelper('lint', 'csslint', code =>
|
||||||
);
|
);
|
||||||
|
|
||||||
CodeMirror.registerHelper('lint', 'stylelint', code =>
|
CodeMirror.registerHelper('lint', 'stylelint', code =>
|
||||||
window.stylelint && stylelint.lint({
|
stylelint.lint({
|
||||||
code,
|
code,
|
||||||
config: deepCopy(linterConfig.getCurrent('stylelint')),
|
config: deepCopy(linterConfig.getCurrent('stylelint')),
|
||||||
}).then(({results}) => {
|
}).then(({results}) => {
|
||||||
|
|
39
edit/lint.js
39
edit/lint.js
|
@ -509,28 +509,37 @@ function setupLinterPopup(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLinterAssets(name = prefs.get('editor.linter')) {
|
function loadLinterAssets(name = prefs.get('editor.linter')) {
|
||||||
const scripts = [];
|
if (!name) {
|
||||||
if (name === 'csslint' && !window.CSSLint) {
|
return Promise.resolve();
|
||||||
scripts.push(
|
}
|
||||||
'/vendor-overwrites/csslint/csslint-worker.js',
|
return loadLibrary().then(loadAddon);
|
||||||
'/edit/lint-defaults-csslint.js'
|
|
||||||
);
|
function loadLibrary() {
|
||||||
} else if (name === 'stylelint' && !window.stylelint) {
|
if (name === 'csslint' && !window.CSSLint) {
|
||||||
scripts.push(
|
return loadScript([
|
||||||
loadScript([
|
'/vendor-overwrites/csslint/csslint-worker.js',
|
||||||
|
'/edit/lint-defaults-csslint.js'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (name === 'stylelint' && !window.stylelint) {
|
||||||
|
return loadScript([
|
||||||
'/vendor-overwrites/stylelint/stylelint-bundle.min.js',
|
'/vendor-overwrites/stylelint/stylelint-bundle.min.js',
|
||||||
'/edit/lint-defaults-stylelint.js'
|
'/edit/lint-defaults-stylelint.js'
|
||||||
]).then(() => (window.stylelint = require('stylelint')))
|
]).then(() => (window.stylelint = require('stylelint')));
|
||||||
);
|
}
|
||||||
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
if (name && !$('script[src$="/vendor/codemirror/addon/lint/lint.js"]')) {
|
|
||||||
scripts.push(
|
function loadAddon() {
|
||||||
|
if ($('script[src$="/vendor/codemirror/addon/lint/lint.js"]')) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return loadScript([
|
||||||
'/vendor/codemirror/addon/lint/lint.css',
|
'/vendor/codemirror/addon/lint/lint.css',
|
||||||
'/msgbox/msgbox.css',
|
'/msgbox/msgbox.css',
|
||||||
'/vendor/codemirror/addon/lint/lint.js',
|
'/vendor/codemirror/addon/lint/lint.js',
|
||||||
'/edit/lint-codemirror-helper.js',
|
'/edit/lint-codemirror-helper.js',
|
||||||
'/msgbox/msgbox.js'
|
'/msgbox/msgbox.js'
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
return loadScript(scripts);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user