Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
56ef6d6
Promote prefer-promise-reject-errors to error and fix violations
joehan Sep 23, 2026
ccc6e27
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Sep 25, 2026
32e7b59
fix: resolve CI failures on PR #11145
joehan Sep 25, 2026
ebf41ca
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Sep 30, 2026
696801b
fix: address PR review feedback on PR #11145
joehan Oct 1, 2026
b6166fb
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 1, 2026
67def9e
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 2, 2026
73e6c7f
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 2, 2026
3272413
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 5, 2026
9304f7f
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 6, 2026
bd5ccb4
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 6, 2026
8d44b98
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 6, 2026
41d12e7
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 6, 2026
4d34bab
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 7, 2026
163180c
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 7, 2026
adf2edd
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 7, 2026
c22d527
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 8, 2026
de7180a
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 8, 2026
7a41f3b
Merge branch 'main' into ai-improve-565074829-task-fix-prefer-promise…
joehan Oct 9, 2026
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
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = {
},
],
"no-useless-escape": "warn", // TODO(bkendall): remove, allow to error.
"prefer-promise-reject-errors": "warn", // TODO(bkendall): remove, allow to error.
},
overrides: [
{
Expand Down
12 changes: 9 additions & 3 deletions src/emulator/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
* specify an emulator address.
*/
export function printNoticeIfEmulated(
options: any,

Check warning on line 86 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
emulator: Emulators.DATABASE | Emulators.FIRESTORE,
): void {
if (emulator !== Emulators.DATABASE && emulator !== Emulators.FIRESTORE) {
Expand Down Expand Up @@ -111,7 +111,7 @@
* an emulator port that the command actually talks to production.
*/
export async function warnEmulatorNotSupported(
options: any,

Check warning on line 114 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
emulator: Emulators.DATABASE | Emulators.FIRESTORE,
): Promise<void> {
if (emulator !== Emulators.DATABASE && emulator !== Emulators.FIRESTORE) {
Expand All @@ -138,8 +138,8 @@
}
}

export async function errorMissingProject(options: any): Promise<void> {

Check warning on line 141 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type

Check warning on line 141 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing JSDoc comment
if (!options.project) {

Check warning on line 142 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .project on an `any` value
throw new FirebaseError(
"Project is not defined. Either use `--project` or use `firebase use` to set your active project.",
);
Expand All @@ -150,12 +150,12 @@
* Utility method to be inserted in the "before" function for a command that
* uses the emulator suite.
*/
export async function beforeEmulatorCommand(options: any): Promise<any> {

Check warning on line 153 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type

Check warning on line 153 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
const optionsWithDefaultConfig = {

Check warning on line 154 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value
...options,
config: DEFAULT_CONFIG,
};
const optionsWithConfig = options.config ? options : optionsWithDefaultConfig;

Check warning on line 158 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .config on an `any` value

Check warning on line 158 in src/emulator/commandUtils.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value

// We want to be able to run most emulators even in the absence of
// firebase.json. For Functions and Hosting we require the JSON file since the
Expand Down Expand Up @@ -336,7 +336,7 @@
res();
} catch (e: unknown) {
logger.debug(e as any);
rej();
rej(getError(e));
}
};
}
Expand Down Expand Up @@ -394,7 +394,11 @@
return new Promise((resolve, reject) => {
proc.on("error", (err: any) => {
utils.logWarning(`There was an error running the script: ${JSON.stringify(err)}`);
reject();
reject(
new FirebaseError("There was an error running the script.", {
original: err instanceof Error ? err : undefined,
}),
);
Comment thread
joehan marked this conversation as resolved.
});

// Due to the async nature of the node child_process library, sometimes
Expand All @@ -406,7 +410,9 @@
proc.once("exit", (code, signal) => {
if (signal) {
utils.logWarning(`Script exited with signal: ${signal}`);
setTimeout(reject, exitDelayMs);
setTimeout(() => {
reject(new FirebaseError(`Script exited with signal: ${signal}`));
}, exitDelayMs);
return;
}

Expand Down
6 changes: 5 additions & 1 deletion src/emulator/dataconnectEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ export class DataConnectEmulator implements EmulatorInstance {
"dataconnect",
"Could not connect to SQL Connect emulator. Check dataconnect-debug.log for more details.",
);
return Promise.reject();
return Promise.reject(
new FirebaseError(
"Could not connect to SQL Connect emulator. Check dataconnect-debug.log for more details.",
),
);
}
return Promise.resolve();
}
Expand Down
4 changes: 3 additions & 1 deletion src/emulator/eventarcEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export class EventarcEmulator implements EmulatorInstance {
async triggerEventFunction(channel: string, event: CloudEvent<any>): Promise<void[]> {
if (!EmulatorRegistry.isRunning(Emulators.FUNCTIONS)) {
this.logger.log("INFO", "Functions emulator not found. This should not happen.");
return Promise.reject();
return Promise.reject(
new FirebaseError("Functions emulator not found. This should not happen."),
);
}
const key = `${event.type}-${channel}`;
const triggers = this.events[key] || [];
Expand Down
2 changes: 1 addition & 1 deletion src/emulator/workQueue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe("WorkQueue", () => {
let hasRun1 = false;
const work1 = () => {
hasRun1 = true;
return Promise.reject();
return Promise.reject(new Error("job failed"));
};

let hasRun2 = false;
Expand Down
10 changes: 8 additions & 2 deletions src/profileReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,14 @@ export class ProfileReport {
}
}
});
rl.on("error", () => {
reject();
rl.on("error", (err) => {
reject(
err instanceof Error
? err
: new FirebaseError("There was an error creating the report.", {
original: err as any,
}),
);
});
Comment thread
joehan marked this conversation as resolved.
outStream.on("error", () => {
errored = true;
Expand Down
2 changes: 1 addition & 1 deletion src/throttler/throttler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const throttlerTest = (ThrottlerConstructor: ThrottlerConstructorType): void =>
if (count > 2) {
return Promise.resolve();
}
return Promise.reject();
return Promise.reject(new Error("retry"));
};

const q = new ThrottlerConstructor({
Expand Down
2 changes: 2 additions & 0 deletions src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ describe("utils", () => {
it("should settle all promises", async () => {
const result = await utils.promiseAllSettled([
Promise.resolve("foo"),
// eslint-disable-next-line prefer-promise-reject-errors
Promise.reject("bar"),
Promise.resolve("baz"),
]);
Expand Down Expand Up @@ -322,6 +323,7 @@ describe("utils", () => {

it("waits for all settled", async () => {
// Intetionally failing with a non-error to make matching easier
// eslint-disable-next-line prefer-promise-reject-errors
const reject = Promise.reject("fail fast");
const resolve = new Promise((res) => {
setTimeout(() => res(42), 20);
Expand Down
Loading