Skip to content

Conversation

@isaacs
Copy link
Member

@isaacs isaacs commented Dec 12, 2025

Explicitly enable any usage in typescript in:

  • dev-packages, since those are largely integration and E2E tests. (This is done with the addition of a dev-packages/.eslintrc.js file.)
  • packages/*/test/, since those are all tests. (This is done with a rule override added to the root .eslintrc.js file.)
  • Several one-off allowances, generally for vendored types from third party sources, and cases involving method overwriting that TypeScript can't follow. (These are done with file/line overrides, explicit as casting, and adding type inference to the isInstanceOf method.)

In other places (ie, in exported production code paths), replace any with unknown, and upgrade the @typescript/no-explicit-any lint rule to an error.

This silences a lot of eslint warnings that were habitually ignored, and encourages us to not opt out of strict type safety in our exported code.

Closes #18489 (added automatically)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,262 - 9,695 +16%
GET With Sentry 1,975 18% 1,772 +11%
GET With Sentry (error only) 7,850 70% 6,205 +27%
POST Baseline 1,161 - 1,215 -4%
POST With Sentry 594 51% 597 -1%
POST With Sentry (error only) 1,045 90% 1,075 -3%
MYSQL Baseline 4,051 - 3,395 +19%
MYSQL With Sentry 538 13% 467 +15%
MYSQL With Sentry (error only) 3,356 83% 2,740 +22%

View base workflow run

@isaacs isaacs force-pushed the isaacschlueter/any-to-unknown branch 2 times, most recently from ab3704a to 28f73dd Compare December 12, 2025 18:33
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.

Thanks a lot for taking this on! Let's find a solution for the subtle breakage (see comments) but otherwise I think this is a really nice improvement and hopefully prevents us from using any without good reason in the future.

@isaacs isaacs force-pushed the isaacschlueter/any-to-unknown branch from 28f73dd to 9fcac11 Compare December 15, 2025 18:40
@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.58 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.18 kB - -
@sentry/browser (incl. Tracing, Replay) 80.16 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.9 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.08 kB +0.01% +3 B 🔺
@sentry/browser (incl. Feedback) 41.52 kB +0.01% +3 B 🔺
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.78 kB - -
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.39 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.23 kB - -
CDN Bundle (incl. Tracing) 42.22 kB - -
CDN Bundle (incl. Tracing, Replay) 78.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.39 kB - -
CDN Bundle - uncompressed 80.02 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.37 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.91 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.67 kB - -
@sentry/nextjs (client) 46 kB - -
@sentry/sveltekit (client) 41.95 kB - -
@sentry/node-core 51.6 kB - -
@sentry/node 161.48 kB -0.01% -1 B 🔽
@sentry/node - without tracing 93.03 kB - -
@sentry/aws-serverless 108.54 kB - -

View base workflow run

Explicitly enable `any` usage in typescript in:

- `dev-packages`, since those are largely integration and E2E tests.
  (This is done with the addition of a `dev-packages/.eslintrc.js`
  file.)
- `packages/*/test/`, since those are all tests. (This is done with a
  rule override added to the root `.eslintrc.js` file.)
- Several one-off allowances, generally for vendored types from third
  party sources, and cases involving function type extension/overriding
  that TypeScript can't follow. (These are done with file/line
  overrides, explicit `as` casting, and adding type inference to the
  `isInstanceOf` method.)

In other places (ie, in exported production code paths), replace `any`
with `unknown`, and upgrade the `@typescript/no-explicit-any` lint rule
to an error.

This silences a lot of eslint warnings that were habitually ignored, and
encourages us to not opt out of strict type safety in our exported code.
@isaacs isaacs force-pushed the isaacschlueter/any-to-unknown branch from 9fcac11 to 5aadc4a Compare December 17, 2025 21:53
Copy link
Member Author

@isaacs isaacs left a comment

Choose a reason for hiding this comment

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

Just replying/resolving comments

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.

Thanks for following up on my review!

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.

chore(lint): prefer 'unknown' to 'any', fix lint warnings

3 participants