@@ -84,15 +84,10 @@ describe('googleauth', () => {
8484 STUB_PROJECT ,
8585 ] . join ( '/' ) ;
8686
87- // eslint-disable-next-line @typescript-eslint/no-var-requires
8887 const privateJSON = require ( '../../test/fixtures/private.json' ) ;
89- // eslint-disable-next-line @typescript-eslint/no-var-requires
9088 const private2JSON = require ( '../../test/fixtures/private2.json' ) ;
91- // eslint-disable-next-line @typescript-eslint/no-var-requires
9289 const refreshJSON = require ( '../../test/fixtures/refresh.json' ) ;
93- // eslint-disable-next-line @typescript-eslint/no-var-requires
9490 const externalAccountJSON = require ( '../../test/fixtures/external-account-cred.json' ) ;
95- // eslint-disable-next-line @typescript-eslint/no-var-requires
9691 const externalAccountAuthorizedUserJSON = require ( '../../test/fixtures/external-account-authorized-user-cred.json' ) ;
9792 const privateKey = fs . readFileSync ( './test/fixtures/private.pem' , 'utf-8' ) ;
9893 const wellKnownPathWindows = path . join (
@@ -268,8 +263,9 @@ describe('googleauth', () => {
268263 function mockGCE ( ) {
269264 const scope1 = nockIsGCE ( ) ;
270265 const auth = new GoogleAuth ( ) ;
271- // eslint-disable-next-line @typescript-eslint/no-explicit-any
272- sinon . stub ( auth as any , 'getDefaultServiceProjectId' ) . resolves ( ) ;
266+ sinon
267+ . stub ( auth as ReturnType < JSON [ 'parse' ] > , 'getDefaultServiceProjectId' )
268+ . resolves ( ) ;
273269 const scope2 = nock ( HOST_ADDRESS )
274270 . get ( tokenPath )
275271 . reply ( 200 , { access_token : 'abc123' , expires_in : 10000 } , HEADERS ) ;
@@ -346,8 +342,7 @@ describe('googleauth', () => {
346342 const auth = new GoogleAuth ( ) ;
347343 assert . throws ( ( ) => {
348344 // Test verifies invalid parameter tests, which requires cast to any.
349- // eslint-disable-next-line @typescript-eslint/no-explicit-any
350- ( auth as any ) . fromJSON ( null ) ;
345+ ( auth as ReturnType < JSON [ 'parse' ] > ) . fromJSON ( null ) ;
351346 } ) ;
352347 } ) ;
353348
@@ -508,8 +503,7 @@ describe('googleauth', () => {
508503
509504 it ( 'fromStream should error on null stream' , done => {
510505 // Test verifies invalid parameter tests, which requires cast to any.
511- // eslint-disable-next-line @typescript-eslint/no-explicit-any
512- ( auth as any ) . fromStream ( null , ( err : Error ) => {
506+ ( auth as ReturnType < JSON [ 'parse' ] > ) . fromStream ( null , ( err : Error ) => {
513507 assert . strictEqual ( true , err instanceof Error ) ;
514508 done ( ) ;
515509 } ) ;
@@ -599,8 +593,9 @@ describe('googleauth', () => {
599593 it ( 'getApplicationCredentialsFromFilePath should error on null file path' , async ( ) => {
600594 try {
601595 // Test verifies invalid parameter tests, which requires cast to any.
602- // eslint-disable-next-line @typescript-eslint/no-explicit-any
603- await ( auth as any ) . _getApplicationCredentialsFromFilePath ( null ) ;
596+ await (
597+ auth as ReturnType < JSON [ 'parse' ] >
598+ ) . _getApplicationCredentialsFromFilePath ( null ) ;
604599 } catch ( e ) {
605600 return ;
606601 }
@@ -619,8 +614,9 @@ describe('googleauth', () => {
619614 it ( 'getApplicationCredentialsFromFilePath should error on non-string file path' , async ( ) => {
620615 try {
621616 // Test verifies invalid parameter tests, which requires cast to any.
622- // eslint-disable-next-line @typescript-eslint/no-explicit-any
623- await auth . _getApplicationCredentialsFromFilePath ( 2 as any ) ;
617+ await auth . _getApplicationCredentialsFromFilePath (
618+ 2 as ReturnType < JSON [ 'parse' ] > ,
619+ ) ;
624620 } catch ( e ) {
625621 return ;
626622 }
@@ -842,8 +838,7 @@ describe('googleauth', () => {
842838 assert . strictEqual ( projectId , STUB_PROJECT ) ;
843839
844840 // Null out all the private functions that make this method work
845- // eslint-disable-next-line @typescript-eslint/no-explicit-any
846- const anyd = auth as any ;
841+ const anyd = auth as ReturnType < JSON [ 'parse' ] > ;
847842 anyd . getProductionProjectId = null ;
848843 anyd . getFileProjectId = null ;
849844 anyd . getDefaultServiceProjectId = null ;
@@ -969,13 +964,14 @@ describe('googleauth', () => {
969964 // Make sure our special test bit is not set yet, indicating that
970965 // this is a new credentials instance.
971966 // Test verifies invalid parameter tests, which requires cast to any.
972- // eslint-disable-next-line @typescript-eslint/no-explicit-any
973- assert . strictEqual ( undefined , ( cachedCredential as any ) . specialTestBit ) ;
967+ assert . strictEqual (
968+ undefined ,
969+ ( cachedCredential as ReturnType < JSON [ 'parse' ] > ) . specialTestBit ,
970+ ) ;
974971
975972 // Now set the special test bit.
976973 // Test verifies invalid parameter tests, which requires cast to any.
977- // eslint-disable-next-line @typescript-eslint/no-explicit-any
978- ( cachedCredential as any ) . specialTestBit = 'monkey' ;
974+ ( cachedCredential as ReturnType < JSON [ 'parse' ] > ) . specialTestBit = 'monkey' ;
979975
980976 // Ask for credentials again, from the same auth instance. We expect
981977 // a cached instance this time.
@@ -987,8 +983,10 @@ describe('googleauth', () => {
987983 // the object instance is the same.
988984 // Test verifies invalid parameter tests, which requires cast to
989985 // any.
990- // eslint-disable-next-line @typescript-eslint/no-explicit-any
991- assert . strictEqual ( 'monkey' , ( result2 as any ) . specialTestBit ) ;
986+ assert . strictEqual (
987+ 'monkey' ,
988+ ( result2 as ReturnType < JSON [ 'parse' ] > ) . specialTestBit ,
989+ ) ;
992990 assert . strictEqual ( cachedCredential , result2 ) ;
993991
994992 // Now create a second GoogleAuth instance, and ask for
@@ -1000,8 +998,10 @@ describe('googleauth', () => {
1000998 // Make sure we get a new (non-cached) credential instance back.
1001999 // Test verifies invalid parameter tests, which requires cast to
10021000 // any.
1003- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1004- assert . strictEqual ( undefined , ( result3 as any ) . specialTestBit ) ;
1001+ assert . strictEqual (
1002+ undefined ,
1003+ ( result3 as ReturnType < JSON [ 'parse' ] > ) . specialTestBit ,
1004+ ) ;
10051005 assert . notStrictEqual ( cachedCredential , result3 ) ;
10061006 } ) ;
10071007
@@ -1467,8 +1467,9 @@ describe('googleauth', () => {
14671467 } ) ;
14681468
14691469 it ( 'should throw if getProjectId cannot find a projectId' , async ( ) => {
1470- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1471- sinon . stub ( auth as any , 'getDefaultServiceProjectId' ) . resolves ( ) ;
1470+ sinon
1471+ . stub ( auth as ReturnType < JSON [ 'parse' ] > , 'getDefaultServiceProjectId' )
1472+ . resolves ( ) ;
14721473 await assert . rejects (
14731474 auth . getProjectId ( ) ,
14741475 / U n a b l e t o d e t e c t a P r o j e c t I d i n t h e c u r r e n t e n v i r o n m e n t / ,
0 commit comments