Skip to content

ref: Enable noUncheckedIndexedAccess TS config #12461

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

Merged
merged 8 commits into from
Jun 14, 2024
Merged

ref: Enable noUncheckedIndexedAccess TS config #12461

merged 8 commits into from
Jun 14, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Jun 11, 2024

This PR enables the noUncheckedIndexedAccess TS config, ensuring that we always properly guard for array/object access.

Sometimes, this leads to a bit of boilerplate, but enabling this def. found some places in the code where things could go wrong before.

Closes #12440

Afterwards, we can look into enabling https://typescript-eslint.io/rules/no-unnecessary-condition/.

@mydea mydea self-assigned this Jun 11, 2024
@mydea mydea requested review from a team as code owners June 11, 2024 14:46
Copy link
Contributor

github-actions bot commented Jun 11, 2024

size-limit report 📦

Path Size
@sentry/browser 22.03 KB (-0.06% 🔽)
@sentry/browser (incl. Tracing) 33.2 KB (-0.07% 🔽)
@sentry/browser (incl. Tracing, Replay) 68.94 KB (-0.02% 🔽)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.27 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay with Canvas) 73.01 KB (-0.02% 🔽)
@sentry/browser (incl. Tracing, Replay, Feedback) 85.17 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 86.99 KB (-0.02% 🔽)
@sentry/browser (incl. metrics) 26.21 KB (-0.06% 🔽)
@sentry/browser (incl. Feedback) 38.22 KB (-0.05% 🔽)
@sentry/browser (incl. sendFeedback) 26.62 KB (-0.07% 🔽)
@sentry/browser (incl. FeedbackAsync) 31.17 KB (-0.04% 🔽)
@sentry/react 24.8 KB (-0.03% 🔽)
@sentry/react (incl. Tracing) 36.28 KB (+0.02% 🔺)
@sentry/vue 26.03 KB (-0.06% 🔽)
@sentry/vue (incl. Tracing) 35.06 KB (-0.04% 🔽)
@sentry/svelte 22.17 KB (-0.01% 🔽)
CDN Bundle 23.36 KB (-0.15% 🔽)
CDN Bundle (incl. Tracing) 34.89 KB (-0.06% 🔽)
CDN Bundle (incl. Tracing, Replay) 68.99 KB (-0.05% 🔽)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.16 KB (+0.02% 🔺)
CDN Bundle - uncompressed 68.68 KB (-0.04% 🔽)
CDN Bundle (incl. Tracing) - uncompressed 103.29 KB (-0.02% 🔽)
CDN Bundle (incl. Tracing, Replay) - uncompressed 213.74 KB (-0.01% 🔽)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 226.2 KB (-0.01% 🔽)
@sentry/nextjs (client) 35.61 KB (-0.06% 🔽)
@sentry/sveltekit (client) 33.83 KB (-0.1% 🔽)
@sentry/node 112.01 KB (+0.05% 🔺)
@sentry/node - without tracing 89.47 KB (+0.06% 🔺)
@sentry/aws-serverless 98.53 KB (+0.05% 🔺)

Comment on lines +80 to +81
[requestHeaders, requestCookies] = _parseCookieHeaders('Cookie', request);
[responseHeaders, responseCookies] = _parseCookieHeaders('Set-Cookie', response);
Copy link
Member

Choose a reason for hiding this comment

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

Nice refactor!

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Nice! Bundle size hit doesn't look too bad (and even better if we can even it out with the no-unnecessary-conditions lint rule).

@mydea mydea force-pushed the fn/fix-guard branch 3 times, most recently from c2e6ade to cc029b0 Compare June 13, 2024 14:34
@mydea mydea merged commit 1a2a33c into develop Jun 14, 2024
140 checks passed
@mydea mydea deleted the fn/fix-guard branch June 14, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable noUncheckedIndexedAccess in tsconfig
3 participants