Conversation
There was a problem hiding this comment.
Code Review
This pull request configures the ESLint rule prefer-promise-reject-errors to trigger an error instead of a warning, and updates various emulator and utility files to reject promises with proper Error or FirebaseError instances. Feedback on the changes suggests avoiding the as any type assertion in src/profileReport.ts by wrapping non-Error values in a new Error object, and utilizing the existing getError utility in src/emulator/commandUtils.ts to simplify error handling.
| "no-prototype-builtins": "warn", // TODO(bkendall): remove, allow to error. | ||
| "no-useless-escape": "warn", // TODO(bkendall): remove, allow to error. | ||
| "prefer-promise-reject-errors": "warn", // TODO(bkendall): remove, allow to error. | ||
| "prefer-promise-reject-errors": "error", |
There was a problem hiding this comment.
Just remove this entirely and fall back to the default value
There was a problem hiding this comment.
Removed prefer-promise-reject-errors completely from .eslintrc.js to fall back to the preset default ("error") in commit 696801bbc. Verified with npm run test:compile, npx mocha, and full-repo npm run lint:quiet.
Description
This PR resolves all remaining violations of the ESLint
prefer-promise-reject-errorsrule and promotes the rule from"warn"to"error"in.eslintrc.js.Changes Made
src/emulator/commandUtils.ts: PassgetError(e)inprocessKillSignal, and useFirebaseErrorwhen child process errors or exits with a signal inrunScript.src/emulator/dataconnectEmulator.ts: Reject with a descriptiveFirebaseErrorwhen failing to connect to the SQL Connect emulator.src/emulator/eventarcEmulator.ts: Reject with aFirebaseErrorwhen functions emulator is missing intriggerEventFunction.src/profileReport.ts: Reject readline error with the originalErroror wrappedFirebaseError.src/emulator/workQueue.spec.ts: Reject withnew Error("job failed")in test.src/throttler/throttler.spec.ts: Reject withnew Error("retry")in retry test.src/utils.spec.ts: Add expliciteslint-disable-next-line prefer-promise-reject-errorsannotations where tests intentionally test rejection handling with non-Error values ("bar","fail fast")..eslintrc.js: Promoteprefer-promise-reject-errorsfrom"warn"to"error".Verification
npm run buildpassed completely (build:mcp-apps,tsc,copyfiles).npx mochapassed across all modified/affected spec files (commandUtils.spec.ts,workQueue.spec.ts,profileReport.spec.ts,throttler.spec.ts,utils.spec.ts).Related Bug: b/565074829