Skip to content

feat: Avoid usage of any #17041

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

feat: Avoid usage of any #17041

wants to merge 3 commits into from

Conversation

mydea
Copy link
Member

@mydea mydea commented Jul 16, 2025

This makes the lint rule error, instead of warn, and gets rid of some more any usage. Some of that may technically be breaking because the types can be exposed, but this should be very unlikely to affect any users.

In a future version of eslint, this is on by default, but IMHO it makes sense for us anyhow - any should only be used when absolutely necessary and when we make a conscious choice to do so.

@mydea mydea requested review from Lms24 and AbhiPrasad July 16, 2025 13:28
@mydea mydea self-assigned this Jul 16, 2025
@mydea mydea requested review from a team as code owners July 16, 2025 13:28
Copy link
Contributor

github-actions bot commented Jul 16, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.78 kB -0.02% -3 B 🔽
@sentry/browser - with treeshaking flags 22.34 kB -0.02% -3 B 🔽
@sentry/browser (incl. Tracing) 39.66 kB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing, Replay) 77.77 kB -0.03% -21 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.57 kB -0.03% -18 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 82.47 kB -0.03% -24 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 94.59 kB -0.01% -1 B 🔽
@sentry/browser (incl. Feedback) 40.48 kB +0.03% +10 B 🔺
@sentry/browser (incl. sendFeedback) 28.46 kB -0.02% -4 B 🔽
@sentry/browser (incl. FeedbackAsync) 33.36 kB -0.01% -3 B 🔽
@sentry/react 25.54 kB -0.01% -2 B 🔽
@sentry/react (incl. Tracing) 41.62 kB -0.01% -4 B 🔽
@sentry/vue 28.23 kB -0.01% -2 B 🔽
@sentry/vue (incl. Tracing) 41.44 kB -0.01% -4 B 🔽
@sentry/svelte 23.8 kB -0.01% -2 B 🔽
CDN Bundle 25.18 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing) 39.42 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay) 75.41 kB -0.02% -9 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 80.88 kB -0.01% -8 B 🔽
CDN Bundle - uncompressed 73.44 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 116.86 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 230.99 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 243.8 kB -0.01% -7 B 🔽
@sentry/nextjs (client) 43.66 kB -0.02% -6 B 🔽
@sentry/sveltekit (client) 40.08 kB -0.01% -4 B 🔽
@sentry/node 167.82 kB +0.01% +3 B 🔺
@sentry/node - without tracing 100.2 kB +0.01% +2 B 🔺
@sentry/aws-serverless 128.36 kB - -

View base workflow run

@@ -380,7 +382,11 @@ function instrumentPostgRESTFilterBuilder(PostgRESTFilterBuilder: PostgRESTFilte
}

if (Object.keys(body).length) {
attributes['db.body'] = body;
try {
attributes['db.body'] = JSON.stringify(body);
Copy link
Member

Choose a reason for hiding this comment

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

q: Did this get stringified anyway before or why are we doing it now?

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure if this ever worked, but OTEL does not support complex attributes. Maybe it kind-of worked because we accept this in our transaction event, but this is the more safe/correct solution IMHO!

@@ -47,4 +47,5 @@ export interface Integration {
* An integration in function form.
* This is expected to return an integration.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Member

Choose a reason for hiding this comment

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

Could we use unknown here?

Copy link
Member Author

Choose a reason for hiding this comment

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

this sadly does not work, there are some incompatibilites with function arguments and unknown, sometimes...

mydea added 2 commits July 17, 2025 09:51
This makes the lint rule error, instead of warn, and gets rid of some more any usage.
Some of that may technically be breaking because the types can be exposed, but this should be very unlikely to affect any users.
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.

2 participants