Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubramanianaks committed Aug 7, 2024
1 parent 865d5df commit 4957d79
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
10 changes: 5 additions & 5 deletions src/auth/azureAuth.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { TokenCredential } from "@azure/core-auth";
import { Environment } from "@azure/ms-rest-azure-env";
import {
AuthenticationSession,
Disposable as VsCodeDisposable,
ProgressLocation,
ProgressOptions,
QuickPickItem,
Disposable as VsCodeDisposable,
window,
} from "vscode";
import { AzureSessionProvider, ReadyAzureSessionProvider, Tenant, TokenInfo, isReady } from "./types";
import { Environment } from "@azure/ms-rest-azure-env";
import { getConfiguredAzureEnv } from "../commands/utils/config";
import { Errorable, failed } from "../commands/utils/errorable";
import { TokenCredential } from "@azure/core-auth";
import { parseJson } from "../commands/utils/json";
import { getSessionProvider } from "./azureSessionProvider";
import { AzureSessionProvider, ReadyAzureSessionProvider, Tenant, TokenInfo, isReady } from "./types";

export function getEnvironment(): Environment {
return getConfiguredAzureEnv();
Expand Down Expand Up @@ -94,7 +94,7 @@ export function getTokenInfo(session: AuthenticationSession): Errorable<TokenInf
try {
jsonBody = Buffer.from(body, "base64").toString();
} catch (e) {
return { succeeded: false, error: `Failed to decode JWT token body: ${body}` };
return { succeeded: false, error: `Failed to decode JWT token body: ${body} and error is: ${e}` };
}

const jwt = parseJson<Jwt>(jsonBody);
Expand Down
39 changes: 19 additions & 20 deletions src/commands/draft/draftCommands.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { Octokit, RestEndpointMethodTypes } from "@octokit/rest";
import path, { basename, extname, join } from "path";
import {
authentication,
AuthenticationSession,
Extension,
ExtensionContext,
WorkspaceFolder,
FileType,
Uri,
window,
workspace,
AuthenticationSession,
Uri,
FileType,
WorkspaceFolder,
} from "vscode";
import { DraftDockerfileDataProvider, DraftDockerfilePanel } from "../../panels/draft/DraftDockerfilePanel";
import { getExtension } from "../utils/host";
import { Errorable, failed, getErrorMessage, succeeded } from "../utils/errorable";
import { getDraftBinaryPath } from "../utils/helper/draftBinaryDownload";
import { DraftDeploymentDataProvider, DraftDeploymentPanel } from "../../panels/draft/DraftDeploymentPanel";
import * as k8s from "vscode-kubernetes-tools-api";
import { getDeploymentFilesToWrite } from "../utils/draft";
import { getGitApi } from "../utils/git";
import { getReadySessionProvider } from "../../auth/azureAuth";
import { DraftDeploymentDataProvider, DraftDeploymentPanel } from "../../panels/draft/DraftDeploymentPanel";
import { DraftDockerfileDataProvider, DraftDockerfilePanel } from "../../panels/draft/DraftDockerfilePanel";
import { DraftWorkflowDataProvider, DraftWorkflowPanel } from "../../panels/draft/DraftWorkflowPanel";
import { Octokit, RestEndpointMethodTypes } from "@octokit/rest";
import { Remote } from "../../types/git";
import { GitHubRepo } from "../../webview-contract/webviewDefinitions/draft/types";
import { ExistingFile } from "../../webview-contract/webviewDefinitions/draft/draftWorkflow";
import { basename, extname, join } from "path";
import { getReadySessionProvider } from "../../auth/azureAuth";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { DraftCommandParamsType } from "./types";
import { GitHubRepo } from "../../webview-contract/webviewDefinitions/draft/types";
import { getAksClusterTreeNode } from "../utils/clusters";
import path from "path";
import { getDeploymentFilesToWrite } from "../utils/draft";
import { Errorable, failed, getErrorMessage, succeeded } from "../utils/errorable";
import { getGitApi } from "../utils/git";
import { getDraftBinaryPath } from "../utils/helper/draftBinaryDownload";
import { getExtension } from "../utils/host";
import { DraftCommandParamsType } from "./types";

export async function draftDockerfile(_context: IActionContext, target: unknown): Promise<void> {
const params = getDraftDockerfileParams(target);
Expand Down Expand Up @@ -151,7 +150,7 @@ export async function draftWorkflow(_context: IActionContext, target: unknown):
path: join(".github", "workflows", name),
};
});
} catch (e) {
} catch {
// If the directory doesn't exist, that's fine - it just means there will be no existing workflow files.
}

Expand Down Expand Up @@ -236,7 +235,7 @@ async function getRepo(octokit: Octokit, remote: Remote): Promise<GitHubRepo | n
let response: RestEndpointMethodTypes["repos"]["get"]["response"];
try {
response = await octokit.repos.get({ owner, repo });
} catch (e) {
} catch {
return null;
}

Expand Down
12 changes: 6 additions & 6 deletions src/commands/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as vscode from "vscode";
import { combine, failed, Errorable } from "./errorable";
import { KubeloginConfig, KustomizeConfig } from "../periscope/models/config";
import { Environment, EnvironmentParameters } from "@azure/ms-rest-azure-env";
import * as semver from "semver";
import * as vscode from "vscode";
import { CommandCategory, PresetCommand } from "../../webview-contract/webviewDefinitions/kubectl";
import { KubeloginConfig, KustomizeConfig } from "../periscope/models/config";
import { RetinaDownloadConfig } from "../periscope/models/RetinaDownloadConfig";
import { combine, Errorable, failed } from "./errorable";
import { isObject } from "./runtimeTypes";
import { Environment, EnvironmentParameters } from "@azure/ms-rest-azure-env";

export function getConfiguredAzureEnv(): Environment {
// See:
Expand Down Expand Up @@ -52,7 +52,7 @@ export function getFilteredSubscriptions(): SubscriptionFilter[] {
values = vscode.workspace.getConfiguration("azure").get<string[]>("resourceFilter", []);
}
return values.map(asSubscriptionFilter).filter((v) => v !== null) as SubscriptionFilter[];
} catch (e) {
} catch {
return [];
}
}
Expand All @@ -61,7 +61,7 @@ function asSubscriptionFilter(value: string): SubscriptionFilter | null {
try {
const parts = value.split("/");
return { tenantId: parts[0], subscriptionId: parts[1] };
} catch (e) {
} catch {
return null;
}
}
Expand Down
17 changes: 10 additions & 7 deletions src/commands/utils/detectors.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Errorable, combine, failed, getErrorMessage } from "./errorable";
import { AksClusterTreeNode } from "../../tree/aksClusterTreeItem";
import { Environment } from "@azure/ms-rest-azure-env";
import * as fs from "fs";
import * as path from "path";
import { dirSync } from "tmp";
import { ReadyAzureSessionProvider } from "../../auth/types";
import { AksClusterTreeNode } from "../../tree/aksClusterTreeItem";
import {
ARMResponse,
CategoryDetectorARMResponse,
SingleDetectorARMResponse,
isCategoryDataset,
} from "../../webview-contract/webviewDefinitions/detector";
import { dirSync } from "tmp";
import { Environment } from "@azure/ms-rest-azure-env";
import { getPortalResourceUrl } from "./env";
import { getResourceManagementClient } from "./arm";
import { ReadyAzureSessionProvider } from "../../auth/types";
import { getPortalResourceUrl } from "./env";
import { Errorable, combine, failed, getErrorMessage } from "./errorable";

/**
* Can be used to store the JSON responses for a collection of category detectors and all their child detectors.
Expand Down Expand Up @@ -76,7 +76,10 @@ export async function getDetectorListData(
} catch (err) {
// This would be unexpected even in the event of network failure, because the individual promises handle
// their own errors.
return { succeeded: false, error: `Failed to retrieve detector data for ${categoryDetector.name}` };
return {
succeeded: false,
error: `Failed to retrieve detector data for ${categoryDetector.name} and error is ${err}`,
};
}

return combine(results);
Expand Down
2 changes: 1 addition & 1 deletion src/webview-contract/webviewDefinitions/inspektorGadget.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WebviewDefinition } from "../webviewTypes";

export interface InitialState {}
export type InitialState = object;

export interface GadgetVersion {
client: string;
Expand Down

0 comments on commit 4957d79

Please sign in to comment.