Skip to content

Commit 312c41a

Browse files
authored
Remove unused local variables. (#659)
Also add option to tsconfig.json to prevent re-occurrences.
1 parent 16a2c12 commit 312c41a

19 files changed

+14
-44
lines changed

src/auth/auth-api-request.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ import {
3737
import {Tenant, TenantOptions, TenantServerResponse} from './tenant';
3838

3939

40-
/** Firebase Auth backend host. */
41-
const FIREBASE_AUTH_HOST = 'www.googleapis.com';
42-
/** Firebase Auth backend port number. */
43-
const FIREBASE_AUTH_PORT = 443;
44-
/** Firebase Auth backend path. */
45-
const FIREBASE_AUTH_PATH = '/identitytoolkit/v3/relyingparty/';
4640
/** Firebase Auth request header. */
4741
const FIREBASE_AUTH_HEADER = {
4842
'X-Client-Version': 'Node/Admin/<XXX_SDK_VERSION_XXX>',
@@ -1491,7 +1485,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
14911485
* @param {FirebaseApp} app The app used to fetch access tokens to sign API requests.
14921486
* @constructor.
14931487
*/
1494-
constructor(private readonly app: FirebaseApp) {
1488+
constructor(app: FirebaseApp) {
14951489
super(app);
14961490
this.tenantMgmtResourceBuilder = new AuthResourceUrlBuilder(utils.getProjectId(app), 'v2beta1');
14971491
}

src/auth/auth-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as utils from '../utils';
1817
import * as validator from '../utils/validator';
1918
import {deepCopy} from '../utils/deep-copy';
2019
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';

src/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ export class TenantAwareAuth extends BaseAuth<TenantAwareAuthRequestHandler> {
616616
* @param tenantId The corresponding tenant ID.
617617
* @constructor
618618
*/
619-
constructor(private readonly app: FirebaseApp, tenantId: string) {
619+
constructor(app: FirebaseApp, tenantId: string) {
620620
super(
621621
utils.getProjectId(app),
622622
new TenantAwareAuthRequestHandler(app, tenantId),

src/auth/tenant.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as utils from '../utils';
1817
import * as validator from '../utils/validator';
1918
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
2019
import {

src/instance-id/instance-id-request.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import * as validator from '../utils/validator';
2424

2525
/** Firebase IID backend host. */
2626
const FIREBASE_IID_HOST = 'console.firebase.google.com';
27-
/** Firebase IID backend port number. */
28-
const FIREBASE_IID_PORT = 443;
2927
/** Firebase IID backend path. */
3028
const FIREBASE_IID_PATH = '/v1/';
3129
/** Firebase IID request timeout duration in milliseconds. */
@@ -49,7 +47,6 @@ const ERROR_CODES: {[key: number]: string} = {
4947
export class FirebaseInstanceIdRequestHandler {
5048

5149
private readonly host: string = FIREBASE_IID_HOST;
52-
private readonly port: number = FIREBASE_IID_PORT;
5350
private readonly timeout: number = FIREBASE_IID_TIMEOUT;
5451
private readonly httpClient: AuthorizedHttpClient;
5552
private readonly path: string;

src/messaging/messaging.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
import {FirebaseMessagingRequestHandler} from './messaging-api-request';
2727
import {FirebaseServiceInterface, FirebaseServiceInternalsInterface} from '../firebase-service';
2828
import {
29-
ErrorInfo, FirebaseArrayIndexError, MessagingClientErrorCode, FirebaseMessagingError,
29+
ErrorInfo, MessagingClientErrorCode, FirebaseMessagingError,
3030
} from '../utils/error';
3131

3232
import * as utils from '../utils';
@@ -160,7 +160,6 @@ function mapRawResponseToTopicManagementResponse(response: object): MessagingTop
160160
errors: [],
161161
};
162162

163-
const errors: FirebaseArrayIndexError[] = [];
164163
if ('results' in response) {
165164
(response as any).results.forEach((tokenManagementResult: any, index: number) => {
166165
// Map the FCM server's error strings to actual error objects.

test/integration/database.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import * as admin from '../../lib/index';
1818
import * as chai from 'chai';
1919
import * as chaiAsPromised from 'chai-as-promised';
20-
import url = require('url');
2120
import {defaultApp, nullApp, nonNullApp, cmdArgs, databaseUrl} from './setup';
2221

2322
/* tslint:disable:no-var-requires */
@@ -172,11 +171,14 @@ describe('admin.database', () => {
172171
});
173172
});
174173

174+
// Check for type compilation. This method is not invoked by any
175+
// tests. But it will trigger a TS compilation failure if the RTDB
176+
// typings were not loaded correctly.
177+
//
178+
// @ts-ignore: purposely unused method.
175179
function addValueEventListener(
176180
db: admin.database.Database,
177181
callback: (s: admin.database.DataSnapshot) => any) {
178-
// Check for type compilation. This method is not invoked by any tests. But it will
179-
// trigger a TS compilation failure if the RTDB typings were not loaded correctly.
180182
const eventType: admin.database.EventType = 'value';
181183
db.ref().on(eventType, callback);
182184
}

test/integration/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import fs = require('fs');
1919
import minimist = require('minimist');
2020
import path = require('path');
2121
import {random} from 'lodash';
22-
import { Credential, CertCredential, GoogleOAuthAccessToken, Certificate } from '../../src/auth/credential';
22+
import { Credential, GoogleOAuthAccessToken, Certificate } from '../../src/auth/credential';
2323

2424
/* tslint:disable:no-var-requires */
2525
const chalk = require('chalk');

test/unit/auth/action-code-settings-builder.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import * as chai from 'chai';
1919
import * as sinonChai from 'sinon-chai';
2020
import * as chaiAsPromised from 'chai-as-promised';
2121

22-
import {deepCopy} from '../../../src/utils/deep-copy';
2322
import {ActionCodeSettingsBuilder} from '../../../src/auth/action-code-settings-builder';
2423
import {AuthClientErrorCode} from '../../../src/utils/error';
2524

test/unit/auth/auth-api-request.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,7 +2405,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
24052405
);
24062406

24072407
const requestHandler = handler.init(mockApp);
2408-
return requestHandler.getEmailActionLink('EMAIL_SIGNIN', email)
2408+
return requestHandler.getEmailActionLink(invalidRequestType, email)
24092409
.then((resp) => {
24102410
throw new Error('Unexpected success');
24112411
}, (error) => {
@@ -3780,7 +3780,6 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
37803780
describe('createTenant', () => {
37813781
const path = '/v2beta1/projects/project_id/tenants';
37823782
const postMethod = 'POST';
3783-
const tenantId = 'tenant-id';
37843783
const tenantOptions: TenantOptions = {
37853784
displayName: 'TENANT-DISPLAY-NAME',
37863785
emailSignInConfig: {

0 commit comments

Comments
 (0)