Use @typescript-eslint/semi.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti committed 2020-11-19 18:12:52 +02:00
1 parent 0b182ccf6f
commit 460dfe4d2b
179 files changed
+556 -554

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ import { autoUpdater } from "electron-updater";
import logger from "./logger";
export class AppUpdater {
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24 // once a day
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24; // once a day
static checkForUpdates() {
return autoUpdater.checkForUpdatesAndNotify();
@@ -4,11 +4,11 @@ import { Cluster } from "../cluster";
export type ClusterDetectionResult = {
value: string | number | boolean
accuracy: number
}
};
export class BaseClusterDetector {
cluster: Cluster
key: string
cluster: Cluster;
key: string;
constructor(cluster: Cluster) {
this.cluster = cluster;
@@ -3,7 +3,7 @@ import { createHash } from "crypto";
import { ClusterMetadataKey } from "../cluster";
export class ClusterIdDetector extends BaseClusterDetector {
key = ClusterMetadataKey.CLUSTER_ID
key = ClusterMetadataKey.CLUSTER_ID;
public async detect() {
let id: string;
@@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class DistributionDetector extends BaseClusterDetector {
key = ClusterMetadataKey.DISTRIBUTION
version: string
key = ClusterMetadataKey.DISTRIBUTION;
version: string;
public async detect() {
this.version = await this.getKubernetesVersion();
@@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class LastSeenDetector extends BaseClusterDetector {
key = ClusterMetadataKey.LAST_SEEN
key = ClusterMetadataKey.LAST_SEEN;
public async detect() {
if (!this.cluster.accessible) return null;
@@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class NodesCountDetector extends BaseClusterDetector {
key = ClusterMetadataKey.NODES_COUNT
key = ClusterMetadataKey.NODES_COUNT;
public async detect() {
if (!this.cluster.accessible) return null;
@@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class VersionDetector extends BaseClusterDetector {
key = ClusterMetadataKey.VERSION
value: string
key = ClusterMetadataKey.VERSION;
value: string;
public async detect() {
const version = await this.getKubernetesVersion();
+2 -2
View File
@@ -32,7 +32,7 @@ export enum ClusterMetadataKey {
export type ClusterRefreshOptions = {
refreshMetadata?: boolean
}
};
export interface ClusterState {
initialized: boolean;
@@ -50,7 +50,7 @@ export interface ClusterState {
export class Cluster implements ClusterModel, ClusterState {
public id: ClusterId;
public kubeCtl: Kubectl
public kubeCtl: Kubectl;
public contextHandler: ContextHandler;
public ownerRef: string;
protected kubeconfigManager: KubeconfigManager;
+4 -4
View File
@@ -12,10 +12,10 @@ import { KubeAuthProxy } from "./kube-auth-proxy";
export class ContextHandler {
public proxyPort: number;
public clusterUrl: UrlWithStringQuery;
protected kubeAuthProxy: KubeAuthProxy
protected apiTarget: httpProxy.ServerOptions
protected prometheusProvider: string
protected prometheusPath: string
protected kubeAuthProxy: KubeAuthProxy;
protected apiTarget: httpProxy.ServerOptions;
protected prometheusProvider: string;
protected prometheusPath: string;
constructor(protected cluster: Cluster) {
this.clusterUrl = url.parse(cluster.apiUrl);
+3 -3
View File
@@ -7,11 +7,11 @@ import { helmCli } from "./helm-cli";
type CachedYaml = {
entries: any; // todo: types
}
};
export class HelmChartManager {
protected cache: any = {}
protected repo: HelmRepo
protected cache: any = {};
protected repo: HelmRepo;
constructor(repo: HelmRepo){
this.cache = HelmRepoManager.cache;
+4 -4
View File
@@ -10,7 +10,7 @@ import logger from "../logger";
export type HelmEnv = Record<string, string> & {
HELM_REPOSITORY_CACHE?: string;
HELM_REPOSITORY_CONFIG?: string;
}
};
export interface HelmRepoConfig {
repositories: HelmRepo[]
@@ -29,11 +29,11 @@ export interface HelmRepo {
}
export class HelmRepoManager extends Singleton {
static cache = {} // todo: remove implicit updates in helm-chart-manager.ts
static cache = {}; // todo: remove implicit updates in helm-chart-manager.ts
protected repos: HelmRepo[];
protected helmEnv: HelmEnv
protected initialized: boolean
protected helmEnv: HelmEnv;
protected initialized: boolean;
async loadAvailableRepos(): Promise<HelmRepo[]> {
const res = await customRequestPromise({
+6 -6
View File
@@ -12,13 +12,13 @@ export interface KubeAuthProxyLog {
}
export class KubeAuthProxy {
public lastError: string
public lastError: string;
protected cluster: Cluster
protected env: NodeJS.ProcessEnv = null
protected proxyProcess: ChildProcess
protected port: number
protected kubectl: Kubectl
protected cluster: Cluster;
protected env: NodeJS.ProcessEnv = null;
protected proxyProcess: ChildProcess;
protected port: number;
protected kubectl: Kubectl;
constructor(cluster: Cluster, port: number, env: NodeJS.ProcessEnv) {
this.env = env;
+1 -1
View File
@@ -8,7 +8,7 @@ import { dumpConfigYaml, loadConfig } from "../common/kube-helpers";
import logger from "./logger";
export class KubeconfigManager {
protected configDir = app.getPath("temp")
protected configDir = app.getPath("temp");
protected tempFile: string;
private constructor(protected cluster: Cluster, protected contextHandler: ContextHandler, protected port: number) { }
+7 -7
View File
@@ -54,18 +54,18 @@ export function bundledKubectlPath(): string {
}
export class Kubectl {
public kubectlVersion: string
protected directory: string
protected url: string
protected path: string
protected dirname: string
public kubectlVersion: string;
protected directory: string;
protected url: string;
protected path: string;
protected dirname: string;
static get kubectlDir() {
return path.join((app || remote.app).getPath("userData"), "binaries", "kubectl");
}
public static readonly bundledKubectlVersion: string = bundledVersion
public static invalidBundle = false
public static readonly bundledKubectlVersion: string = bundledVersion;
public static invalidBundle = false;
private static bundledInstance: Kubectl;
// Returns the single bundled Kubectl instance
+11 -11
View File
@@ -12,22 +12,22 @@ export type LensBinaryOpts = {
originalBinaryName: string;
newBinaryName?: string;
requestOpts?: request.Options;
}
};
export class LensBinary {
public binaryVersion: string
protected directory: string
protected url: string
public binaryVersion: string;
protected directory: string;
protected url: string;
protected path: string;
protected tarPath: string;
protected dirname: string
protected binaryName: string
protected platformName: string
protected arch: string
protected originalBinaryName: string
protected requestOpts: request.Options
protected logger: Console | winston.Logger
protected dirname: string;
protected binaryName: string;
protected platformName: string;
protected arch: string;
protected originalBinaryName: string;
protected requestOpts: request.Options;
protected logger: Console | winston.Logger;
constructor(opts: LensBinaryOpts) {
const baseDir = opts.baseDir;
+5 -5
View File
@@ -12,11 +12,11 @@ import { ContextHandler } from "./context-handler";
import logger from "./logger";
export class LensProxy {
protected origin: string
protected proxyServer: http.Server
protected router: Router
protected closed = false
protected retryCounters = new Map<string, number>()
protected origin: string;
protected proxyServer: http.Server;
protected router: Router;
protected closed = false;
protected retryCounters = new Map<string, number>();
static create(port: number, clusterManager: ClusterManager) {
return new LensProxy(port, clusterManager).listen();
+1 -1
View File
@@ -11,7 +11,7 @@ import { menuRegistry } from "../extensions/registries/menu-registry";
import logger from "./logger";
import { exitApp } from "./exit-app";
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help"
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help";
export function initMenu(windowManager: WindowManager) {
return autorun(() => buildMenu(windowManager), {
+2 -2
View File
@@ -10,8 +10,8 @@ import { appEventBus } from "../common/event-bus";
export class NodeShellSession extends ShellSession {
protected nodeName: string;
protected podId: string
protected kc: KubeConfig
protected podId: string;
protected kc: KubeConfig;
constructor(socket: WebSocket, cluster: Cluster, nodeName: string) {
super(socket, cluster);
+4 -4
View File
@@ -10,15 +10,15 @@ jest.mock("net", () => {
listen = jest.fn(() => {
this.emit('listening');
return this;
})
});
address = () => {
newPort = Math.round(Math.random() * 10000);
return {
port: newPort
};
}
unref = jest.fn()
close = jest.fn(cb => cb())
};
unref = jest.fn();
close = jest.fn(cb => cb());
};
},
};
+3 -3
View File
@@ -4,9 +4,9 @@ import { PrometheusService } from "./provider-registry";
import logger from "../logger";
export class PrometheusHelm extends PrometheusLens {
id = "helm"
name = "Helm"
rateAccuracy = "5m"
id = "helm";
name = "Helm";
rateAccuracy = "5m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
const labelSelector = "app=prometheus,component=server,heritage=Helm";
+3 -3
View File
@@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusLens implements PrometheusProvider {
id = "lens"
name = "Lens"
rateAccuracy = "1m"
id = "lens";
name = "Lens";
rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {
+3 -3
View File
@@ -3,9 +3,9 @@ import { CoreV1Api, V1Service } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusOperator implements PrometheusProvider {
rateAccuracy = "1m"
id = "operator"
name = "Prometheus Operator"
rateAccuracy = "1m";
id = "operator";
name = "Prometheus Operator";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {
+9 -9
View File
@@ -11,7 +11,7 @@ export type PrometheusClusterQuery = {
cpuCapacity: string;
podUsage: string;
podCapacity: string;
}
};
export type PrometheusNodeQuery = {
memoryUsage: string;
@@ -20,7 +20,7 @@ export type PrometheusNodeQuery = {
cpuCapacity: string;
fsSize: string;
fsUsage: string;
}
};
export type PrometheusPodQuery = {
memoryUsage: string;
@@ -32,32 +32,32 @@ export type PrometheusPodQuery = {
fsUsage: string;
networkReceive: string;
networkTransmit: string;
}
};
export type PrometheusPvcQuery = {
diskUsage: string;
diskCapacity: string;
}
};
export type PrometheusIngressQuery = {
bytesSentSuccess: string;
bytesSentFailure: string;
requestDurationSeconds: string;
responseDurationSeconds: string;
}
};
export type PrometheusQueryOpts = {
[key: string]: string | any;
};
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery;
export type PrometheusService = {
id: string;
namespace: string;
service: string;
port: number;
}
};
export interface PrometheusProvider {
id: string;
@@ -68,10 +68,10 @@ export interface PrometheusProvider {
export type PrometheusProviderList = {
[key: string]: PrometheusProvider;
}
};
export class PrometheusProviderRegistry {
private static prometheusProviders: PrometheusProviderList = {}
private static prometheusProviders: PrometheusProviderList = {};
static getProvider(type: string): PrometheusProvider {
if (!this.prometheusProviders[type]) {
+3 -3
View File
@@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusStacklight implements PrometheusProvider {
id = "stacklight"
name = "Stacklight"
rateAccuracy = "1m"
id = "stacklight";
name = "Stacklight";
rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {
+1 -1
View File
@@ -5,7 +5,7 @@ import _ from "lodash";
export type IMetricsQuery = string | string[] | {
[metricName: string]: string;
}
};
// This is used for backoff retry tracking.
const MAX_ATTEMPTS = 5;
+9 -9
View File
@@ -8,7 +8,7 @@ import * as tcpPortUsed from "tcp-port-used";
import logger from "../logger";
class PortForward {
public static portForwards: PortForward[] = []
public static portForwards: PortForward[] = [];
static getPortforward(forward: {clusterId: string; kind: string; name: string; namespace: string; port: string}) {
return PortForward.portForwards.find((pf) => {
@@ -22,14 +22,14 @@ class PortForward {
});
}
public clusterId: string
public process: ChildProcessWithoutNullStreams
public kubeConfig: string
public kind: string
public namespace: string
public name: string
public port: string
public localPort: number
public clusterId: string;
public process: ChildProcessWithoutNullStreams;
public kubeConfig: string;
public kind: string;
public namespace: string;
public name: string;
public port: string;
public localPort: number;
constructor(obj: any) {
Object.assign(this, obj);
+6 -6
View File
@@ -6,12 +6,12 @@ import { Request } from "request";
import logger from "../logger";
class ApiWatcher {
private apiUrl: string
private response: ServerResponse
private watchRequest: Request
private watch: Watch
private processor: NodeJS.Timeout
private eventBuffer: any[] = []
private apiUrl: string;
private response: ServerResponse;
private watchRequest: Request;
private watch: Watch;
private processor: NodeJS.Timeout;
private eventBuffer: any[] = [];
constructor(apiUrl: string, kubeConfig: KubeConfig, response: ServerResponse) {
this.apiUrl = apiUrl;
+4 -4
View File
@@ -13,11 +13,11 @@ import { appEventBus } from "../common/event-bus";
import { userStore } from "../common/user-store";
export class ShellSession extends EventEmitter {
static shellEnvs: Map<string, any> = new Map()
static shellEnvs: Map<string, any> = new Map();
protected websocket: WebSocket
protected shellProcess: pty.IPty
protected kubeconfigPath: string
protected websocket: WebSocket;
protected shellProcess: pty.IPty;
protected kubeconfigPath: string;
protected nodeShellPod: string;
protected kubectl: Kubectl;
protected kubectlBinDir: string;