start upgrading eslint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 16:57:10 +02:00
parent 90c917f69e
commit 621787915c
304 changed files with 5992 additions and 6394 deletions

View File

@@ -1,30 +1,31 @@
'use strict';
let logger = require('./logger');
const logger = require('./logger');
class Timer {
constructor (options) {
options = options || {};
let warningThreshold = options.minutesWarningThreshold || 10;
const warningThreshold = options.minutesWarningThreshold || 10;
this.count = 0;
this._minutesWarningThreshold = warningThreshold * 60;
if (!options.disableAutoStart) this.start();
}
start () {
this._internalTimer = setInterval(() => {
this.count++;
let shouldWarn = this._minutesWarningThreshold < this.count;
let logStyle = shouldWarn ? 'error' : 'warn';
let dangerMessage = shouldWarn ? 'DANGER: ' : '';
const shouldWarn = this._minutesWarningThreshold < this.count;
const logStyle = shouldWarn ? 'error' : 'warn';
const dangerMessage = shouldWarn ? 'DANGER: ' : '';
if (this.count % 30 === 0) {
logger[logStyle](`${dangerMessage}Process has been running for`, this.count / 60, 'minutes');
}
}, 1000);
}
stop () {
if (!this._internalTimer) {
throw new Error('Timer has not started');