Skip to content
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

Identity project noUnusedParameters, noImplicitReturns and noUnusedLocals tsconfig fixes #11453

Merged
merged 17 commits into from
Oct 2, 2020

Conversation

mohsin-mehmood
Copy link
Contributor

@mohsin-mehmood mohsin-mehmood commented Sep 24, 2020

PR for #11438 #11439 and #11440

@ghost ghost added Cosmos Azure.Identity customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Sep 24, 2020
@ghost
Copy link

ghost commented Sep 24, 2020

Thank you for your contribution mohsin-mehmood! We will review the pull request and get back to you soon.

@mohsin-mehmood mohsin-mehmood changed the title Identity project noUnusedParameters and noImplicitReturns tsconfig fixes Identity project noUnusedParameters, noImplicitReturns and noUnusedLocals tsconfig fixes Sep 24, 2020
@@ -34,14 +34,14 @@ export class AzureCliCredential implements TokenCredential {
* Gets the access token from Azure CLI
* @param resource The resource to use when getting the token
*/
protected async getAzureCliAccessToken(resource: string) {
protected async getAzureCliAccessToken(resource: string): Promise<unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to choose unknown here instead of say inlining the type of the object containing the stdout, stderr and error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently in identity.api.md the return type of this method is Promise<unknown> and I was not sure if we should change the public API. Initially, I thought of setting it to Promise<any>

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe changing from unknown to a strongly typed value especially in the output of a method should not be a breaking change. Doing so from any would be breaking though.

cc @xirzec to confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please review this commit

Copy link
Contributor

Choose a reason for hiding this comment

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

Marking this conversation as unresolved to ensure we have input from @xirzec here

Copy link
Member

Choose a reason for hiding this comment

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

In-lining the type is better than unknown and any, though a small type alias or interface would be even better. I'm good with the linked commit though.

In this particular case, I wonder how much we have to worry about breaking changes for protected members. It seems like the only reason this method is protected is out of a misguided strategy for testing. We should be using something like sinon to mock out getAzureCliAccessToken instead of inheritance.

If @jonathandturner is willing, perhaps we could make this private unless we really do anticipate developers to replace this implementation in their live apps?

private pca: PublicClientApplication;
private msalCacheManager: TokenCache;
private tenantId: string;
private clientId: string;
private persistenceEnabled: boolean;
private redirectUri: string;
private authorityHost: string;
private authenticationRecord: AuthenticationRecord | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

@jonathandturner This was added in #10994
Was curious as to how you envisioned this being used as it is currently unused

Copy link
Contributor

Choose a reason for hiding this comment

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

@mohsin-mehmood Looks like the latest changes in the master branch do make use of the authenticationRecord. Can you pull in the changes from master and update the PR?

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @mohsin-mehmood!

@sadasant, Please take another look and merge the PR if you have no concerns

Copy link
Contributor

@sadasant sadasant left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants