Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ module.exports = {
"@typescript-eslint/no-unsafe-call": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-member-access": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-return": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-use-before-define": ["warn", { functions: false, typedefs: false }], // TODO(bkendall): change to error.
"@typescript-eslint/no-var-requires": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/prefer-regexp-exec": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/restrict-plus-operands": "warn", // TODO(bkendall): remove, allow to error.
Expand All @@ -78,7 +77,6 @@ module.exports = {
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-includes": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
Expand Down
1 change: 0 additions & 1 deletion src/ensureApiEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* Attempt to enable an API on the specified project (just once).
*
* If enabling an API for a customer, prefer `ensure` which will check for the
* API first, which is a seperate permission than enabling.

Check warning on line 60 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Expected only 0 line after block description
*
* @param projectId The project in which to enable the API.
* @param apiName The name of the API e.g. `someapi.googleapis.com`.
Expand All @@ -73,8 +73,8 @@
},
);
cacheEnabledAPI(projectId, apiName);
} catch (err: any) {

Check warning on line 76 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
if (isBillingError(err)) {

Check warning on line 77 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe argument of type `any` assigned to a parameter of type `{ context?: { body?: { error?: { details?: { type: string; reason?: string | undefined; violations?: { type: string; }[] | undefined; }[] | undefined; } | undefined; } | undefined; } | undefined; }`
throw new FirebaseError(`Your project ${bold(
projectId,
)} must be on the Blaze (pay-as-you-go) plan to complete this command. Required API ${bold(
Expand All @@ -82,7 +82,7 @@
)} can't be enabled until the upgrade is complete. To upgrade, visit the following URL:

https://console.firebase.google.com/project/${projectId}/usage/details`);
} else if (isPermissionError(err)) {

Check warning on line 85 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe argument of type `any` assigned to a parameter of type `{ context?: { body?: { error?: { status?: string | undefined; } | undefined; } | undefined; } | undefined; }`
const apiPermissionDeniedRegex = new RegExp(
/Permission denied to enable service \[([.a-zA-Z]+)\]/,
);
Expand Down Expand Up @@ -118,7 +118,6 @@
pollRetries = 0,
): Promise<void> {
if (pollRetries > POLL_SETTINGS.pollsBeforeRetry) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return enableApiWithRetries(projectId, apiName, prefix, silent, enablementRetries + 1);
}

Expand Down Expand Up @@ -155,7 +154,7 @@
}

/**
* Check if an API is enabled on a project, try to enable it if not with polling and retries.

Check warning on line 157 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Expected only 0 line after block description
*
* @param projectId The project on which to check enablement.
* @param apiUri The name of the API e.g. `someapi.googleapis.com`.
Expand All @@ -182,7 +181,7 @@
return enableApiWithRetries(projectId, hostname, prefix, silent);
}

export async function bestEffortEnsure(

Check warning on line 184 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing JSDoc comment
projectId: string,
apiUri: string,
prefix: string,
Expand All @@ -190,7 +189,7 @@
): Promise<void> {
try {
await ensure(projectId, apiUri, prefix, silent);
} catch (err: any) {

Check warning on line 192 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
logger.debug(
`Unable to check that ${apiUri} is enabled on ${projectId}. Calls to it will fail if it is not enabled`,
);
Expand All @@ -199,7 +198,7 @@

/**
* Returns a link to enable an API on a project in Cloud console. This can be used instead of ensure
* in contexts where automatically enabling APIs is not desirable (ie emulator commands).

Check warning on line 201 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Expected only 0 line after block description
*
* @param projectId The project to generate an API enablement link for
* @param apiName The name of the API e.g. `someapi.googleapis.com`.
Expand Down Expand Up @@ -228,7 +227,7 @@
return !!cache?.[projectId]?.[apiName];
}

function cacheEnabledAPI(projectId: string, apiName: string) {

Check warning on line 230 in src/ensureApiEnabled.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
const cache = (configstore.get(API_ENABLEMENT_CACHE_KEY) || {}) as Record<
string,
Record<string, true>
Expand Down
Loading