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