Add: editorWorker.metalint
This commit is contained in:
parent
f47d57aea8
commit
81a7bb9ac9
|
@ -1,4 +1,4 @@
|
||||||
/* global importScripts parseMozFormat parserlib CSSLint require workerUtil */
|
/* global importScripts workerUtil CSSLint require usercssMeta */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
importScripts('/js/worker-util.js');
|
importScripts('/js/worker-util.js');
|
||||||
|
@ -14,6 +14,19 @@ createAPI({
|
||||||
loadScript('/vendor/stylelint-bundle/stylelint-bundle.min.js');
|
loadScript('/vendor/stylelint-bundle/stylelint-bundle.min.js');
|
||||||
return require('stylelint').lint({code, config});
|
return require('stylelint').lint({code, config});
|
||||||
},
|
},
|
||||||
|
metalint: code => {
|
||||||
|
loadScript('/vendor/usercss-meta/usercss-meta.min.js');
|
||||||
|
const result = usercssMeta.parse(code, {allowErrors: true, unknownKey: 'throw'});
|
||||||
|
// extract needed info
|
||||||
|
result.errors = result.errors.map(err =>
|
||||||
|
({
|
||||||
|
code: err.code,
|
||||||
|
message: err.message,
|
||||||
|
index: err.index
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
getStylelintRules,
|
getStylelintRules,
|
||||||
getCsslintRules
|
getCsslintRules
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user