mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Turn on noUnusedLocals, noImplicitReturns, importsNotUsedAsValues: error, and isolatedModules (#2777)
This commit is contained in:
1 parent
489cef9595
commit
5ed4537979
287 files changed
+704
-628
No files matched your search
@@ -22,9 +22,15 @@
|
||||
import React from "react";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import { IToleration } from "../../../api/workload-kube-object";
|
||||
import type { IToleration } from "../../../api/workload-kube-object";
|
||||
import { PodTolerations } from "../pod-tolerations";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getPath: () => "/foo",
|
||||
},
|
||||
}));
|
||||
|
||||
const tolerations: IToleration[] =[
|
||||
{
|
||||
key: "CriticalAddonsOnly",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
import React, { useContext } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { IPodMetrics } from "../../api/endpoints";
|
||||
import type { IPodMetrics } from "../../api/endpoints";
|
||||
import { BarChart, cpuOptions, memoryOptions } from "../chart";
|
||||
import { isMetricsEmpty, normalizeMetrics } from "../../api/endpoints/metrics.api";
|
||||
import { NoMetrics } from "../resource-metrics/no-metrics";
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
import React, { useContext } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { IPodMetrics } from "../../api/endpoints";
|
||||
import type { IPodMetrics } from "../../api/endpoints";
|
||||
import { BarChart, cpuOptions, memoryOptions } from "../chart";
|
||||
import { isMetricsEmpty, normalizeMetrics } from "../../api/endpoints/metrics.api";
|
||||
import { NoMetrics } from "../resource-metrics/no-metrics";
|
||||
import { IResourceMetricsValue, ResourceMetricsContext } from "../resource-metrics";
|
||||
import { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import type { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import { ThemeStore } from "../../theme.store";
|
||||
|
||||
export const podMetricTabs = [
|
||||
|
||||
@@ -23,13 +23,13 @@ import "./pod-container-env.scss";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { IPodContainer, Secret } from "../../api/endpoints";
|
||||
import type { IPodContainer, Secret } from "../../api/endpoints";
|
||||
import { DrawerItem } from "../drawer";
|
||||
import { autorun } from "mobx";
|
||||
import { secretsStore } from "../+config-secrets/secrets.store";
|
||||
import { configMapsStore } from "../+config-maps/config-maps.store";
|
||||
import { Icon } from "../icon";
|
||||
import { base64, cssNames } from "../../utils";
|
||||
import { base64, cssNames, iter } from "../../utils";
|
||||
import _ from "lodash";
|
||||
|
||||
interface Props {
|
||||
@@ -113,21 +113,23 @@ export const ContainerEnvironment = observer((props: Props) => {
|
||||
};
|
||||
|
||||
const renderEnvFrom = () => {
|
||||
const envVars = envFrom.map(vars => {
|
||||
return Array.from(iter.filterFlatMap(envFrom, vars => {
|
||||
if (vars.configMapRef?.name) {
|
||||
return renderEnvFromConfigMap(vars.configMapRef.name);
|
||||
} else if (vars.secretRef?.name ) {
|
||||
}
|
||||
|
||||
if (vars.secretRef?.name) {
|
||||
return renderEnvFromSecret(vars.secretRef.name);
|
||||
}
|
||||
});
|
||||
|
||||
return _.flatten(envVars);
|
||||
return null;
|
||||
}));
|
||||
};
|
||||
|
||||
const renderEnvFromConfigMap = (configMapName: string) => {
|
||||
const configMap = configMapsStore.getByName(configMapName, namespace);
|
||||
|
||||
if (!configMap) return;
|
||||
if (!configMap) return null;
|
||||
|
||||
return Object.entries(configMap.data).map(([name, value]) => (
|
||||
<div className="variable" key={name}>
|
||||
@@ -139,7 +141,7 @@ export const ContainerEnvironment = observer((props: Props) => {
|
||||
const renderEnvFromSecret = (secretName: string) => {
|
||||
const secret = secretsStore.getByName(secretName, namespace);
|
||||
|
||||
if (!secret) return;
|
||||
if (!secret) return null;
|
||||
|
||||
return Object.keys(secret.data).map(key => {
|
||||
const secretKeyRef = {
|
||||
|
||||
@@ -23,7 +23,7 @@ import "./pod-container-port.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Pod } from "../../api/endpoints";
|
||||
import type { Pod } from "../../api/endpoints";
|
||||
import { apiBase } from "../../api";
|
||||
import { observable } from "mobx";
|
||||
import { cssNames } from "../../utils";
|
||||
|
||||
@@ -24,7 +24,7 @@ import React from "react";
|
||||
import jsYaml from "js-yaml";
|
||||
import { AceEditor } from "../ace-editor";
|
||||
import { DrawerParamToggler, DrawerItem } from "../drawer";
|
||||
import { Pod, Deployment, DaemonSet, StatefulSet, ReplicaSet, Job } from "../../api/endpoints";
|
||||
import type { Pod, Deployment, DaemonSet, StatefulSet, ReplicaSet, Job } from "../../api/endpoints";
|
||||
|
||||
interface Props {
|
||||
workload: Pod | Deployment | DaemonSet | StatefulSet | ReplicaSet | Job;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
import "./pod-details-container.scss";
|
||||
|
||||
import React from "react";
|
||||
import { IPodContainer, IPodContainerStatus, Pod } from "../../api/endpoints";
|
||||
import type { IPodContainer, IPodContainerStatus, Pod } from "../../api/endpoints";
|
||||
import { DrawerItem } from "../drawer";
|
||||
import { cssNames } from "../../utils";
|
||||
import { StatusBrick } from "../status-brick";
|
||||
@@ -30,7 +30,7 @@ import { Badge } from "../badge";
|
||||
import { ContainerEnvironment } from "./pod-container-env";
|
||||
import { PodContainerPort } from "./pod-container-port";
|
||||
import { ResourceMetrics } from "../resource-metrics";
|
||||
import { IMetrics } from "../../api/endpoints/metrics.api";
|
||||
import type { IMetrics } from "../../api/endpoints/metrics.api";
|
||||
import { ContainerCharts } from "./container-charts";
|
||||
import { ResourceType } from "../cluster-settings/components/cluster-metrics-setting";
|
||||
import { LocaleDate } from "../locale-date";
|
||||
@@ -66,6 +66,8 @@ export class PodDetailsContainer extends React.Component<Props> {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -26,10 +26,10 @@ import kebabCase from "lodash/kebabCase";
|
||||
import { reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { podsStore } from "./pods.store";
|
||||
import { Pod } from "../../api/endpoints";
|
||||
import type { Pod } from "../../api/endpoints";
|
||||
import { autobind, bytesToUnits, cssNames, interval, prevDefault } from "../../utils";
|
||||
import { LineProgress } from "../line-progress";
|
||||
import { KubeObject } from "../../api/kube-object";
|
||||
import type { KubeObject } from "../../api/kube-object";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import { Spinner } from "../spinner";
|
||||
import { DrawerTitle } from "../drawer";
|
||||
|
||||
@@ -23,7 +23,7 @@ import "./pod-details-statuses.scss";
|
||||
import React from "react";
|
||||
import countBy from "lodash/countBy";
|
||||
import kebabCase from "lodash/kebabCase";
|
||||
import { Pod } from "../../api/endpoints";
|
||||
import type { Pod } from "../../api/endpoints";
|
||||
|
||||
interface Props {
|
||||
pods: Pod[];
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
import "./pod-details-tolerations.scss";
|
||||
import React from "react";
|
||||
import { DrawerParamToggler, DrawerItem } from "../drawer";
|
||||
import { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import type { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import { PodTolerations } from "./pod-tolerations";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -176,7 +176,7 @@ export class PodDetails extends React.Component<Props> {
|
||||
key={name}
|
||||
pod={pod}
|
||||
container={container}
|
||||
metrics={metrics}
|
||||
metrics={metrics || null}
|
||||
/>
|
||||
);
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ import "./pod-tolerations.scss";
|
||||
import React from "react";
|
||||
import uniqueId from "lodash/uniqueId";
|
||||
|
||||
import { IToleration } from "../../api/workload-kube-object";
|
||||
import type { IToleration } from "../../api/workload-kube-object";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -25,7 +25,7 @@ import { KubeObjectStore } from "../../kube-object.store";
|
||||
import { autobind, cpuUnitsToNumber, unitsToBytes } from "../../utils";
|
||||
import { IPodMetrics, Pod, PodMetrics, podMetricsApi, podsApi } from "../../api/endpoints";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import type { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
|
||||
@autobind()
|
||||
export class PodsStore extends KubeObjectStore<Pod> {
|
||||
@@ -59,8 +59,6 @@ export class PodsStore extends KubeObjectStore<Pod> {
|
||||
return this.items.filter(pod => {
|
||||
const owners = pod.getOwnerRefs();
|
||||
|
||||
if (!owners.length) return;
|
||||
|
||||
return owners.find(owner => owner.uid === workload.getId());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import React, { Fragment } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { podsStore } from "./pods.store";
|
||||
import { RouteComponentProps } from "react-router";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import { volumeClaimStore } from "../+storage-volume-claims/volume-claim.store";
|
||||
import { IPodsRouteParams } from "../+workloads";
|
||||
import type { IPodsRouteParams } from "../+workloads";
|
||||
import { eventStore } from "../+events/event.store";
|
||||
import { getDetailsUrl, KubeObjectListLayout } from "../kube-object";
|
||||
import { nodesApi, Pod } from "../../api/endpoints";
|
||||
|
||||
Reference in new issue
Block a user