-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[event-hubs] fix eslint errors (round 1) #13013
Conversation
@@ -8,7 +8,7 @@ | |||
* @internal | |||
*/ | |||
export function parseEndpoint(endpoint: string): { host: string; hostname: string; port?: string } { | |||
const hostMatch = endpoint.match(/.*:\/\/([^\/]*)/i); | |||
const hostMatch = endpoint.match(/.*:\/\/([^/]*)/i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. doesn't make a difference, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. ESLint was complaining because that backslash was unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am super happy with the push to fix linting issues. One thing I left a comment about is that we should move away from any
as an argument type and use unknown
instead.
@@ -24,14 +24,15 @@ export const defaultDataTransformer = { | |||
* - multiple: true | undefined. | |||
*/ | |||
encode(body: any): any { | |||
// eslint-disable-line @typescript-eslint/explicit-module-boundary-types | |||
let result: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change any
to unknown
in the argument type throughout to fix the linting the issue? it could be a bit painful sometimes but it is safer to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to refactor the if/else block to return early so that we don't need to have the result
variable at all.
if (isBuffer(body) {
return message.data_section(body);
}
try {
const bodyStr = JSON.stringify(body);
return message.data_section(Buffer.from(bodyStr, "utf8"));
} catch (err) {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramya-rao-a sorry for the confusion by putting my comment on line 28 instead of line 26. I meant to do this change for arguments only (body
in this case). This is where eslint
complains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all of the @typescript-eslint/explicit-module-boundary-types
overrides in #13285
@@ -57,6 +58,7 @@ export const defaultDataTransformer = { | |||
* @return {*} decoded body or the given body as-is. | |||
*/ | |||
decode(body: any): any { | |||
// eslint-disable-line @typescript-eslint/explicit-module-boundary-types | |||
let processedBody: any = body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
@@ -30,6 +31,7 @@ const smallMessageMaxBytes = 255; | |||
* @ignore | |||
*/ | |||
export function isEventDataBatch(eventDataBatch: any): eventDataBatch is EventDataBatch { | |||
// eslint-disable-line @typescript-eslint/explicit-module-boundary-types | |||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
@@ -1,6 +1,8 @@ | |||
// Copyright (c) Microsoft Corporation. | |||
// Licensed under the MIT license. | |||
|
|||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
@@ -1,6 +1,9 @@ | |||
// Copyright (c) Microsoft Corporation. | |||
// Licensed under the MIT license. | |||
|
|||
// Disable eslint rule since these functions aren't part of the public API. | |||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still reviewing, but noticed something interesting.
Closing in favor of #13285 |
Round 1 addressing #10777 Replaces #13013 This leaves 5 errors and 15 warnings (excluding TSDoc) after this PR is merged. - 4 'Promise executor functions should not be async' errors. Fixing this will take a lot of care and I would want these to be reviewed on their own so they don't get lost in the noise. - 1 'N is already defined'. This is due to a constant matching an interface name.
Round 1 addressing Azure#10777 Replaces Azure#13013 This leaves 5 errors and 15 warnings (excluding TSDoc) after this PR is merged. - 4 'Promise executor functions should not be async' errors. Fixing this will take a lot of care and I would want these to be reviewed on their own so they don't get lost in the noise. - 1 'N is already defined'. This is due to a constant matching an interface name.
Round 1 addressing #10777
These changes addresses ~300 of the eslint errors and some warnings found by running eslint with the TSDoc rules disabled.
This leaves 13 errors and 51 warnings left after this PR is merged.