Build server prototype (integration with GitHub / NuGet / etc)
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.
micro-build-server/BuildServer/lib/tasks/eslintbrowser.ts

33 lines
996 B

"use strict";
import { join } from "path";
import { CLIEngine } from "eslint";
import settings from "../../settings";
const cli = new CLIEngine({ "configFile": settings.eslintBrowserConfig });
const errorSeverity = 2;
export default (params, processor) => ({
"process": () => {
const filePath = join(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 === errorSeverity) {
processor.onError(messageText);
} else {
processor.onWarn(messageText);
}
});
});
processor.done();
}
});