-
Notifications
You must be signed in to change notification settings - Fork 842
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
refactor(instrumentation-http): fix eslint warnings #5394
Open
chancancode
wants to merge
5
commits into
open-telemetry:main
Choose a base branch
from
tildeio:eslint-warning-instrumentation-http
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
refactor(instrumentation-http): fix eslint warnings #5394
chancancode
wants to merge
5
commits into
open-telemetry:main
from
tildeio:eslint-warning-instrumentation-http
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix the following eslint warnings: ``` /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/src/http.ts 236:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 251:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 252:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 283:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 298:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 299:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any ``` Extracted a utility function with more precise types for the job. Ref open-telemetry#5365
Fix the following eslint warnings: ``` /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/src/http.ts 508:17 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion 931:11 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion 1032:13 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion 1043:13 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion ``` Because the expression we check is indirected through the a method call (`getConfig()`), TypeScript cannot assume the value would be the same across the two calls. By extracting the value and checking for that, TypeScript can narrow the type correctly and we can avoid the non-null assertion. Ref open-telemetry#5365
``` /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/src/http.ts 1051:15 warning Don't use `Function` as a type @typescript-eslint/ban-types ``` Be explict about what type of functions we are expecting here. Ref open-telemetry#5365
``` /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-package.test.ts 86:27 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-package.test.ts 86:27 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts 81:25 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api 156:43 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api 161:43 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api 213:35 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/test/integrations/http-enable.test.ts 300:9 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api /home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-http/test/integrations/https-enable.test.ts 274:9 warning 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead node/no-deprecated-api ``` Generally speaking, `new URL()` is not a direct replacement for the deprecated `url.parse()`, so this type of change requires careful considerations. However, in this instance, these are all found in test code, which cuts out a lot of the typically associated issues, and the tests passing after the change is a good indication for correctness. Ref open-telemetry#5365
25 tasks
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5394 +/- ##
=======================================
Coverage 94.64% 94.64%
=======================================
Files 318 318
Lines 8033 8033
Branches 1688 1688
=======================================
Hits 7603 7603
Misses 430 430 |
chancancode
changed the title
Eslint warning instrumentation http
refactor(instrumentation-http): fix eslint warnings
Jan 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Fixes the following eslint warnings:
Ref #5365
Short description of the changes
There are a fair bit of changes here, but splitting into multiple PRs would just create a lot of conflicts. So instead, each commit is one unit of change with a detailed description in the commit message.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: