lint: Run eslint --fix on src/

This commit is contained in:
Richard Hansen 2020-11-23 13:24:19 -05:00 committed by John McLear
parent b8d07a42eb
commit 8e5fd19db2
109 changed files with 9061 additions and 10572 deletions

View file

@ -2,10 +2,10 @@
* Worker thread to minify JS & CSS files out of the main NodeJS thread
*/
var CleanCSS = require('clean-css');
var Terser = require("terser");
var path = require('path');
var Threads = require('threads')
const CleanCSS = require('clean-css');
const Terser = require('terser');
const path = require('path');
const Threads = require('threads');
function compressJS(content) {
return Terser.minify(content);
@ -46,20 +46,20 @@ function compressCSS(filename, ROOT_DIR) {
new CleanCSS({
rebase: true,
rebaseTo: basePath,
}).minify([absPath], function (errors, minified) {
if (errors) return rej(errors)
}).minify([absPath], (errors, minified) => {
if (errors) return rej(errors);
return res(minified.styles)
return res(minified.styles);
});
} catch (error) {
// on error, just yield the un-minified original, but write a log message
console.error(`Unexpected error minifying ${filename} (${absPath}): ${error}`);
callback(null, content);
}
})
});
}
Threads.expose({
compressJS,
compressCSS
})
compressCSS,
});