Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the ext:info and ext:list commands by including the source download URL and extension configuration parameters (params and systemParams) in their respective outputs. The listExtensions function and its associated tests were updated to handle these additional fields. However, the use of any in the return type and variable declarations in src/extensions/listExtensions.ts violates the repository's style guide, which prohibits any as an escape hatch. You should define a proper interface for the extension instance object to ensure type safety.
| * @return mapping that contains a list of instances under the "instances" key | ||
| */ | ||
| export async function listExtensions(projectId: string): Promise<Record<string, string>[]> { | ||
| export async function listExtensions(projectId: string): Promise<Record<string, any>[]> { |
There was a problem hiding this comment.
The use of any violates the repository style guide (GEMINI.md, line 38). Please define a proper interface or use a specific type literal for the return value to ensure type safety.
| export async function listExtensions(projectId: string): Promise<Record<string, any>[]> { | |
| export async function listExtensions(projectId: string): Promise<Array<{ | |
| extension: string; | |
| publisher: string; | |
| instanceId: string; | |
| state: string; | |
| version: string | undefined; | |
| updateTime: string; | |
| params: Record<string, string>; | |
| systemParams: Record<string, string>; | |
| }>> { |
References
- Never use
anyorunknownas an escape hatch. Define proper interfaces/types or use type guards. (link)
| (a, b) => new Date(b.createTime).valueOf() - new Date(a.createTime).valueOf(), | ||
| ); | ||
| const formatted: Record<string, string>[] = []; | ||
| const formatted: Record<string, any>[] = []; |
There was a problem hiding this comment.
Avoid using any here to comply with the repository style guide. Explicitly typing the formatted array improves code clarity and maintainability.
const formatted: Array<{
extension: string;
publisher: string;
instanceId: string;
state: string;
version: string | undefined;
updateTime: string;
params: Record<string, string>;
systemParams: Record<string, string>;
}> = [];References
- Never use
anyorunknownas an escape hatch. Define proper interfaces/types or use type guards. (link)
Adds the download link to
firebase ext:infoand adds params info in the --json version offirebase ext:listSample runs:
❯ firebase ext:list --json --project inlined-junkdrawer { "status": "success", "result": [ { "extension": "firebase/storage-resize-images", "publisher": "firebase", "instanceId": "storage-resize-images-fqbz", "state": "ACTIVE", "version": "0.1.25", "updateTime": "2022-02-08 21:41:00", "params": { "INCLUDE_PATH_LIST": "/source/*", "EXCLUDE_PATH_LIST": "/source/*/pictures", "IMAGE_TYPE": "jpeg", "LOCATION": "us-central1", "IMG_BUCKET": "inlined-junkdrawer.appspot.com", "IMG_SIZES": "200x200", "DELETE_ORIGINAL_FILE": "true", "RESIZED_IMAGES_PATH": "thumbs" } } ] }