diff --git a/edit/editor-worker.js b/edit/editor-worker.js index cfc7bfe5..03ad6c97 100644 --- a/edit/editor-worker.js +++ b/edit/editor-worker.js @@ -1,4 +1,4 @@ -/* global importScripts parseMozFormat parserlib CSSLint require workerUtil */ +/* global importScripts workerUtil CSSLint require usercssMeta */ 'use strict'; importScripts('/js/worker-util.js'); @@ -14,6 +14,19 @@ createAPI({ loadScript('/vendor/stylelint-bundle/stylelint-bundle.min.js'); 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, getCsslintRules });