You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
892 B
31 lines
892 B
"use strict";
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const CLIEngine = require("eslint").CLIEngine;
|
|
const settings = require("../../settings");
|
|
const cli = new CLIEngine({
|
|
configFile: settings.eslintBrowserConfig
|
|
});
|
|
|
|
module.exports = (params, processor) => ({
|
|
process: () => {
|
|
const filePath = path.normalize(processor.context.exported + "/" + params.filename);
|
|
const result = cli.executeOnFiles([filePath]);
|
|
processor.onInfo("ESLinted " + params.filename);
|
|
|
|
result.results.forEach((subresult) => {
|
|
subresult.messages.forEach((message) => {
|
|
const messageText = params.filename + ":" + message.line + "," + message.column + " (" + message.ruleId + ") " + message.message;
|
|
if (message.fatal || message.severity === 2) {
|
|
processor.onError(messageText);
|
|
} else {
|
|
processor.onWarn(messageText);
|
|
}
|
|
});
|
|
});
|
|
|
|
processor.done();
|
|
}
|
|
});
|
|
|
|
|