Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint(telemetry-utils): Prefix telemetry-utils before enabling no-unchecked-record-access #23428

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

RishhiB
Copy link
Contributor

@RishhiB RishhiB commented Jan 2, 2025

eslint(telemetry-utils): Prefix telemetry-utils before enabling no-unchecked-record-access
AB#25378

@github-actions github-actions bot added the base: main PRs targeted against main branch label Jan 2, 2025
@RishhiB RishhiB changed the title eslint(telemetry-utils): Prefix telemetry-utilsbefore enabling no-unchecked-record-access eslint(telemetry-utils): Prefix telemetry-utils before enabling no-unchecked-record-access Jan 3, 2025
@RishhiB RishhiB marked this pull request as ready for review January 3, 2025 16:57
@Copilot Copilot bot review requested due to automatic review settings January 3, 2025 16:57

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

const actualValue:
| TelemetryEventPropertyTypeExt
| Tagged<TelemetryEventPropertyTypeExt>
| undefined = actual[expectedKey];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah is this really what the formatter wants? I am not a fan of how the RHS of the = is on the same line as the end of that multi-line type. Weird, oh well.

@@ -22,7 +22,8 @@ const getMockStore = (settings: Record<string, string>): Storage => {
return {
getItem: (key: string): string | null => {
ops.push(key);
return settings[key];
// eslint-disable-next-line unicorn/no-null
return settings[key] ?? null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale here? Is the calling code prepared to handle null instead of undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, getItem is typed to string | null, but returning settings[key] results in a type of string | undefined, so I just force it to null if its undefined

Copy link
Member

@markfields markfields left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RishhiB RishhiB merged commit 0f6b54d into microsoft:main Jan 6, 2025
40 checks passed
@RishhiB RishhiB deleted the preFixTelemetryUtils branch January 6, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants