Vidya reddy pretty code (#53)

* updated action file with node16

* Code consistency using prettier and its workflow

* Enforce Prettier

* code fix

* code fix

* code fix

Co-authored-by: Vidya Reddy <vidyareddy@microsoft.com>
This commit is contained in:
Vidya Reddy
2022-06-24 16:08:48 -07:00
committed by GitHub
parent e972a5b196
commit b6c5bf067a
37 changed files with 9089 additions and 9033 deletions
+11 -11
View File
@@ -1,10 +1,10 @@
import * as util from "util";
import * as util from 'util'
export interface K8sSecret {
data: {
token: string;
"ca.crt": string;
};
data: {
token: string
'ca.crt': string
}
}
/**
@@ -13,13 +13,13 @@ export interface K8sSecret {
* @returns A type guarded K8sSecret
*/
export function parseK8sSecret(secret: any): K8sSecret {
if (!secret) throw Error("K8s secret yaml is invalid");
if (!secret.data) throw k8sSecretMissingFieldError("data");
if (!secret.data.token) throw k8sSecretMissingFieldError("token");
if (!secret.data["ca.crt"]) throw k8sSecretMissingFieldError("ca.crt");
if (!secret) throw Error('K8s secret yaml is invalid')
if (!secret.data) throw k8sSecretMissingFieldError('data')
if (!secret.data.token) throw k8sSecretMissingFieldError('token')
if (!secret.data['ca.crt']) throw k8sSecretMissingFieldError('ca.crt')
return secret as K8sSecret;
return secret as K8sSecret
}
const k8sSecretMissingFieldError = (field: string): Error =>
Error(util.format("K8s secret yaml does not contain %s field", field));
Error(util.format('K8s secret yaml does not contain %s field', field))