Repository navigation
[AI Improvement] [Task] Fix restrict-plus-operands in 10 root-level src/*.ts files (slice 1) #11468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,6 +184,7 @@ function validateRequiredParameters(options: any): any { | |
| return { valid: true }; | ||
| } | ||
| const hashAlgo = options.hashAlgo.toUpperCase(); | ||
| const hashAlgoName = String(options.hashAlgo); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of introducing the temporary |
||
| let roundsNum; | ||
| switch (hashAlgo) { | ||
| case "HMAC_SHA512": | ||
|
|
@@ -192,7 +193,7 @@ function validateRequiredParameters(options: any): any { | |
| case "HMAC_MD5": | ||
| if (!options.hashKey || options.hashKey === "") { | ||
| throw new FirebaseError( | ||
| "Must provide hash key(base64 encoded) for hash algorithm " + options.hashAlgo, | ||
| "Must provide hash key(base64 encoded) for hash algorithm " + hashAlgoName, | ||
| ); | ||
| } | ||
| return { hashAlgo: hashAlgo, hashKey: options.hashKey, valid: true }; | ||
|
|
@@ -215,26 +216,26 @@ function validateRequiredParameters(options: any): any { | |
| roundsNum = parseInt(options.rounds, 10); | ||
| if (isNaN(roundsNum) || roundsNum < 0 || roundsNum > 120000) { | ||
| throw new FirebaseError( | ||
| "Must provide valid rounds(0..120000) for hash algorithm " + options.hashAlgo, | ||
| "Must provide valid rounds(0..120000) for hash algorithm " + hashAlgoName, | ||
| ); | ||
| } | ||
| return { hashAlgo: hashAlgo, rounds: options.rounds, valid: true }; | ||
| case "SCRYPT": { | ||
| if (!options.hashKey || options.hashKey === "") { | ||
| throw new FirebaseError( | ||
| "Must provide hash key(base64 encoded) for hash algorithm " + options.hashAlgo, | ||
| "Must provide hash key(base64 encoded) for hash algorithm " + hashAlgoName, | ||
| ); | ||
| } | ||
| roundsNum = parseInt(options.rounds, 10); | ||
| if (isNaN(roundsNum) || roundsNum <= 0 || roundsNum > 8) { | ||
| throw new FirebaseError( | ||
| "Must provide valid rounds(1..8) for hash algorithm " + options.hashAlgo, | ||
| "Must provide valid rounds(1..8) for hash algorithm " + hashAlgoName, | ||
| ); | ||
| } | ||
| const memCost = parseInt(options.memCost, 10); | ||
| if (isNaN(memCost) || memCost <= 0 || memCost > 14) { | ||
| throw new FirebaseError( | ||
| "Must provide valid memory cost(1..14) for hash algorithm " + options.hashAlgo, | ||
| "Must provide valid memory cost(1..14) for hash algorithm " + hashAlgoName, | ||
| ); | ||
| } | ||
| let saltSeparator = ""; | ||
|
|
@@ -321,7 +322,7 @@ export function validateUserJson(userJson: any): { error?: string } { | |
| } | ||
|
|
||
| async function sendRequest(projectId: string, userList: any[], hashOptions: any): Promise<void> { | ||
| logger.info("Starting importing " + userList.length + " account(s)."); | ||
| logger.info(`Starting importing ${userList.length} account(s).`); | ||
| const postData = genUploadAccountPostBody(projectId, userList, hashOptions); | ||
| return apiClient | ||
| .post<any, any>("/identitytoolkit/v3/relyingparty/uploadAccount", postData, { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping
userList.lengthinString()is redundant inside a template literal, as template literals automatically convert numbers to strings. Removing it simplifies the code.