44import * as colors from 'colors' ;
55import * as Gulp from 'gulp' ;
66import * as path from 'path' ;
7- /* tslint: disable:typedef */
7+ // eslint- disable-next-line
88const prettyTime = require ( 'pretty-hrtime' ) ;
9- /* tslint:enable:typedef */
9+
1010import { IBuildConfig } from './IBuildConfig' ;
1111import * as state from './State' ;
1212import { getFlagValue } from './config' ;
@@ -34,14 +34,16 @@ interface ILocalCache {
3434 totalTaskSrc : number ;
3535 wroteSummary : boolean ;
3636 writingSummary : boolean ;
37- writeSummaryCallbacks : Array < ( ) => void > ;
37+ writeSummaryCallbacks : ( ( ) => void ) [ ] ;
3838 watchMode ?: boolean ;
3939 fromRunGulp ?: boolean ;
4040 exitCode : number ;
4141 writeSummaryLogs : string [ ] ;
4242 gulp : typeof Gulp | undefined ;
43- gulpErrorCallback : undefined | ( ( err : Object ) => void ) ;
44- gulpStopCallback : undefined | ( ( err : Object ) => void ) ;
43+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44+ gulpErrorCallback : undefined | ( ( err : any ) => void ) ;
45+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
46+ gulpStopCallback : undefined | ( ( err : any ) => void ) ;
4547 errorAndWarningSuppressions : ( string | RegExp ) [ ] ;
4648 shouldLogWarningsDuringSummary : boolean ;
4749 shouldLogErrorsDuringSummary : boolean ;
@@ -50,9 +52,8 @@ interface ILocalCache {
5052let wiredUpErrorHandling : boolean = false ;
5153let duringFastExit : boolean = false ;
5254
53- /* tslint: disable:no-any */
55+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
5456const globalInstance : any = global as any ;
55- /* tslint:enable:no-any */
5657
5758const localCache : ILocalCache = globalInstance . __loggingCache = globalInstance . __loggingCache || {
5859 warnings : [ ] ,
@@ -91,9 +92,8 @@ function isVerbose(): boolean {
9192 return getFlagValue ( 'verbose' ) ;
9293}
9394
94- /* tslint: disable:no-any */
95+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
9596function formatError ( e : any ) : string | undefined {
96- /* tslint:enable:no-any */
9797
9898 if ( ! e . err ) {
9999 if ( isVerbose ( ) ) {
@@ -260,9 +260,8 @@ function writeSummary(callback: () => void): void {
260260 }
261261}
262262
263- /* tslint: disable:no-any */
263+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
264264function _writeTaskError ( e : any ) : void {
265- /* tslint:enable:no-any */
266265 if ( ! e || ! ( e . err && e . err [ WROTE_ERROR_KEY ] ) ) {
267266 writeError ( e ) ;
268267 localCache . taskErrors ++ ;
@@ -287,7 +286,7 @@ function wireUpProcessErrorHandling(shouldWarningsFailBuild: boolean): void {
287286 const oldStdErr : Function = process . stderr . write ;
288287 // tslint:disable-next-line:no-function-expression
289288 process . stderr . write = function ( text : string | Buffer ) : boolean {
290- if ( ! ! text . toString ( ) ) {
289+ if ( text . toString ( ) ) {
291290 wroteToStdErr = true ;
292291 return oldStdErr . apply ( process . stderr , arguments ) ;
293292 }
@@ -297,7 +296,7 @@ function wireUpProcessErrorHandling(shouldWarningsFailBuild: boolean): void {
297296
298297 process . on ( 'exit' , ( code : number ) => {
299298 duringFastExit = true ;
300- if ( ! global [ 'dontWatchExit' ] ) { // tslint: disable-line:no-string-literal
299+ if ( ! global [ 'dontWatchExit' ] ) { // eslint- disable-line dot-notation
301300 if ( ! localCache . wroteSummary ) {
302301 localCache . wroteSummary = true ;
303302 console . log ( 'About to exit with code:' , code ) ;
@@ -474,6 +473,7 @@ export function coverageData(coverage: number, threshold: number, filePath: stri
474473 localCache . coverageTotal += coverage ;
475474}
476475
476+ // eslint-disable-next-line no-control-regex
477477const colorCodeRegex : RegExp = / \x1B [ [ ( ? ) ; ] { 0 , 2 } ( ; ? \d ) * ./ g;
478478
479479/**
@@ -610,13 +610,13 @@ export function verbose(...args: string[]): void {
610610}
611611
612612/** @public */
613- export function generateGulpError ( err : Object ) : Object {
613+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
614+ export function generateGulpError ( err : any ) : any {
614615 if ( isVerbose ( ) ) {
615616 return err ;
616617 } else {
617- /* tslint: disable:no-any */
618+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
618619 const output : any = {
619- /* tslint:enable:no-any */
620620 showStack : false ,
621621 toString : ( ) : string => {
622622 return '' ;
@@ -629,14 +629,13 @@ export function generateGulpError(err: Object): Object {
629629 }
630630}
631631
632- /* tslint:disable:no-any */
633632/**
634633 * Logs an error to standard error and causes the build to fail.
635634 * @param e - the error (can be a string or Error object)
636635 * @public
637636 */
637+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
638638export function writeError ( e : any ) : void {
639- /* tslint:enable:no-any */
640639 if ( e ) {
641640 if ( ! e [ WROTE_ERROR_KEY ] ) {
642641 if ( e . err ) {
@@ -788,12 +787,14 @@ export function initialize(
788787 // Do Nothing
789788 } ) ;
790789
791- gulp . on ( 'start' , ( err : Object ) => {
790+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
791+ gulp . on ( 'start' , ( err : any ) => {
792792
793793 log ( 'Starting gulp' ) ;
794794 } ) ;
795795
796- gulp . on ( 'stop' , ( err : Object ) => {
796+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
797+ gulp . on ( 'stop' , ( err : any ) => {
797798
798799 writeSummary ( ( ) => {
799800 // error if we have any errors
@@ -811,7 +812,8 @@ export function initialize(
811812 } ) ;
812813 } ) ;
813814
814- gulp . on ( 'err' , ( err : Object ) => {
815+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
816+ gulp . on ( 'err' , ( err : any ) => {
815817
816818 _writeTaskError ( err ) ;
817819 writeSummary ( ( ) => {
@@ -822,9 +824,8 @@ export function initialize(
822824 } ) ;
823825 } ) ;
824826
825- /* tslint: disable:no-any */
827+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
826828 gulp . on ( 'task_start' , ( e : any ) => {
827- /* tslint:enable:no-any */
828829
829830 if ( localCache . fromRunGulp ) {
830831 log ( 'Starting' , '\'' + colors . cyan ( e . task ) + '\'...' ) ;
@@ -833,9 +834,8 @@ export function initialize(
833834 localCache . taskRun ++ ;
834835 } ) ;
835836
836- /* tslint: disable:no-any */
837+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
837838 gulp . on ( 'task_stop' , ( e : any ) => {
838- /* tslint:enable:no-any */
839839
840840 const time : string = prettyTime ( e . hrDuration ) ;
841841
@@ -847,19 +847,17 @@ export function initialize(
847847 }
848848 } ) ;
849849
850- /* tslint: disable:no-any */
850+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
851851 gulp . on ( 'task_err' , ( err : any ) => {
852- /* tslint:enable:no-any */
853852
854853 _writeTaskError ( err ) ;
855854 writeSummary ( ( ) => {
856855 exitProcess ( 1 ) ;
857856 } ) ;
858857 } ) ;
859858
860- /* tslint: disable:no-any */
859+ // eslint- disable-next-line @typescript-eslint/no-explicit-any
861860 gulp . on ( 'task_not_found' , ( err : any ) => {
862- /* tslint:enable:no-any */
863861
864862 log (
865863 colors . red ( 'Task \'' + err . task + '\' is not in your gulpfile' )
0 commit comments