diff --git a/.eslintrc.js b/.eslintrc.js index 3c4e5a23b7..93e11c414b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -76,6 +76,10 @@ module.exports = { "avoidEscape": true, "allowTemplateLiterals": true, }], + "object-curly-spacing": ["error", "always", { + "objectsInObjects": false, + "arraysInObjects": true, + }], "linebreak-style": ["error", "unix"], "eol-last": ["error", "always"], "semi": ["error", "always"], @@ -90,7 +94,7 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "function" }, { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, - { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, + { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }, ], "no-template-curly-in-string": "error", } @@ -143,6 +147,11 @@ module.exports = { "avoidEscape": true, "allowTemplateLiterals": true, }], + "object-curly-spacing": "off", + "@typescript-eslint/object-curly-spacing": ["error", "always", { + "objectsInObjects": false, + "arraysInObjects": true, + }], "react/prop-types": "off", "semi": "off", "@typescript-eslint/semi": ["error"], @@ -160,7 +169,7 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "function" }, { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, - { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, + { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }, ], "no-template-curly-in-string": "error", }, @@ -220,6 +229,11 @@ module.exports = { "avoidEscape": true, "allowTemplateLiterals": true, }], + "object-curly-spacing": "off", + "@typescript-eslint/object-curly-spacing": ["error", "always", { + "objectsInObjects": false, + "arraysInObjects": true, + }], "react/prop-types": "off", "semi": "off", "@typescript-eslint/semi": ["error"], @@ -237,7 +251,7 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "function" }, { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, - { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, + { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }, ], "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "off", diff --git a/extensions/metrics-cluster-feature/renderer.tsx b/extensions/metrics-cluster-feature/renderer.tsx index 884f6cd7a2..1d4344e23e 100644 --- a/extensions/metrics-cluster-feature/renderer.tsx +++ b/extensions/metrics-cluster-feature/renderer.tsx @@ -31,7 +31,7 @@ export default class ClusterMetricsFeatureExtension extends Renderer.LensExtensi title: "Lens Metrics", priority: 5, components: { - View: ({ entity = null }: { entity: Common.Catalog.KubernetesCluster}) => { + View: ({ entity = null }: { entity: Common.Catalog.KubernetesCluster }) => { return ( ); diff --git a/extensions/metrics-cluster-feature/src/metrics-feature.ts b/extensions/metrics-cluster-feature/src/metrics-feature.ts index 3401773cdc..7027e4f200 100644 --- a/extensions/metrics-cluster-feature/src/metrics-feature.ts +++ b/extensions/metrics-cluster-feature/src/metrics-feature.ts @@ -92,11 +92,11 @@ export class MetricsFeature { } async getStatus(): Promise { - const status: MetricsStatus = { installed: false, canUpgrade: false}; + const status: MetricsStatus = { installed: false, canUpgrade: false }; try { const namespaceApi = forCluster(this.cluster, Namespace); - const namespace = await namespaceApi.get({name: "lens-metrics"}); + const namespace = await namespaceApi.get({ name: "lens-metrics" }); if (namespace?.kind) { const currentVersion = namespace.metadata.annotations?.extensionVersion || "0.0.0"; diff --git a/extensions/metrics-cluster-feature/src/metrics-settings.tsx b/extensions/metrics-cluster-feature/src/metrics-settings.tsx index f05854b0f2..b0c8bee9b6 100644 --- a/extensions/metrics-cluster-feature/src/metrics-settings.tsx +++ b/extensions/metrics-cluster-feature/src/metrics-settings.tsx @@ -114,7 +114,7 @@ export class MetricsSettings extends React.Component { const statefulSet = forCluster(this.props.cluster, StatefulSet); try { - await statefulSet.get({name: "prometheus", namespace: "lens-metrics"}); + await statefulSet.get({ name: "prometheus", namespace: "lens-metrics" }); this.featureStates.prometheus = true; } catch(e) { if (e?.error?.code === 404) { @@ -127,7 +127,7 @@ export class MetricsSettings extends React.Component { const deployment = forCluster(this.props.cluster, Deployment); try { - await deployment.get({name: "kube-state-metrics", namespace: "lens-metrics"}); + await deployment.get({ name: "kube-state-metrics", namespace: "lens-metrics" }); this.featureStates.kubeStateMetrics = true; } catch(e) { if (e?.error?.code === 404) { @@ -140,7 +140,7 @@ export class MetricsSettings extends React.Component { const daemonSet = forCluster(this.props.cluster, DaemonSet); try { - await daemonSet.get({name: "node-exporter", namespace: "lens-metrics"}); + await daemonSet.get({ name: "node-exporter", namespace: "lens-metrics" }); this.featureStates.nodeExporter = true; } catch(e) { if (e?.error?.code === 404) { @@ -207,14 +207,14 @@ export class MetricsSettings extends React.Component { <> { this.props.cluster.status.phase !== "connected" && (
-

+

Lens Metrics settings requires established connection to the cluster.

)} { !this.isActiveMetricsProvider && (
-

+

Other metrics provider is currently active. See "Metrics" tab for details.

diff --git a/src/common/__tests__/event-bus.test.ts b/src/common/__tests__/event-bus.test.ts index acc1b70d26..92e4d0628c 100644 --- a/src/common/__tests__/event-bus.test.ts +++ b/src/common/__tests__/event-bus.test.ts @@ -34,7 +34,7 @@ describe("event bus tests", () => { event = data; }); - appEventBus.emit({name: "foo", action: "bar"}); + appEventBus.emit({ name: "foo", action: "bar" }); expect(event.name).toBe("foo"); }); }); diff --git a/src/common/__tests__/kube-helpers.test.ts b/src/common/__tests__/kube-helpers.test.ts index 277398ee02..0bd417b167 100644 --- a/src/common/__tests__/kube-helpers.test.ts +++ b/src/common/__tests__/kube-helpers.test.ts @@ -174,7 +174,7 @@ describe("kube helpers", () => { }); it("multiple context is ok", async () => { - mockKubeConfig.contexts.push({context: {cluster: "cluster-2", user: "cluster-2"}, name: "cluster-2"}); + mockKubeConfig.contexts.push({ context: { cluster: "cluster-2", user: "cluster-2" }, name: "cluster-2" }); const { config } = loadConfigFromString(JSON.stringify(mockKubeConfig)); expect(config.getCurrentContext()).toBe("minikube"); @@ -209,7 +209,7 @@ describe("kube helpers", () => { }); it("empty name in context causes it to be removed", async () => { - mockKubeConfig.contexts.push({context: {cluster: "cluster-2", user: "cluster-2"}, name: ""}); + mockKubeConfig.contexts.push({ context: { cluster: "cluster-2", user: "cluster-2" }, name: "" }); expect(mockKubeConfig.contexts.length).toBe(2); const { config } = loadConfigFromString(JSON.stringify(mockKubeConfig)); @@ -218,7 +218,7 @@ describe("kube helpers", () => { }); it("empty cluster in context causes it to be removed", async () => { - mockKubeConfig.contexts.push({context: {cluster: "", user: "cluster-2"}, name: "cluster-2"}); + mockKubeConfig.contexts.push({ context: { cluster: "", user: "cluster-2" }, name: "cluster-2" }); expect(mockKubeConfig.contexts.length).toBe(2); const { config } = loadConfigFromString(JSON.stringify(mockKubeConfig)); @@ -227,7 +227,7 @@ describe("kube helpers", () => { }); it("empty user in context causes it to be removed", async () => { - mockKubeConfig.contexts.push({context: {cluster: "cluster-2", user: ""}, name: "cluster-2"}); + mockKubeConfig.contexts.push({ context: { cluster: "cluster-2", user: "" }, name: "cluster-2" }); expect(mockKubeConfig.contexts.length).toBe(2); const { config } = loadConfigFromString(JSON.stringify(mockKubeConfig)); @@ -236,8 +236,8 @@ describe("kube helpers", () => { }); it("invalid context in between valid contexts is removed", async () => { - mockKubeConfig.contexts.push({context: {cluster: "cluster-2", user: ""}, name: "cluster-2"}); - mockKubeConfig.contexts.push({context: {cluster: "cluster-3", user: "cluster-3"}, name: "cluster-3"}); + mockKubeConfig.contexts.push({ context: { cluster: "cluster-2", user: "" }, name: "cluster-2" }); + mockKubeConfig.contexts.push({ context: { cluster: "cluster-3", user: "cluster-3" }, name: "cluster-3" }); expect(mockKubeConfig.contexts.length).toBe(3); const { config } = loadConfigFromString(JSON.stringify(mockKubeConfig)); diff --git a/src/common/__tests__/user-store.test.ts b/src/common/__tests__/user-store.test.ts index adfe5ecf4b..2eb0329e72 100644 --- a/src/common/__tests__/user-store.test.ts +++ b/src/common/__tests__/user-store.test.ts @@ -52,7 +52,7 @@ AppPaths.init(); describe("user store tests", () => { describe("for an empty config", () => { beforeEach(() => { - mockFs({ tmp: { "config.json": "{}", "kube_config": "{}" } }); + mockFs({ tmp: { "config.json": "{}", "kube_config": "{}" }}); (UserStore.createInstance() as any).refreshNewContexts = jest.fn(() => Promise.resolve()); }); diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index f7b7de642d..b1a726fac2 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -73,8 +73,8 @@ export class HotbarStore extends BaseStore { protected fromStore(data: Partial = {}) { if (!data.hotbars || !data.hotbars.length) { const hotbar = getEmptyHotbar("Default"); - const { metadata: { uid, name, source } } = catalogEntity; - const initialItem = { entity: { uid, name, source } }; + const { metadata: { uid, name, source }} = catalogEntity; + const initialItem = { entity: { uid, name, source }}; hotbar.items[0] = initialItem; diff --git a/src/common/k8s-api/__tests__/deployment.api.test.ts b/src/common/k8s-api/__tests__/deployment.api.test.ts index 65d9c93434..a04df9cd85 100644 --- a/src/common/k8s-api/__tests__/deployment.api.test.ts +++ b/src/common/k8s-api/__tests__/deployment.api.test.ts @@ -41,7 +41,7 @@ describe("DeploymentApi", () => { it("requests Kubernetes API with PATCH verb and correct amount of replicas", () => { const patchSpy = jest.spyOn(requestMock, "patch"); - sub.scale({ namespace: "default", name: "deployment-1"}, 5); + sub.scale({ namespace: "default", name: "deployment-1" }, 5); expect(patchSpy).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/deployments/deployment-1/scale", { data: { diff --git a/src/common/k8s-api/__tests__/kube-object.test.ts b/src/common/k8s-api/__tests__/kube-object.test.ts index 230f5c9d79..cb2a412a5e 100644 --- a/src/common/k8s-api/__tests__/kube-object.test.ts +++ b/src/common/k8s-api/__tests__/kube-object.test.ts @@ -45,12 +45,12 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { apiVersion: "", metadata: {uid: "", name: "", resourceVersion: "", selfLink: ""} }], - ["apiVersion", { kind: "", metadata: {uid: "", name: "", resourceVersion: "", selfLink: ""} }], + ["kind", { apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], + ["apiVersion", { kind: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], ["metadata", { kind: "", apiVersion: "" }], - ["metadata.uid", { kind: "", apiVersion: "", metadata: { name: "", resourceVersion: "", selfLink: ""} }], - ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", resourceVersion: "", selfLink: "" } }], - ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", selfLink: "" } }], + ["metadata.uid", { kind: "", apiVersion: "", metadata: { name: "", resourceVersion: "", selfLink: "" }}], + ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", resourceVersion: "", selfLink: "" }}], + ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", selfLink: "" }}], ]; it.each(tests)("should reject with missing: %s", (missingField, input) => { @@ -61,23 +61,23 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { kind: 1, apiVersion: "", metadata: {} }], - ["apiVersion", { apiVersion: 1, kind: "", metadata: {} }], + ["kind", { kind: 1, apiVersion: "", metadata: {}}], + ["apiVersion", { apiVersion: 1, kind: "", metadata: {}}], ["metadata", { kind: "", apiVersion: "", metadata: "" }], - ["metadata.uid", { kind: "", apiVersion: "", metadata: { uid: 1 } }], - ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", name: 1 } }], - ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: 1 } }], - ["metadata.selfLink", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: 1 } }], - ["metadata.namespace", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", namespace: 1 } }], - ["metadata.creationTimestamp", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", creationTimestamp: 1 } }], - ["metadata.continue", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", continue: 1 } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: 1 } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: [1] } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: {} } }], - ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: 1 } }], - ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: { food: 1 } } }], - ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: 1 } }], - ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: 1 } } }], + ["metadata.uid", { kind: "", apiVersion: "", metadata: { uid: 1 }}], + ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", name: 1 }}], + ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: 1 }}], + ["metadata.selfLink", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: 1 }}], + ["metadata.namespace", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", namespace: 1 }}], + ["metadata.creationTimestamp", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", creationTimestamp: 1 }}], + ["metadata.continue", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", continue: 1 }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: 1 }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: [1] }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: {}}}], + ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: 1 }}], + ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: { food: 1 }}}], + ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: 1 }}], + ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: 1 }}}], ]; it.each(tests)("should reject with wrong type for field: %s", (missingField, input) => { @@ -86,7 +86,7 @@ describe("KubeObject", () => { } it("should accept valid KubeJsonApiData (ignoring other fields)", () => { - const valid = { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: "" } } }; + const valid = { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: "" }}}; expect(KubeObject.isJsonApiData(valid)).toBe(true); }); @@ -118,8 +118,8 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" } }], - ["apiVersion", { kind: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" } }], + ["kind", { apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], + ["apiVersion", { kind: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], ["metadata", { kind: "", apiVersion: "" }], ]; @@ -131,23 +131,23 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { kind: 1, apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" } }], - ["apiVersion", { apiVersion: 1, kind: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" } }], + ["kind", { kind: 1, apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], + ["apiVersion", { apiVersion: 1, kind: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "" }}], ["metadata", { kind: "", apiVersion: "", metadata: "" }], - ["metadata.uid", { kind: "", apiVersion: "", metadata: { uid: 1, name: "", resourceVersion: "", selfLink: "" } }], - ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", name: 1, resourceVersion: "", selfLink: "" } }], - ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: 1, selfLink: "" } }], - ["metadata.selfLink", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: 1 } }], - ["metadata.namespace", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", namespace: 1 } }], - ["metadata.creationTimestamp", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", creationTimestamp: 1 } }], - ["metadata.continue", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", continue: 1 } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: 1 } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: [1] } }], - ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: {} } }], - ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: 1 } }], - ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: { food: 1 } } }], - ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: 1 } }], - ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: 1 } } }], + ["metadata.uid", { kind: "", apiVersion: "", metadata: { uid: 1, name: "", resourceVersion: "", selfLink: "" }}], + ["metadata.name", { kind: "", apiVersion: "", metadata: { uid: "", name: 1, resourceVersion: "", selfLink: "" }}], + ["metadata.resourceVersion", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: 1, selfLink: "" }}], + ["metadata.selfLink", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: 1 }}], + ["metadata.namespace", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", namespace: 1 }}], + ["metadata.creationTimestamp", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", creationTimestamp: 1 }}], + ["metadata.continue", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", continue: 1 }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: 1 }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: [1] }}], + ["metadata.finalizers", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", finalizers: {}}}], + ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: 1 }}], + ["metadata.labels", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", labels: { food: 1 }}}], + ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: 1 }}], + ["metadata.annotations", { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: 1 }}}], ]; it.each(tests)("should reject with wrong type for field: %s", (missingField, input) => { @@ -156,7 +156,7 @@ describe("KubeObject", () => { } it("should accept valid Partial (ignoring other fields)", () => { - const valid = { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: "" } } }; + const valid = { kind: "", apiVersion: "", metadata: { uid: "", name: "", resourceVersion: "", selfLink: "", annotations: { food: "" }}}; expect(KubeObject.isPartialJsonApiData(valid)).toBe(true); }); @@ -197,8 +197,8 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { apiVersion: "", items: [], metadata: { resourceVersion: "", selfLink: "" } }], - ["apiVersion", { kind: "", items: [], metadata: { resourceVersion: "", selfLink: "" } }], + ["kind", { apiVersion: "", items: [], metadata: { resourceVersion: "", selfLink: "" }}], + ["apiVersion", { kind: "", items: [], metadata: { resourceVersion: "", selfLink: "" }}], ["metadata", { kind: "", items: [], apiVersion: "" }], ]; @@ -210,15 +210,15 @@ describe("KubeObject", () => { { type TestCase = [string, any]; const tests: TestCase[] = [ - ["kind", { kind: 1, items: [], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }], - ["apiVersion", { kind: "", items: [], apiVersion: 1, metadata: { resourceVersion: "", selfLink: "" } }], + ["kind", { kind: 1, items: [], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}], + ["apiVersion", { kind: "", items: [], apiVersion: 1, metadata: { resourceVersion: "", selfLink: "" }}], ["metadata", { kind: "", items: [], apiVersion: "", metadata: 1 }], - ["metadata.resourceVersion", { kind: "", items: [], apiVersion: "", metadata: { resourceVersion: 1, selfLink: "" } }], - ["metadata.selfLink", { kind: "", items: [], apiVersion: "", metadata: { resourceVersion: "", selfLink: 1 } }], - ["items", { kind: "", items: 1, apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }], - ["items", { kind: "", items: "", apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }], - ["items", { kind: "", items: {}, apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }], - ["items[0]", { kind: "", items: [""], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }], + ["metadata.resourceVersion", { kind: "", items: [], apiVersion: "", metadata: { resourceVersion: 1, selfLink: "" }}], + ["metadata.selfLink", { kind: "", items: [], apiVersion: "", metadata: { resourceVersion: "", selfLink: 1 }}], + ["items", { kind: "", items: 1, apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}], + ["items", { kind: "", items: "", apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}], + ["items", { kind: "", items: {}, apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}], + ["items[0]", { kind: "", items: [""], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}], ]; it.each(tests)("should reject with wrong type for field: %s", (missingField, input) => { @@ -227,7 +227,7 @@ describe("KubeObject", () => { } it("should accept valid KubeJsonApiDataList (ignoring other fields)", () => { - const valid = { kind: "", items: [false], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" } }; + const valid = { kind: "", items: [false], apiVersion: "", metadata: { resourceVersion: "", selfLink: "" }}; expect(KubeObject.isJsonApiDataList(valid, isBoolean)).toBe(true); }); diff --git a/src/common/k8s-api/__tests__/stateful-set.api.test.ts b/src/common/k8s-api/__tests__/stateful-set.api.test.ts index d1b90be181..1c926a7a19 100644 --- a/src/common/k8s-api/__tests__/stateful-set.api.test.ts +++ b/src/common/k8s-api/__tests__/stateful-set.api.test.ts @@ -41,7 +41,7 @@ describe("StatefulSetApi", () => { it("requests Kubernetes API with PATCH verb and correct amount of replicas", () => { const patchSpy = jest.spyOn(requestMock, "patch"); - sub.scale({ namespace: "default", name: "statefulset-1"}, 5); + sub.scale({ namespace: "default", name: "statefulset-1" }, 5); expect(patchSpy).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale", { data: { diff --git a/src/common/k8s-api/endpoints/crd.api.ts b/src/common/k8s-api/endpoints/crd.api.ts index 98c8d38df0..e12d7069ed 100644 --- a/src/common/k8s-api/endpoints/crd.api.ts +++ b/src/common/k8s-api/endpoints/crd.api.ts @@ -163,7 +163,7 @@ export class CustomResourceDefinition extends KubeObject { } } else if (this.spec.version) { const { additionalPrinterColumns: apc } = this.spec; - const additionalPrinterColumns = apc?.map(({ JSONPath, ...apc}) => ({ ...apc, jsonPath: JSONPath })); + const additionalPrinterColumns = apc?.map(({ JSONPath, ...apc }) => ({ ...apc, jsonPath: JSONPath })); return { name: this.spec.version, diff --git a/src/common/k8s-api/endpoints/deployment.api.ts b/src/common/k8s-api/endpoints/deployment.api.ts index 721db669b7..17a5456c2d 100644 --- a/src/common/k8s-api/endpoints/deployment.api.ts +++ b/src/common/k8s-api/endpoints/deployment.api.ts @@ -61,7 +61,7 @@ export class DeploymentApi extends KubeApi { spec: { template: { metadata: { - annotations: {"kubectl.kubernetes.io/restartedAt" : moment.utc().format()} + annotations: { "kubectl.kubernetes.io/restartedAt" : moment.utc().format() } } } } @@ -122,7 +122,7 @@ export class Deployment extends WorkloadKubeObject { declare spec: { replicas: number; - selector: { matchLabels: { [app: string]: string } }; + selector: { matchLabels: { [app: string]: string }}; template: { metadata: { creationTimestamp?: string; diff --git a/src/common/k8s-api/endpoints/endpoint.api.ts b/src/common/k8s-api/endpoints/endpoint.api.ts index e6dceb2b8f..ce3bf1ceff 100644 --- a/src/common/k8s-api/endpoints/endpoint.api.ts +++ b/src/common/k8s-api/endpoints/endpoint.api.ts @@ -83,7 +83,7 @@ export class EndpointAddress implements IEndpointAddress { getTargetRef(): ITargetRef { if (this.targetRef) { - return Object.assign(this.targetRef, {apiVersion: "v1"}); + return Object.assign(this.targetRef, { apiVersion: "v1" }); } else { return null; } diff --git a/src/common/k8s-api/endpoints/ingress.api.ts b/src/common/k8s-api/endpoints/ingress.api.ts index cf607fa144..2644fecf57 100644 --- a/src/common/k8s-api/endpoints/ingress.api.ts +++ b/src/common/k8s-api/endpoints/ingress.api.ts @@ -128,7 +128,7 @@ export class Ingress extends KubeObject { } getRoutes() { - const { spec: { tls, rules } } = this; + const { spec: { tls, rules }} = this; if (!rules) return []; @@ -165,7 +165,7 @@ export class Ingress extends KubeObject { } getHosts() { - const { spec: { rules } } = this; + const { spec: { rules }} = this; if (!rules) return []; @@ -174,7 +174,7 @@ export class Ingress extends KubeObject { getPorts() { const ports: number[] = []; - const { spec: { tls, rules, backend, defaultBackend } } = this; + const { spec: { tls, rules, backend, defaultBackend }} = this; const httpPort = 80; const tlsPort = 443; // Note: not using the port name (string) @@ -196,7 +196,7 @@ export class Ingress extends KubeObject { } getLoadBalancers() { - const { status: { loadBalancer = { ingress: [] } } } = this; + const { status: { loadBalancer = { ingress: [] }}} = this; return (loadBalancer.ingress ?? []).map(address => ( address.hostname || address.ip diff --git a/src/common/k8s-api/endpoints/nodes.api.ts b/src/common/k8s-api/endpoints/nodes.api.ts index bd09044776..094fa23784 100644 --- a/src/common/k8s-api/endpoints/nodes.api.ts +++ b/src/common/k8s-api/endpoints/nodes.api.ts @@ -30,7 +30,7 @@ export class NodesApi extends KubeApi { } export function getMetricsForAllNodes(): Promise { - const opts = { category: "nodes"}; + const opts = { category: "nodes" }; return metricsApi.getMetrics({ memoryUsage: opts, diff --git a/src/common/k8s-api/endpoints/poddisruptionbudget.api.ts b/src/common/k8s-api/endpoints/poddisruptionbudget.api.ts index 1e57c1a3ec..0199aff815 100644 --- a/src/common/k8s-api/endpoints/poddisruptionbudget.api.ts +++ b/src/common/k8s-api/endpoints/poddisruptionbudget.api.ts @@ -29,7 +29,7 @@ export interface PodDisruptionBudget { spec: { minAvailable: string; maxUnavailable: string; - selector: { matchLabels: { [app: string]: string } }; + selector: { matchLabels: { [app: string]: string }}; }; status: { currentHealthy: number diff --git a/src/common/k8s-api/endpoints/pods.api.ts b/src/common/k8s-api/endpoints/pods.api.ts index 70fad21b4b..cdff83b271 100644 --- a/src/common/k8s-api/endpoints/pods.api.ts +++ b/src/common/k8s-api/endpoints/pods.api.ts @@ -411,7 +411,7 @@ export class Pod extends WorkloadKubeObject { } getNodeSelectors(): string[] { - const { nodeSelector = {} } = this.spec; + const { nodeSelector = {}} = this.spec; return Object.entries(nodeSelector).map(values => values.join(": ")); } diff --git a/src/common/k8s-api/endpoints/replica-set.api.ts b/src/common/k8s-api/endpoints/replica-set.api.ts index eeaf361557..90fedc5136 100644 --- a/src/common/k8s-api/endpoints/replica-set.api.ts +++ b/src/common/k8s-api/endpoints/replica-set.api.ts @@ -78,7 +78,7 @@ export class ReplicaSet extends WorkloadKubeObject { declare spec: { replicas?: number; - selector: { matchLabels: { [app: string]: string } }; + selector: { matchLabels: { [app: string]: string }}; template?: { metadata: { labels: { diff --git a/src/common/k8s-api/kube-object.store.ts b/src/common/k8s-api/kube-object.store.ts index 6cf5ff6705..13545874e3 100644 --- a/src/common/k8s-api/kube-object.store.ts +++ b/src/common/k8s-api/kube-object.store.ts @@ -375,8 +375,8 @@ export abstract class KubeObjectStore extends ItemStore timedRetry = setTimeout(() => { ( namespace - ? this.loadAll({ namespaces: [namespace], reqInit: { signal } }) - : this.loadAll({ merge: false, reqInit: { signal } }) + ? this.loadAll({ namespaces: [namespace], reqInit: { signal }}) + : this.loadAll({ merge: false, reqInit: { signal }}) ).then(watch); }, 1000); } else if (error) { // not sure what to do, best to retry diff --git a/src/common/k8s-api/kube-watch-api.ts b/src/common/k8s-api/kube-watch-api.ts index 5ce16dcfbd..bcb7c48de2 100644 --- a/src/common/k8s-api/kube-watch-api.ts +++ b/src/common/k8s-api/kube-watch-api.ts @@ -134,7 +134,7 @@ export class KubeWatchApi { }; } - protected log({ message, cssStyle = "", meta = {} }: IKubeWatchLog) { + protected log({ message, cssStyle = "", meta = {}}: IKubeWatchLog) { if (isProduction && !isDebugging) { return; } diff --git a/src/common/user-store/preferences-helpers.ts b/src/common/user-store/preferences-helpers.ts index 72e08faa42..998d7b1214 100644 --- a/src/common/user-store/preferences-helpers.ts +++ b/src/common/user-store/preferences-helpers.ts @@ -24,7 +24,7 @@ import path from "path"; import os from "os"; import { ThemeStore } from "../../renderer/theme.store"; import { getAppVersion, ObservableToggleSet } from "../utils"; -import type {monaco} from "react-monaco-editor"; +import type { monaco } from "react-monaco-editor"; import merge from "lodash/merge"; import { SemVer } from "semver"; diff --git a/src/common/user-store/user-store.ts b/src/common/user-store/user-store.ts index 40f230ccbd..d6626b3390 100644 --- a/src/common/user-store/user-store.ts +++ b/src/common/user-store/user-store.ts @@ -92,7 +92,7 @@ export class UserStore extends BaseStore /* implements UserStore /** * Monaco editor configs */ - @observable editorConfiguration:EditorConfiguration = {tabSize: null, miniMap: null, lineNumbers: null}; + @observable editorConfiguration:EditorConfiguration = { tabSize: null, miniMap: null, lineNumbers: null }; /** * The set of file/folder paths to be synced diff --git a/src/common/utils/autobind.ts b/src/common/utils/autobind.ts index cdb6903259..583d4c4bc5 100644 --- a/src/common/utils/autobind.ts +++ b/src/common/utils/autobind.ts @@ -19,7 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import {boundMethod, boundClass} from "autobind-decorator"; +import { boundMethod, boundClass } from "autobind-decorator"; import autoBindClass, { Options } from "auto-bind"; import autoBindReactClass from "auto-bind/react"; diff --git a/src/extensions/__tests__/extension-compatibility.test.ts b/src/extensions/__tests__/extension-compatibility.test.ts index d8e789a9d9..d03fcbe712 100644 --- a/src/extensions/__tests__/extension-compatibility.test.ts +++ b/src/extensions/__tests__/extension-compatibility.test.ts @@ -37,7 +37,7 @@ describe("extension compatibility", () => { }); it("has no extension comparator", () => { - const manifest = { name: "extensionName", version: "0.0.1"}; + const manifest = { name: "extensionName", version: "0.0.1" }; expect(isCompatibleExtension(manifest,)).toBe(false); }); @@ -76,7 +76,7 @@ describe("extension compatibility", () => { expected: false, }, ])("extension comparator test: %p", ({ comparator, expected }) => { - const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator}}; + const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator }}; expect(isCompatibleExtension(manifest,)).toBe(expected); }); @@ -91,7 +91,7 @@ describe("extension compatibility", () => { }); it("has no extension comparator", () => { - const manifest = { name: "extensionName", version: "0.0.1"}; + const manifest = { name: "extensionName", version: "0.0.1" }; expect(isCompatibleExtension(manifest,)).toBe(false); }); @@ -130,7 +130,7 @@ describe("extension compatibility", () => { expected: false, }, ])("extension comparator test: %p", ({ comparator, expected }) => { - const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator}}; + const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator }}; expect(isCompatibleExtension(manifest,)).toBe(expected); }); diff --git a/src/extensions/extensions-store.ts b/src/extensions/extensions-store.ts index be40181242..681735bfbb 100644 --- a/src/extensions/extensions-store.ts +++ b/src/extensions/extensions-store.ts @@ -45,8 +45,8 @@ export class ExtensionsStore extends BaseStore { @computed get enabledExtensions() { return Array.from(this.state.values()) - .filter(({enabled}) => enabled) - .map(({name}) => name); + .filter(({ enabled }) => enabled) + .map(({ name }) => name); } protected state = observable.map(); diff --git a/src/extensions/ipc/ipc-main.ts b/src/extensions/ipc/ipc-main.ts index 09d26b00fb..05d225cb7c 100644 --- a/src/extensions/ipc/ipc-main.ts +++ b/src/extensions/ipc/ipc-main.ts @@ -44,12 +44,12 @@ export abstract class IpcMain extends IpcRegistrar { listen(channel: string, listener: (event: Electron.IpcRendererEvent, ...args: any[]) => any): Disposer { const prefixedChannel = `extensions@${this[IpcPrefix]}:${channel}`; const cleanup = once(() => { - logger.info(`[IPC-RENDERER]: removing extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + logger.info(`[IPC-RENDERER]: removing extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); return ipcMain.removeListener(prefixedChannel, listener); }); - logger.info(`[IPC-RENDERER]: adding extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + logger.info(`[IPC-RENDERER]: adding extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); ipcMain.addListener(prefixedChannel, listener); this.extension[Disposers].push(cleanup); @@ -64,10 +64,10 @@ export abstract class IpcMain extends IpcRegistrar { handle(channel: string, handler: (event: Electron.IpcMainInvokeEvent, ...args: any[]) => any): void { const prefixedChannel = `extensions@${this[IpcPrefix]}:${channel}`; - logger.info(`[IPC-RENDERER]: adding extension handler`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + logger.info(`[IPC-RENDERER]: adding extension handler`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); ipcMainHandle(prefixedChannel, handler); this.extension[Disposers].push(() => { - logger.info(`[IPC-RENDERER]: removing extension handler`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + logger.info(`[IPC-RENDERER]: removing extension handler`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); return ipcMain.removeHandler(prefixedChannel); }); diff --git a/src/extensions/ipc/ipc-renderer.ts b/src/extensions/ipc/ipc-renderer.ts index 364ebc5d73..6ec4b870b7 100644 --- a/src/extensions/ipc/ipc-renderer.ts +++ b/src/extensions/ipc/ipc-renderer.ts @@ -44,12 +44,12 @@ export abstract class IpcRenderer extends IpcRegistrar { listen(channel: string, listener: (event: Electron.IpcRendererEvent, ...args: any[]) => any): Disposer { const prefixedChannel = `extensions@${this[IpcPrefix]}:${channel}`; const cleanup = once(() => { - console.info(`[IPC-RENDERER]: removing extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + console.info(`[IPC-RENDERER]: removing extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); return ipcRenderer.removeListener(prefixedChannel, listener); }); - console.info(`[IPC-RENDERER]: adding extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version } }); + console.info(`[IPC-RENDERER]: adding extension listener`, { channel, extension: { name: this.extension.name, version: this.extension.version }}); ipcRenderer.addListener(prefixedChannel, listener); this.extension[Disposers].push(cleanup); diff --git a/src/extensions/registries/page-registry.ts b/src/extensions/registries/page-registry.ts index 3e97d15c3f..006e5b8e38 100644 --- a/src/extensions/registries/page-registry.ts +++ b/src/extensions/registries/page-registry.ts @@ -66,7 +66,7 @@ export interface RegisteredPage { } export function getExtensionPageUrl(target: PageTarget): string { - const { extensionId, pageId = "", params: targetParams = {} } = target; + const { extensionId, pageId = "", params: targetParams = {}} = target; const pagePath = ["/extension", sanitizeExtensionName(extensionId), pageId] .filter(Boolean) diff --git a/src/main/catalog-sources/kubeconfig-sync.ts b/src/main/catalog-sources/kubeconfig-sync.ts index 14d7bef128..6fe7131f99 100644 --- a/src/main/catalog-sources/kubeconfig-sync.ts +++ b/src/main/catalog-sources/kubeconfig-sync.ts @@ -212,7 +212,7 @@ export function computeDiff(contents: string, source: RootSource, filePath: stri // add new clusters to the source try { const clusterId = createHash("md5").update(`${filePath}:${contextName}`).digest("hex"); - const cluster = ClusterStore.getInstance().getById(clusterId) || new Cluster({ ...model, id: clusterId}); + const cluster = ClusterStore.getInstance().getById(clusterId) || new Cluster({ ...model, id: clusterId }); if (!cluster.apiUrl) { throw new Error("Cluster constructor failed, see above error"); diff --git a/src/main/catalog-sources/weblinks.ts b/src/main/catalog-sources/weblinks.ts index c8e983f3be..a740a1e560 100644 --- a/src/main/catalog-sources/weblinks.ts +++ b/src/main/catalog-sources/weblinks.ts @@ -100,7 +100,7 @@ export function syncWeblinks() { webLinkEntities.delete(weblinkId); } } - }, {fireImmediately: true}); + }, { fireImmediately: true }); catalogEntityRegistry.addComputedSource("weblinks", computed(() => Array.from(webLinkEntities.values(), ([link]) => link))); } diff --git a/src/main/cluster-detectors/detector-registry.ts b/src/main/cluster-detectors/detector-registry.ts index 5d3461b0bb..5f4f12175e 100644 --- a/src/main/cluster-detectors/detector-registry.ts +++ b/src/main/cluster-detectors/detector-registry.ts @@ -35,7 +35,7 @@ export class DetectorRegistry extends Singleton { } async detectForCluster(cluster: Cluster): Promise { - const results: {[key: string]: ClusterDetectionResult } = {}; + const results: { [key: string]: ClusterDetectionResult } = {}; for (const detectorClass of this.registry) { const detector = new detectorClass(cluster); diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index 98173ef81c..6ad2df8815 100644 --- a/src/main/cluster-detectors/distribution-detector.ts +++ b/src/main/cluster-detectors/distribution-detector.ts @@ -30,86 +30,86 @@ export class DistributionDetector extends BaseClusterDetector { this.version = await this.getKubernetesVersion(); if (this.isRke()) { - return { value: "rke", accuracy: 80}; + return { value: "rke", accuracy: 80 }; } if (this.isRancherDesktop()) { - return { value: "rancher-desktop", accuracy: 80}; + return { value: "rancher-desktop", accuracy: 80 }; } if (this.isK3s()) { - return { value: "k3s", accuracy: 80}; + return { value: "k3s", accuracy: 80 }; } if (this.isGKE()) { - return { value: "gke", accuracy: 80}; + return { value: "gke", accuracy: 80 }; } if (this.isEKS()) { - return { value: "eks", accuracy: 80}; + return { value: "eks", accuracy: 80 }; } if (this.isIKS()) { - return { value: "iks", accuracy: 80}; + return { value: "iks", accuracy: 80 }; } if (this.isAKS()) { - return { value: "aks", accuracy: 80}; + return { value: "aks", accuracy: 80 }; } if (this.isDigitalOcean()) { - return { value: "digitalocean", accuracy: 90}; + return { value: "digitalocean", accuracy: 90 }; } if (this.isK0s()) { - return { value: "k0s", accuracy: 80}; + return { value: "k0s", accuracy: 80 }; } if (this.isVMWare()) { - return { value: "vmware", accuracy: 90}; + return { value: "vmware", accuracy: 90 }; } if (this.isMirantis()) { - return { value: "mirantis", accuracy: 90}; + return { value: "mirantis", accuracy: 90 }; } if (this.isAlibaba()) { - return { value: "alibaba", accuracy: 90}; + return { value: "alibaba", accuracy: 90 }; } if (this.isHuawei()) { - return { value: "huawei", accuracy: 90}; + return { value: "huawei", accuracy: 90 }; } if (this.isTke()) { - return { value: "tencent", accuracy: 90}; + return { value: "tencent", accuracy: 90 }; } if (this.isMinikube()) { - return { value: "minikube", accuracy: 80}; + return { value: "minikube", accuracy: 80 }; } if (this.isMicrok8s()) { - return { value: "microk8s", accuracy: 80}; + return { value: "microk8s", accuracy: 80 }; } if (this.isKind()) { - return { value: "kind", accuracy: 70}; + return { value: "kind", accuracy: 70 }; } if (this.isDockerDesktop()) { - return { value: "docker-desktop", accuracy: 80}; + return { value: "docker-desktop", accuracy: 80 }; } if (this.isCustom() && await this.isOpenshift()) { - return { value: "openshift", accuracy: 90}; + return { value: "openshift", accuracy: 90 }; } if (this.isCustom()) { - return { value: "custom", accuracy: 10}; + return { value: "custom", accuracy: 10 }; } - return { value: "unknown", accuracy: 10}; + return { value: "unknown", accuracy: 10 }; } public async getKubernetesVersion() { diff --git a/src/main/cluster-detectors/nodes-count-detector.ts b/src/main/cluster-detectors/nodes-count-detector.ts index 2cb224b46a..75f478549b 100644 --- a/src/main/cluster-detectors/nodes-count-detector.ts +++ b/src/main/cluster-detectors/nodes-count-detector.ts @@ -29,7 +29,7 @@ export class NodesCountDetector extends BaseClusterDetector { if (!this.cluster.accessible) return null; const nodeCount = await this.getNodeCount(); - return { value: nodeCount, accuracy: 100}; + return { value: nodeCount, accuracy: 100 }; } protected async getNodeCount(): Promise { diff --git a/src/main/cluster-detectors/version-detector.ts b/src/main/cluster-detectors/version-detector.ts index 36d7e06dd1..ecabb1ec49 100644 --- a/src/main/cluster-detectors/version-detector.ts +++ b/src/main/cluster-detectors/version-detector.ts @@ -29,7 +29,7 @@ export class VersionDetector extends BaseClusterDetector { public async detect() { const version = await this.getKubernetesVersion(); - return { value: version, accuracy: 100}; + return { value: version, accuracy: 100 }; } public async getKubernetesVersion() { diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 4ac4074ca5..76197ade77 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -651,7 +651,7 @@ export class Cluster implements ClusterModel, ClusterState { const api = (await this.getProxyKubeconfig()).makeApiClient(CoreV1Api); try { - const { body: { items } } = await api.listNamespace(); + const { body: { items }} = await api.listNamespace(); const namespaces = items.map(ns => ns.metadata.name); return namespaces; diff --git a/src/main/extension-filesystem.ts b/src/main/extension-filesystem.ts index 849165afa4..97c8bf06a3 100644 --- a/src/main/extension-filesystem.ts +++ b/src/main/extension-filesystem.ts @@ -68,7 +68,7 @@ export class FilesystemProvisionerStore extends BaseStore { } @action - protected fromStore({ extensions }: FSProvisionModel = { extensions: {} }): void { + protected fromStore({ extensions }: FSProvisionModel = { extensions: {}}): void { this.registeredExtensions.merge(extensions); } diff --git a/src/main/prometheus/provider-registry.ts b/src/main/prometheus/provider-registry.ts index be4dcef737..c63fa0cc39 100644 --- a/src/main/prometheus/provider-registry.ts +++ b/src/main/prometheus/provider-registry.ts @@ -46,7 +46,7 @@ export abstract class PrometheusProvider { protected async getFirstNamespacedServer(client: CoreV1Api, ...selectors: string[]): Promise { try { for (const selector of selectors) { - const { body: { items: [service] } } = await client.listServiceForAllNamespaces(null, null, null, selector); + const { body: { items: [service] }} = await client.listServiceForAllNamespaces(null, null, null, selector); if (service) { return { diff --git a/src/main/router.ts b/src/main/router.ts index 9a7ded8a37..bab5647506 100644 --- a/src/main/router.ts +++ b/src/main/router.ts @@ -122,7 +122,7 @@ export class Router { }; } - protected static async handleStaticFile({ params, response, raw: { req } }: LensApiRequest): Promise { + protected static async handleStaticFile({ params, response, raw: { req }}: LensApiRequest): Promise { let filePath = params.path; for (let retryCount = 0; retryCount < 5; retryCount += 1) { diff --git a/src/main/routes/kubeconfig-route.ts b/src/main/routes/kubeconfig-route.ts index f4bd7f038e..91f9eea00b 100644 --- a/src/main/routes/kubeconfig-route.ts +++ b/src/main/routes/kubeconfig-route.ts @@ -63,7 +63,7 @@ function generateKubeConfig(username: string, secret: V1Secret, cluster: Cluster export class KubeconfigRoute { static async routeServiceAccountRoute(request: LensApiRequest) { - const { params, response, cluster} = request; + const { params, response, cluster } = request; const client = (await cluster.getProxyKubeconfig()).makeApiClient(CoreV1Api); const secretList = await client.listNamespacedSecret(params.namespace); const secret = secretList.body.items.find(secret => { diff --git a/src/main/routes/version-route.ts b/src/main/routes/version-route.ts index 14a1624489..fa92509d0e 100644 --- a/src/main/routes/version-route.ts +++ b/src/main/routes/version-route.ts @@ -27,6 +27,6 @@ export class VersionRoute { static async getVersion(request: LensApiRequest) { const { response } = request; - respondJson(response, { version: getAppVersion()}, 200); + respondJson(response, { version: getAppVersion() }, 200); } } diff --git a/src/migrations/cluster-store/2.4.1.ts b/src/migrations/cluster-store/2.4.1.ts index 192f7f3dc8..71ac22551f 100644 --- a/src/migrations/cluster-store/2.4.1.ts +++ b/src/migrations/cluster-store/2.4.1.ts @@ -32,7 +32,7 @@ export default { if (contextName === "__internal__") continue; const cluster = value[1]; - store.set(contextName, { kubeConfig: cluster.kubeConfig, icon: cluster.icon || null, preferences: cluster.preferences || {} }); + store.set(contextName, { kubeConfig: cluster.kubeConfig, icon: cluster.icon || null, preferences: cluster.preferences || {}}); } } } as MigrationDeclaration; diff --git a/src/migrations/hotbar-store/5.0.0-alpha.0.ts b/src/migrations/hotbar-store/5.0.0-alpha.0.ts index 4ba145b662..016fd02671 100644 --- a/src/migrations/hotbar-store/5.0.0-alpha.0.ts +++ b/src/migrations/hotbar-store/5.0.0-alpha.0.ts @@ -28,9 +28,9 @@ export default { version: "5.0.0-alpha.0", run(store) { const hotbar = getEmptyHotbar("default"); - const { metadata: { uid, name, source } } = catalogEntity; + const { metadata: { uid, name, source }} = catalogEntity; - hotbar.items[0] = { entity: { uid, name, source } }; + hotbar.items[0] = { entity: { uid, name, source }}; store.set("hotbars", [hotbar]); } diff --git a/src/migrations/hotbar-store/5.0.0-beta.10.ts b/src/migrations/hotbar-store/5.0.0-beta.10.ts index e5691d3622..f915ac5619 100644 --- a/src/migrations/hotbar-store/5.0.0-beta.10.ts +++ b/src/migrations/hotbar-store/5.0.0-beta.10.ts @@ -53,9 +53,9 @@ export default { // Hotbars might be empty, if some of the previous migrations weren't run if (hotbars.length === 0) { const hotbar = getEmptyHotbar("default"); - const { metadata: { uid, name, source } } = catalogEntity; + const { metadata: { uid, name, source }} = catalogEntity; - hotbar.items[0] = { entity: { uid, name, source } }; + hotbar.items[0] = { entity: { uid, name, source }}; hotbars.push(hotbar); } @@ -132,7 +132,7 @@ export default { if (hotbars.every(hotbar => hotbar.items.every(item => item?.entity?.uid !== "catalog-entity"))) { // note, we will add a new whole hotbar here called "default" if that was previously removed const defaultHotbar = hotbars.find(hotbar => hotbar.name === "default"); - const { metadata: { uid, name, source } } = catalogEntity; + const { metadata: { uid, name, source }} = catalogEntity; if (defaultHotbar) { const freeIndex = defaultHotbar.items.findIndex(isNull); @@ -142,15 +142,15 @@ export default { // called "default" is full than overriding a hotbar item const hotbar = getEmptyHotbar("initial"); - hotbar.items[0] = { entity: { uid, name, source } }; + hotbar.items[0] = { entity: { uid, name, source }}; hotbars.unshift(hotbar); } else { - defaultHotbar.items[freeIndex] = { entity: { uid, name, source } }; + defaultHotbar.items[freeIndex] = { entity: { uid, name, source }}; } } else { const hotbar = getEmptyHotbar("default"); - hotbar.items[0] = { entity: { uid, name, source } }; + hotbar.items[0] = { entity: { uid, name, source }}; hotbars.unshift(hotbar); } } diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index 1a29faa0ae..afd8f8c788 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -110,7 +110,7 @@ export async function bootstrap(comp: () => Promise) { const { base, ...params } = cloudsMidnight; const baseTheme = base as monaco.editor.BuiltinTheme; - monaco.editor.defineTheme("clouds-midnight", {base: baseTheme, ...params}); + monaco.editor.defineTheme("clouds-midnight", { base: baseTheme, ...params }); // ThemeStore depends on: UserStore ThemeStore.createInstance(); diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index 3c3562edbe..b7f3a3415b 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -124,7 +124,7 @@ export class AddCluster extends React.Component {

{ try { this.abortController?.abort(); this.abortController = new AbortController(); - const { chart: { name, repo } } = this.props; + const { chart: { name, repo }} = this.props; const { readme } = await getChartDetails(repo, name, { version: chart.version, reqInit: { signal: this.abortController.signal }}); this.readme = readme; diff --git a/src/renderer/components/+apps-helm-charts/helm-charts.tsx b/src/renderer/components/+apps-helm-charts/helm-charts.tsx index da5f9f8c5a..8b0930c180 100644 --- a/src/renderer/components/+apps-helm-charts/helm-charts.tsx +++ b/src/renderer/components/+apps-helm-charts/helm-charts.tsx @@ -50,7 +50,7 @@ export class HelmCharts extends Component { } get selectedChart() { - const { match: { params: { chartName, repo } } } = this.props; + const { match: { params: { chartName, repo }}} = this.props; return helmChartStore.getByName(chartName, repo); } diff --git a/src/renderer/components/+apps-releases/release-details.tsx b/src/renderer/components/+apps-releases/release-details.tsx index aa04d895c1..ea0583f55c 100644 --- a/src/renderer/components/+apps-releases/release-details.tsx +++ b/src/renderer/components/+apps-releases/release-details.tsx @@ -169,8 +169,8 @@ export class ReleaseDetails extends Component { value={values} onChange={text => this.values = text} theme={ThemeStore.getInstance().activeTheme.monacoTheme} - className={cssNames("MonacoEditor", {loading: valuesLoading})} - options={{readOnly: valuesLoading, ...UserStore.getInstance().getEditorOptions()}} + className={cssNames("MonacoEditor", { loading: valuesLoading })} + options={{ readOnly: valuesLoading, ...UserStore.getInstance().getEditorOptions() }} > {valuesLoading && } diff --git a/src/renderer/components/+apps-releases/releases.tsx b/src/renderer/components/+apps-releases/releases.tsx index b7777b8c67..1c8790d9a3 100644 --- a/src/renderer/components/+apps-releases/releases.tsx +++ b/src/renderer/components/+apps-releases/releases.tsx @@ -55,7 +55,7 @@ interface Props extends RouteComponentProps { @observer export class HelmReleases extends Component { componentDidMount() { - const { match: { params: { namespace } } } = this.props; + const { match: { params: { namespace }}} = this.props; if (namespace) { namespaceStore.selectNamespaces(namespace); @@ -68,7 +68,7 @@ export class HelmReleases extends Component { } get selectedRelease() { - const { match: { params: { name, namespace } } } = this.props; + const { match: { params: { name, namespace }}} = this.props; return releaseStore.items.find(release => { return release.getName() == name && release.getNs() == namespace; diff --git a/src/renderer/components/+catalog/catalog-entity.store.tsx b/src/renderer/components/+catalog/catalog-entity.store.tsx index 8bbc335010..d4a5dbbc36 100644 --- a/src/renderer/components/+catalog/catalog-entity.store.tsx +++ b/src/renderer/components/+catalog/catalog-entity.store.tsx @@ -52,7 +52,7 @@ export class CatalogEntityStore extends ItemStore this.entities, () => this.loadAll()), - reaction(() => this.activeCategory, () => this.loadAll(), { delay: 100}), + reaction(() => this.activeCategory, () => this.loadAll(), { delay: 100 }), ); } diff --git a/src/renderer/components/+catalog/catalog.tsx b/src/renderer/components/+catalog/catalog.tsx index 8b491ec765..6ca4af9423 100644 --- a/src/renderer/components/+catalog/catalog.tsx +++ b/src/renderer/components/+catalog/catalog.tsx @@ -109,7 +109,7 @@ export class Catalog extends React.Component { console.error(error); Notifications.error(

Unknown category: {routeTab}

); } - }, {fireImmediately: true}), + }, { fireImmediately: true }), ]); // If active category is filtered out, automatically switch to the first category @@ -169,7 +169,7 @@ export class Catalog extends React.Component { const activeCategory = this.categories.find(category => category.getId() === tabId); if (activeCategory) { - navigate(catalogURL({ params: {group: activeCategory.spec.group, kind: activeCategory.spec.names.kind }})); + navigate(catalogURL({ params: { group: activeCategory.spec.group, kind: activeCategory.spec.names.kind }})); } else { navigate(catalogURL({ params: { group: browseCatalogTab }})); } diff --git a/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx b/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx index 29db4fda7f..97ad62123d 100644 --- a/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx +++ b/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx @@ -48,7 +48,7 @@ function transformUnit(name: string, value: string): number { } function renderQuotas(quota: ResourceQuota): JSX.Element[] { - const { hard = {}, used = {} } = quota.status; + const { hard = {}, used = {}} = quota.status; return Object.entries(hard) .filter(([name]) => used[name]) diff --git a/src/renderer/components/+custom-resources/crd-details.tsx b/src/renderer/components/+custom-resources/crd-details.tsx index 2fcc702ba4..3fd616742e 100644 --- a/src/renderer/components/+custom-resources/crd-details.tsx +++ b/src/renderer/components/+custom-resources/crd-details.tsx @@ -157,7 +157,7 @@ export class CRDDetails extends React.Component { <> { } render() { - const { props: { object, crd } } = this; + const { props: { object, crd }} = this; if (!object || !crd) { return null; diff --git a/src/renderer/components/+extensions/extensions.tsx b/src/renderer/components/+extensions/extensions.tsx index 46b7a26919..91e568bf7f 100644 --- a/src/renderer/components/+extensions/extensions.tsx +++ b/src/renderer/components/+extensions/extensions.tsx @@ -246,7 +246,7 @@ async function createTempFilesAndValidate({ fileName, dataP }: InstallRequest): } async function unpackExtension(request: InstallRequestValidated, disposeDownloading?: Disposer) { - const { id, fileName, tempFile, manifest: { name, version } } = request; + const { id, fileName, tempFile, manifest: { name, version }} = request; ExtensionInstallationStateStore.setInstalling(id); disposeDownloading?.(); @@ -386,7 +386,7 @@ async function attemptInstall(request: InstallRequest, d?: ExtendableDisposer): // install extension if not yet exists await unpackExtension(validatedRequest, dispose); } else { - const { manifest: { version: oldVersion } } = ExtensionLoader.getInstance().getExtension(validatedRequest.id); + const { manifest: { version: oldVersion }} = ExtensionLoader.getInstance().getExtension(validatedRequest.id); // otherwise confirmation required (re-install / update) const removeNotification = Notifications.info( @@ -451,7 +451,7 @@ async function installFromInput(input: string) { await attemptInstall({ fileName, dataP: readFileNotify(input) }); } else if (InputValidators.isExtensionNameInstall.validate(input)) { - const [{ groups: { name, version } }] = [...input.matchAll(InputValidators.isExtensionNameInstallRegex)]; + const [{ groups: { name, version }}] = [...input.matchAll(InputValidators.isExtensionNameInstallRegex)]; await attemptInstallByInfo({ name, version }); } diff --git a/src/renderer/components/+extensions/installed-extensions.tsx b/src/renderer/components/+extensions/installed-extensions.tsx index 0da09e5ec9..09c41aeefc 100644 --- a/src/renderer/components/+extensions/installed-extensions.tsx +++ b/src/renderer/components/+extensions/installed-extensions.tsx @@ -106,7 +106,7 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di ), version, status: ( -
+
{getStatus(extension)}
), diff --git a/src/renderer/components/+network-endpoints/endpoint-subset-list.tsx b/src/renderer/components/+network-endpoints/endpoint-subset-list.tsx index 7dcb1fc99b..aa4226f06a 100644 --- a/src/renderer/components/+network-endpoints/endpoint-subset-list.tsx +++ b/src/renderer/components/+network-endpoints/endpoint-subset-list.tsx @@ -23,7 +23,7 @@ import "./endpoint-subset-list.scss"; import React from "react"; import { observer } from "mobx-react"; -import { EndpointSubset, Endpoint, EndpointAddress} from "../../../common/k8s-api/endpoints"; +import { EndpointSubset, Endpoint, EndpointAddress } from "../../../common/k8s-api/endpoints"; import { Table, TableCell, TableHead, TableRow } from "../table"; import { boundMethod } from "../../utils"; import { apiManager } from "../../../common/k8s-api/api-manager"; @@ -47,7 +47,7 @@ export class EndpointSubsetList extends React.Component { @boundMethod getNotReadyAddressTableRow(ip: string) { - const { subset} = this.props; + const { subset } = this.props; const address = subset.getNotReadyAddresses().find(address => address.getId() == ip); return this.renderAddressTableRow(address); diff --git a/src/renderer/components/+network-ingresses/ingress-details.tsx b/src/renderer/components/+network-ingresses/ingress-details.tsx index 76515250b2..a0ec3ce8ca 100644 --- a/src/renderer/components/+network-ingresses/ingress-details.tsx +++ b/src/renderer/components/+network-ingresses/ingress-details.tsx @@ -62,7 +62,7 @@ export class IngressDetails extends React.Component { } renderPaths(ingress: Ingress) { - const { spec: { rules } } = ingress; + const { spec: { rules }} = ingress; if (!rules || !rules.length) return null; diff --git a/src/renderer/components/+network-policies/network-policy-details.tsx b/src/renderer/components/+network-policies/network-policy-details.tsx index 2ce5fc9034..b7105a1ff3 100644 --- a/src/renderer/components/+network-policies/network-policy-details.tsx +++ b/src/renderer/components/+network-policies/network-policy-details.tsx @@ -95,7 +95,7 @@ export class NetworkPolicyDetails extends React.Component { <> {to.map(item => { - const { ipBlock: { cidr, except } = {} } = item; + const { ipBlock: { cidr, except } = {}} = item; if (!cidr) return null; diff --git a/src/renderer/components/+network-port-forwards/port-forwards.tsx b/src/renderer/components/+network-port-forwards/port-forwards.tsx index 17b1c40c20..cafa96b4c0 100644 --- a/src/renderer/components/+network-port-forwards/port-forwards.tsx +++ b/src/renderer/components/+network-port-forwards/port-forwards.tsx @@ -54,7 +54,7 @@ export class PortForwards extends React.Component { } get selectedPortForward() { - const { match: { params: { forwardport } } } = this.props; + const { match: { params: { forwardport }}} = this.props; return portForwardStore.getById(forwardport); } diff --git a/src/renderer/components/+preferences/add-helm-repo-dialog.tsx b/src/renderer/components/+preferences/add-helm-repo-dialog.tsx index 8ec68dc395..474ec54491 100644 --- a/src/renderer/components/+preferences/add-helm-repo-dialog.tsx +++ b/src/renderer/components/+preferences/add-helm-repo-dialog.tsx @@ -53,7 +53,7 @@ const dialogState = observable.object({ @observer export class AddHelmRepoDialog extends React.Component { - private emptyRepo = {name: "", url: "", username: "", password: "", insecureSkipTlsVerify: false, caFile:"", keyFile: "", certFile: ""}; + private emptyRepo = { name: "", url: "", username: "", password: "", insecureSkipTlsVerify: false, caFile:"", keyFile: "", certFile: "" }; private static keyExtensions = ["key", "keystore", "jks", "p12", "pfx", "pem"]; private static certExtensions = ["crt", "cer", "ca-bundle", "p7b", "p7c" , "p7s", "p12", "pfx", "pem"]; @@ -96,7 +96,7 @@ export class AddHelmRepoDialog extends React.Component { buttonLabel: `Use file`, filters: [ fileFilter, - { name: "Any", extensions: ["*"]} + { name: "Any", extensions: ["*"] } ] }); @@ -128,7 +128,7 @@ export class AddHelmRepoDialog extends React.Component { /> this.selectFileDialog(fileType, {name: placeholder, extensions: fileExtensions})} + onClick={() => this.selectFileDialog(fileType, { name: placeholder, extensions: fileExtensions })} tooltip="Browse" />
); diff --git a/src/renderer/components/+preferences/editor.tsx b/src/renderer/components/+preferences/editor.tsx index 77adac50a7..e9540b11c6 100644 --- a/src/renderer/components/+preferences/editor.tsx +++ b/src/renderer/components/+preferences/editor.tsx @@ -55,7 +55,7 @@ export const Editor = observer(() => {