Skip to content

Commit 1b283e3

Browse files
authored
chore: Add ESLint rule for curly braces, apply fix (#939)
* Add ESLint rule for curly braces, apply fix * Remove fix tag from package.json
1 parent 489d78a commit 1b283e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+731
-730
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = {
3636

3737
// Required checks
3838
'indent': ['error', 2],
39+
"object-curly-spacing": [2, "always"],
3940
'@typescript-eslint/explicit-function-return-type': [
4041
'error',
4142
{

src/auth/action-code-settings-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import * as validator from '../utils/validator';
18-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
18+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
1919

2020
/** Defines the ActionCodeSettings interface. */
2121
export interface ActionCodeSettings {

src/auth/auth-api-request.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616

1717
import * as validator from '../utils/validator';
1818

19-
import {deepCopy, deepExtend} from '../utils/deep-copy';
19+
import { deepCopy, deepExtend } from '../utils/deep-copy';
2020
import {
2121
UserIdentifier, isUidIdentifier, isEmailIdentifier, isPhoneIdentifier,
2222
isProviderIdentifier, UidIdentifier, EmailIdentifier, PhoneIdentifier,
2323
ProviderIdentifier,
2424
} from './identifier';
25-
import {FirebaseApp} from '../firebase-app';
26-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
25+
import { FirebaseApp } from '../firebase-app';
26+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
2727
import {
2828
ApiSettings, AuthorizedHttpClient, HttpRequestConfig, HttpError,
2929
} from '../utils/api-request';
30-
import {CreateRequest, UpdateRequest} from './user-record';
30+
import { CreateRequest, UpdateRequest } from './user-record';
3131
import {
3232
UserImportBuilder, UserImportOptions, UserImportRecord,
3333
UserImportResult, AuthFactorInfo, convertMultiFactorInfoToServerFormat,
3434
} from './user-import-builder';
3535
import * as utils from '../utils/index';
36-
import {ActionCodeSettings, ActionCodeSettingsBuilder} from './action-code-settings-builder';
36+
import { ActionCodeSettings, ActionCodeSettingsBuilder } from './action-code-settings-builder';
3737
import {
3838
SAMLConfig, OIDCConfig, OIDCConfigServerResponse, SAMLConfigServerResponse,
3939
OIDCConfigServerRequest, SAMLConfigServerRequest, AuthProviderConfig,
4040
OIDCUpdateAuthProviderRequest, SAMLUpdateAuthProviderRequest,
4141
} from './auth-config';
42-
import {Tenant, TenantOptions, TenantServerResponse} from './tenant';
42+
import { Tenant, TenantOptions, TenantServerResponse } from './tenant';
4343

4444

4545
/** Firebase Auth request header. */
@@ -195,7 +195,7 @@ class TenantAwareAuthResourceUrlBuilder extends AuthResourceUrlBuilder {
195195
public getUrl(api?: string, params?: object): Promise<string> {
196196
return super.getUrl(api, params)
197197
.then((url) => {
198-
return utils.formatString(url, {tenantId: this.tenantId});
198+
return utils.formatString(url, { tenantId: this.tenantId });
199199
});
200200
}
201201
}
@@ -1039,7 +1039,7 @@ export abstract class AbstractAuthRequestHandler {
10391039
*/
10401040
public getAccountInfoByIdentifiers(identifiers: UserIdentifier[]): Promise<object> {
10411041
if (identifiers.length === 0) {
1042-
return Promise.resolve({users: []});
1042+
return Promise.resolve({ users: [] });
10431043
} else if (identifiers.length > MAX_GET_ACCOUNTS_BATCH_SIZE) {
10441044
throw new FirebaseAuthError(
10451045
AuthClientErrorCode.MAXIMUM_USER_COUNT_EXCEEDED,
@@ -1428,7 +1428,7 @@ export abstract class AbstractAuthRequestHandler {
14281428
public getEmailActionLink(
14291429
requestType: string, email: string,
14301430
actionCodeSettings?: ActionCodeSettings): Promise<string> {
1431-
let request = {requestType, email, returnOobLink: true};
1431+
let request = { requestType, email, returnOobLink: true };
14321432
// ActionCodeSettings required for email link sign-in to determine the url where the sign-in will
14331433
// be completed.
14341434
if (typeof actionCodeSettings === 'undefined' && requestType === 'EMAIL_SIGNIN') {
@@ -1464,7 +1464,7 @@ export abstract class AbstractAuthRequestHandler {
14641464
if (!OIDCConfig.isProviderId(providerId)) {
14651465
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_PROVIDER_ID));
14661466
}
1467-
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), GET_OAUTH_IDP_CONFIG, {}, {providerId});
1467+
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), GET_OAUTH_IDP_CONFIG, {}, { providerId });
14681468
}
14691469

14701470
/**
@@ -1510,7 +1510,7 @@ export abstract class AbstractAuthRequestHandler {
15101510
if (!OIDCConfig.isProviderId(providerId)) {
15111511
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_PROVIDER_ID));
15121512
}
1513-
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), DELETE_OAUTH_IDP_CONFIG, {}, {providerId})
1513+
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), DELETE_OAUTH_IDP_CONFIG, {}, { providerId })
15141514
.then(() => {
15151515
// Return nothing.
15161516
});
@@ -1532,7 +1532,7 @@ export abstract class AbstractAuthRequestHandler {
15321532
return Promise.reject(e);
15331533
}
15341534
const providerId = options.providerId;
1535-
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), CREATE_OAUTH_IDP_CONFIG, request, {providerId})
1535+
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), CREATE_OAUTH_IDP_CONFIG, request, { providerId })
15361536
.then((response: any) => {
15371537
if (!OIDCConfig.getProviderIdFromResourceName(response.name)) {
15381538
throw new FirebaseAuthError(
@@ -1565,7 +1565,7 @@ export abstract class AbstractAuthRequestHandler {
15651565
}
15661566
const updateMask = utils.generateUpdateMask(request);
15671567
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), UPDATE_OAUTH_IDP_CONFIG, request,
1568-
{providerId, updateMask: updateMask.join(',')})
1568+
{ providerId, updateMask: updateMask.join(',') })
15691569
.then((response: any) => {
15701570
if (!OIDCConfig.getProviderIdFromResourceName(response.name)) {
15711571
throw new FirebaseAuthError(
@@ -1586,7 +1586,7 @@ export abstract class AbstractAuthRequestHandler {
15861586
if (!SAMLConfig.isProviderId(providerId)) {
15871587
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_PROVIDER_ID));
15881588
}
1589-
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), GET_INBOUND_SAML_CONFIG, {}, {providerId});
1589+
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), GET_INBOUND_SAML_CONFIG, {}, { providerId });
15901590
}
15911591

15921592
/**
@@ -1632,7 +1632,7 @@ export abstract class AbstractAuthRequestHandler {
16321632
if (!SAMLConfig.isProviderId(providerId)) {
16331633
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_PROVIDER_ID));
16341634
}
1635-
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), DELETE_INBOUND_SAML_CONFIG, {}, {providerId})
1635+
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), DELETE_INBOUND_SAML_CONFIG, {}, { providerId })
16361636
.then(() => {
16371637
// Return nothing.
16381638
});
@@ -1655,7 +1655,7 @@ export abstract class AbstractAuthRequestHandler {
16551655
}
16561656
const providerId = options.providerId;
16571657
return this.invokeRequestHandler(
1658-
this.getProjectConfigUrlBuilder(), CREATE_INBOUND_SAML_CONFIG, request, {providerId})
1658+
this.getProjectConfigUrlBuilder(), CREATE_INBOUND_SAML_CONFIG, request, { providerId })
16591659
.then((response: any) => {
16601660
if (!SAMLConfig.getProviderIdFromResourceName(response.name)) {
16611661
throw new FirebaseAuthError(
@@ -1688,7 +1688,7 @@ export abstract class AbstractAuthRequestHandler {
16881688
}
16891689
const updateMask = utils.generateUpdateMask(request);
16901690
return this.invokeRequestHandler(this.getProjectConfigUrlBuilder(), UPDATE_INBOUND_SAML_CONFIG, request,
1691-
{providerId, updateMask: updateMask.join(',')})
1691+
{ providerId, updateMask: updateMask.join(',') })
16921692
.then((response: any) => {
16931693
if (!SAMLConfig.getProviderIdFromResourceName(response.name)) {
16941694
throw new FirebaseAuthError(
@@ -1893,7 +1893,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
18931893
if (!validator.isNonEmptyString(tenantId)) {
18941894
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_TENANT_ID));
18951895
}
1896-
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, GET_TENANT, {}, {tenantId})
1896+
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, GET_TENANT, {}, { tenantId })
18971897
.then((response: any) => {
18981898
return response as TenantServerResponse;
18991899
});
@@ -1943,7 +1943,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
19431943
if (!validator.isNonEmptyString(tenantId)) {
19441944
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_TENANT_ID));
19451945
}
1946-
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, {tenantId})
1946+
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, { tenantId })
19471947
.then(() => {
19481948
// Return nothing.
19491949
});
@@ -1984,7 +1984,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
19841984
const request = Tenant.buildServerRequest(tenantOptions, false);
19851985
const updateMask = utils.generateUpdateMask(request);
19861986
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, UPDATE_TENANT, request,
1987-
{tenantId, updateMask: updateMask.join(',')})
1987+
{ tenantId, updateMask: updateMask.join(',') })
19881988
.then((response: any) => {
19891989
return response as TenantServerResponse;
19901990
});

src/auth/auth-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
import * as validator from '../utils/validator';
18-
import {deepCopy} from '../utils/deep-copy';
19-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
18+
import { deepCopy } from '../utils/deep-copy';
19+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
2020

2121

2222
/** The filter interface used for listing provider configurations. */
@@ -306,7 +306,7 @@ export class SAMLConfig implements SAMLAuthProviderConfig {
306306
};
307307
if (options.x509Certificates) {
308308
for (const cert of (options.x509Certificates || [])) {
309-
request.idpConfig!.idpCertificates!.push({x509Certificate: cert});
309+
request.idpConfig!.idpCertificates!.push({ x509Certificate: cert });
310310
}
311311
}
312312
}

src/auth/auth.ts

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

17-
import {UserRecord, CreateRequest, UpdateRequest} from './user-record';
17+
import { UserRecord, CreateRequest, UpdateRequest } from './user-record';
1818
import {
1919
UserIdentifier, isUidIdentifier, isEmailIdentifier, isPhoneIdentifier, isProviderIdentifier,
2020
} from './identifier';
21-
import {FirebaseApp} from '../firebase-app';
22-
import {FirebaseTokenGenerator, cryptoSignerFromApp} from './token-generator';
21+
import { FirebaseApp } from '../firebase-app';
22+
import { FirebaseTokenGenerator, cryptoSignerFromApp } from './token-generator';
2323
import {
2424
AbstractAuthRequestHandler, AuthRequestHandler, TenantAwareAuthRequestHandler,
2525
} from './auth-api-request';
26-
import {AuthClientErrorCode, FirebaseAuthError, ErrorInfo, FirebaseArrayIndexError} from '../utils/error';
27-
import {FirebaseServiceInterface, FirebaseServiceInternalsInterface} from '../firebase-service';
26+
import { AuthClientErrorCode, FirebaseAuthError, ErrorInfo, FirebaseArrayIndexError } from '../utils/error';
27+
import { FirebaseServiceInterface, FirebaseServiceInternalsInterface } from '../firebase-service';
2828
import {
2929
UserImportOptions, UserImportRecord, UserImportResult,
3030
} from './user-import-builder';
3131

3232
import * as utils from '../utils/index';
3333
import * as validator from '../utils/validator';
3434
import { FirebaseTokenVerifier, createSessionCookieVerifier, createIdTokenVerifier } from './token-verifier';
35-
import {ActionCodeSettings} from './action-code-settings-builder';
35+
import { ActionCodeSettings } from './action-code-settings-builder';
3636
import {
3737
AuthProviderConfig, AuthProviderConfigFilter, ListProviderConfigResults, UpdateAuthProviderRequest,
3838
SAMLConfig, OIDCConfig, OIDCConfigServerResponse, SAMLConfigServerResponse,
3939
} from './auth-config';
40-
import {TenantManager} from './tenant-manager';
40+
import { TenantManager } from './tenant-manager';
4141

4242

4343
/**

src/auth/credential.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import fs = require('fs');
1919
import os = require('os');
2020
import path = require('path');
2121

22-
import {AppErrorCodes, FirebaseAppError} from '../utils/error';
23-
import {HttpClient, HttpRequestConfig, HttpError, HttpResponse} from '../utils/api-request';
24-
import {Agent} from 'http';
22+
import { AppErrorCodes, FirebaseAppError } from '../utils/error';
23+
import { HttpClient, HttpRequestConfig, HttpError, HttpResponse } from '../utils/api-request';
24+
import { Agent } from 'http';
2525
import * as util from '../utils/validator';
2626

2727
const GOOGLE_TOKEN_AUDIENCE = 'https://accounts.google.com/o/oauth2/token';

src/auth/tenant-manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {AuthRequestHandler} from './auth-api-request';
18-
import {FirebaseApp} from '../firebase-app';
19-
import {TenantAwareAuth} from './auth';
17+
import { AuthRequestHandler } from './auth-api-request';
18+
import { FirebaseApp } from '../firebase-app';
19+
import { TenantAwareAuth } from './auth';
2020
import {
2121
Tenant, TenantServerResponse, ListTenantsResult, TenantOptions,
2222
} from './tenant';
23-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
23+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
2424
import * as validator from '../utils/validator';
2525

2626
/**

src/auth/tenant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import * as validator from '../utils/validator';
18-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
18+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
1919
import {
2020
EmailSignInConfig, EmailSignInConfigServerRequest, EmailSignInProviderConfig,
2121
} from './auth-config';

src/auth/token-generator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
import { FirebaseApp } from '../firebase-app';
18-
import {ServiceAccountCredential} from './credential';
19-
import {AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
18+
import { ServiceAccountCredential } from './credential';
19+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
2020
import { AuthorizedHttpClient, HttpError, HttpRequestConfig, HttpClient } from '../utils/api-request';
2121

2222
import * as validator from '../utils/validator';
@@ -152,7 +152,7 @@ export class IAMSigner implements CryptoSigner {
152152
const request: HttpRequestConfig = {
153153
method: 'POST',
154154
url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${serviceAccount}:signBlob`,
155-
data: {payload: buffer.toString('base64')},
155+
data: { payload: buffer.toString('base64') },
156156
};
157157
return this.httpClient.send(request);
158158
}).then((response: any) => {

src/auth/token-verifier.ts

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

17-
import {AuthClientErrorCode, FirebaseAuthError, ErrorInfo} from '../utils/error';
17+
import { AuthClientErrorCode, FirebaseAuthError, ErrorInfo } from '../utils/error';
1818

1919
import * as util from '../utils/index';
2020
import * as validator from '../utils/validator';

src/auth/user-import-builder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {deepCopy, deepExtend} from '../utils/deep-copy';
17+
import { deepCopy, deepExtend } from '../utils/deep-copy';
1818
import * as utils from '../utils';
1919
import * as validator from '../utils/validator';
20-
import {AuthClientErrorCode, FirebaseAuthError, FirebaseArrayIndexError} from '../utils/error';
20+
import { AuthClientErrorCode, FirebaseAuthError, FirebaseArrayIndexError } from '../utils/error';
2121

2222
/** Firebase Auth supported hashing algorithms for import operations. */
2323
export type HashAlgorithmType = 'SCRYPT' | 'STANDARD_SCRYPT' | 'HMAC_SHA512' |
@@ -333,7 +333,7 @@ export class UserImportBuilder {
333333
const users = this.validatedUsers.map((user) => {
334334
return deepCopy(user);
335335
});
336-
return deepExtend({users}, deepCopy(this.validatedOptions)) as UploadAccountRequest;
336+
return deepExtend({ users }, deepCopy(this.validatedOptions)) as UploadAccountRequest;
337337
}
338338

339339
/**

src/auth/user-record.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {deepCopy} from '../utils/deep-copy';
18-
import {isNonNullObject} from '../utils/validator';
17+
import { deepCopy } from '../utils/deep-copy';
18+
import { isNonNullObject } from '../utils/validator';
1919
import * as utils from '../utils';
20-
import {AuthClientErrorCode, FirebaseAuthError} from '../utils/error';
20+
import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
2121

2222
/**
2323
* 'REDACTED', encoded as a base64 string.

src/database/database.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {URL} from 'url';
1+
import { URL } from 'url';
22
import * as path from 'path';
33

4-
import {FirebaseApp} from '../firebase-app';
5-
import {FirebaseDatabaseError, AppErrorCodes, FirebaseAppError} from '../utils/error';
6-
import {FirebaseServiceInterface, FirebaseServiceInternalsInterface} from '../firebase-service';
7-
import {Database} from '@firebase/database';
4+
import { FirebaseApp } from '../firebase-app';
5+
import { FirebaseDatabaseError, AppErrorCodes, FirebaseAppError } from '../utils/error';
6+
import { FirebaseServiceInterface, FirebaseServiceInternalsInterface } from '../firebase-service';
7+
import { Database } from '@firebase/database';
88

99
import * as validator from '../utils/validator';
1010
import { AuthorizedHttpClient, HttpRequestConfig, HttpError } from '../utils/api-request';
@@ -160,7 +160,7 @@ class DatabaseRulesClient {
160160
const req: HttpRequestConfig = {
161161
method: 'GET',
162162
url: this.dbUrl,
163-
data: {format: 'strict'},
163+
data: { format: 'strict' },
164164
};
165165
return this.httpClient.send(req)
166166
.then((resp) => {

src/default-namespace.ts

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

17-
import {FirebaseNamespace} from './firebase-namespace';
17+
import { FirebaseNamespace } from './firebase-namespace';
1818

1919
const firebaseAdmin = new FirebaseNamespace();
2020

0 commit comments

Comments
 (0)