-
Notifications
You must be signed in to change notification settings - Fork 282
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
Fix: lint warning fix for any to unknown #1374 #1397
Fix: lint warning fix for any to unknown #1374 #1397
Conversation
@@ -101,14 +101,14 @@ export class QuorumTestLedger implements ITestLedger { | |||
} | |||
|
|||
public async getFileContents(filePath: string): Promise<string> { | |||
const response: any = await this.getContainer().getArchive({ | |||
const response: unknown = await this.getContainer().getArchive({ |
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 recommend simply omitting the explicit type declaration here in order to make the linter warning go away. Using unkown in this particular case just makes the compiler fail somewhere down the line.
const response: unknown = await this.getContainer().getArchive({ | |
const response = await this.getContainer().getArchive({ |
@yayoiukai2021 The other thing apart from my recommended change above is the DCO: If you click on the link labeled as "Details" next to the failing check (DCO) then it should give you specific instructions on how to fix it on the command line. If you encounter any trouble with it then feel free to ask for more help ;-) |
Signed-off-by: yukai <yayoi.ukai@sony.com>
a946a3b
to
58d8df9
Compare
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.
@yayoiukai2021 LGTM, thank you very much!
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.
@yayoiukai2021 You will also need to import the Stream
type in order to make my other suggestion work with something like this:
import { Stream } from "stream";
private pullContainerImage(containerNameAndTag: string): Promise<unknown[]> { | ||
return new Promise((resolve, reject) => { | ||
const docker = new Docker(); | ||
docker.pull(containerNameAndTag, (pullError: any, stream: any) => { | ||
if (pullError) { | ||
reject(pullError); | ||
} else { | ||
docker.modem.followProgress( | ||
stream, | ||
(progressError: any, output: any[]) => { | ||
if (progressError) { | ||
reject(progressError); | ||
} else { | ||
resolve(output); | ||
} | ||
}, | ||
); | ||
} | ||
}); | ||
docker.pull( | ||
containerNameAndTag, | ||
(pullError: unknown, stream: unknown) => { | ||
if (pullError) { | ||
reject(pullError); | ||
} else { | ||
docker.modem.followProgress( | ||
stream, | ||
(progressError: unknown, output: unknown[]) => { | ||
if (progressError) { | ||
reject(progressError); | ||
} else { | ||
resolve(output); | ||
} | ||
}, | ||
); | ||
} | ||
}, | ||
); |
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.
@yayoiukai2021 I'd fix the compiler error like this:
private pullContainerImage(containerNameAndTag: string): Promise<unknown[]> { | |
return new Promise((resolve, reject) => { | |
const docker = new Docker(); | |
docker.pull(containerNameAndTag, (pullError: any, stream: any) => { | |
if (pullError) { | |
reject(pullError); | |
} else { | |
docker.modem.followProgress( | |
stream, | |
(progressError: any, output: any[]) => { | |
if (progressError) { | |
reject(progressError); | |
} else { | |
resolve(output); | |
} | |
}, | |
); | |
} | |
}); | |
docker.pull( | |
containerNameAndTag, | |
(pullError: unknown, stream: unknown) => { | |
if (pullError) { | |
reject(pullError); | |
} else { | |
docker.modem.followProgress( | |
stream, | |
(progressError: unknown, output: unknown[]) => { | |
if (progressError) { | |
reject(progressError); | |
} else { | |
resolve(output); | |
} | |
}, | |
); | |
} | |
}, | |
); | |
private pullContainerImage(containerNameAndTag: string): Promise<unknown[]> { | |
return new Promise((resolve, reject) => { | |
const docker = new Docker(); | |
docker.pull(containerNameAndTag, (pullError: unknown, stream: Stream) => { | |
if (pullError) { | |
reject(pullError); | |
} else { | |
docker.modem.followProgress( | |
stream, | |
(progressError: unknown, output: unknown[]) => { | |
if (progressError) { | |
reject(progressError); | |
} else { | |
resolve(output); | |
} | |
}, | |
); | |
} | |
}); | |
}); | |
} |
Closing due to inactivity, feel free to reopen as needed and then we can continue the review. |
Lint fix for batch 25/26. + No.251 and No.240 (In the same file)
Fixes #1374