Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
rules: {
"jsdoc/newline-after-description": "off",
"jsdoc/require-jsdoc": ["warn", { publicOnly: true }],
"no-constant-condition": ["error", { checkLoops: false }], // Allow intentional `while (true)` and `do ... while (true)` loops.
"no-restricted-globals": ["error", "name", "length"],
"prefer-arrow-callback": "error",
"prettier/prettier": "error",
Expand Down Expand Up @@ -67,8 +68,6 @@ module.exports = {
"@typescript-eslint/prefer-regexp-exec": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/restrict-plus-operands": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/restrict-template-expressions": "warn", // TODO(bkendall): remove, allow to error.
"no-constant-condition": "warn", // TODO(bkendall): remove, allow to error.
"no-fallthrough": "warn", // TODO(bkendall): remove, allow to error.
},
},
{
Expand Down
1 change: 0 additions & 1 deletion src/deploy/functions/containerCleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,24 @@
const INITIAL_BACKOFF = 100;
const TIMEOUT_MS = 10_000;
let retry = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
try {
const timeout = new Promise<Return>((resolve, reject) => {
setTimeout(() => reject(new Error("Timeout")), TIMEOUT_MS);
});
return await Promise.race([func(), timeout]);
} catch (err: any) {

Check warning on line 29 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
logger.debug("Failed docker command with error ", err);
retry += 1;
if (retry >= MAX_RETRIES) {
throw new FirebaseError("Failed to clean up artifacts", { original: err });

Check warning on line 33 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value
}
await sleep(Math.pow(INITIAL_BACKOFF, retry - 1));
}
}
}

export async function cleanupBuildImages(

Check warning on line 40 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing JSDoc comment
haveFunctions: backend.Endpoint[],
deletedFunctions: backend.Endpoint[],
cleaners: { gcr?: ContainerRegistryCleaner; ar?: ArtifactRegistryCleaner } = {},
Expand All @@ -46,7 +45,7 @@
utils.logBullet(clc.bold(clc.cyan("functions: ")) + "cleaning up build files...");
const failedDomains: Set<string> = new Set();
const cleanup: Array<Promise<void>> = [];
const arCleaner = cleaners.ar || new ArtifactRegistryCleaner();

Check warning on line 48 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

'ArtifactRegistryCleaner' was used before it was defined
// Whether the container was stored in GCR or AR is up to a server-side experiment;
// clean up both, just in case.
// TODO: remove GCR path once the experiment is rollack-safe.
Expand All @@ -54,7 +53,7 @@
...haveFunctions.map(async (func) => {
try {
await arCleaner.cleanupFunction(func);
} catch (err: any) {

Check warning on line 56 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
const path = `${func.project}/${func.region}/gcf-artifacts`;
failedDomains.add(`https://console.cloud.google.com/artifacts/docker/${path}`);
}
Expand All @@ -64,18 +63,18 @@
...deletedFunctions.map(async (func) => {
try {
await arCleaner.cleanupFunction(func);
} catch (err: any) {

Check warning on line 66 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
const path = `${func.project}/${func.region}/gcf-artifacts`;
failedDomains.add(`https://console.cloud.google.com/artifacts/docker/${path}`);
}
}),
);
const gcrCleaner = cleaners.gcr || new ContainerRegistryCleaner();

Check warning on line 72 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

'ContainerRegistryCleaner' was used before it was defined
cleanup.push(
...[...haveFunctions, ...deletedFunctions].map(async (func) => {
try {
await gcrCleaner.cleanupFunction(func);
} catch (err: any) {

Check warning on line 77 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
const path = `${func.project}/${docker.GCR_SUBDOMAIN_MAPPING[func.region]}/gcf`;
failedDomains.add(`https://console.cloud.google.com/gcr/images/${path}`);
}
Expand All @@ -88,7 +87,7 @@
message +=
"You can attempt to delete these images by redeploying or you can delete them manually at";
if (failedDomains.size === 1) {
message += " " + failedDomains.values().next().value;

Check warning on line 90 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal
} else {
message += [...failedDomains].map((domain) => "\n\t" + domain).join("");
}
Expand Down Expand Up @@ -164,7 +163,7 @@
let op: artifactregistry.Operation;
try {
op = await artifactregistry.deletePackage(ArtifactRegistryCleaner.packagePath(func));
} catch (err: any) {

Check warning on line 166 in src/deploy/functions/containerCleaner.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
// The client was not enrolled in the AR experimenet and the package
// was missing
if (err.status === 404) {
Expand Down
1 change: 0 additions & 1 deletion src/deploy/functions/runtimes/node/versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING =
*/
export function findModuleVersion(name: string, resolvedPath: string): string | undefined {
let searchPath = path.dirname(resolvedPath);
// eslint-disable-next-line no-constant-condition
while (true) {
if (searchPath === "/" || path.basename(searchPath) === "node_modules") {
logger.debug(
Expand Down
3 changes: 1 addition & 2 deletions src/init/features/hosting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export async function askQuestions(setup: Setup, config: Config, options: Option
case "nuxt":
case "nuxt2":
case "express":
// "svelekit" should not be removed unless it's confirmed to not cause breakages.
case "svelekit":
case "svelekit": // "svelekit" should not be removed unless it's confirmed to not cause breakages.
case "sveltekit": {
logger.info();
const useAppHosting = await confirm({
Expand Down
Loading