@s-ui/lint-reporters
Version:
Send lint errors and golden path metrics to DataDog
1 lines • 1.25 kB
JavaScript
import _async_to_generator from"@swc/helpers/src/_async_to_generator.mjs";import _extends from"@swc/helpers/src/_extends.mjs";import _inherits from"@swc/helpers/src/_inherits.mjs";import _ts_generator from"@swc/helpers/src/_ts_generator.mjs";import{Reporter}from"./Reporter.js";export var RepositoryReporter=function(Reporter){"use strict";_inherits(RepositoryReporter,Reporter);function RepositoryReporter(){return Reporter.apply(this,arguments)}var _proto=RepositoryReporter.prototype;_proto.map=function map(results){this.data=results.monitorings;return this};_proto.send=function send(){var _this=this;return _async_to_generator(function(){var signals;return _ts_generator(this,function(_state){switch(_state.label){case 0:if(_this.data===undefined){throw new Error("[sui-lint] No data to send. Maybe you must call to map before")}return[4,_this._isMaster()];case 1:if(!_state.sent()){return[2,console.log("[sui-lint] Reporters only will happen in MASTER branch.")]}signals=_this.data.map(function(signal){return _extends({},signal,{type:"repository"})});return[4,_this.sender.send(signals)];case 2:_state.sent();return[2]}})})()};RepositoryReporter.create=function create(){return new RepositoryReporter};return RepositoryReporter}(Reporter);