Enable object-shorthand rule (#1500)

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti authored and GitHub committed 2020-11-24 13:16:35 +02:00
1 parent 2a8cfe5e67
commit ff93760dc4
42 files changed
+69 -66

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ export class ClusterApi extends KubeApi<Cluster> {
async getMetrics(nodeNames: string[], params?: IMetricsReqParams): Promise<IClusterMetrics> {
const nodes = nodeNames.join("|");
const opts = { category: "cluster", nodes: nodes };
const opts = { category: "cluster", nodes };
return metricsApi.getMetrics({
memoryUsage: opts,
+1 -1
View File
@@ -20,7 +20,7 @@ export class DeploymentApi extends KubeApi<Deployment> {
data: {
metadata: params,
spec: {
replicas: replicas
replicas
}
}
});
@@ -119,7 +119,7 @@ export const helmReleasesApi = {
const path = endpoint({ name, namespace }) + "/rollback";
return apiBase.put(path, {
data: {
revision: revision
revision
}
});
}
+2 -2
View File
@@ -84,8 +84,8 @@ export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
}
const infoLog: JsonApiLog = {
method: reqInit.method.toUpperCase(),
reqUrl: reqUrl,
reqInit: reqInit,
reqUrl,
reqInit,
};
return cancelableFetch(reqUrl, reqInit).then(res => {
return this.parseResponse<D>(res, infoLog);
+3 -3
View File
@@ -73,7 +73,7 @@ export function forCluster<T extends KubeObject>(cluster: IKubeApiCluster, kubeC
});
return new KubeApi({
objectConstructor: kubeClass,
request: request
request
});
}
@@ -228,7 +228,7 @@ export class KubeApi<T extends KubeObject = any> {
apiVersion: this.apiVersionWithGroup,
resource: this.apiResource,
namespace: this.isNamespaced ? namespace : undefined,
name: name,
name,
});
return resourcePath + (query ? `?` + stringify(this.normalizeQuery(query)) : "");
}
@@ -256,7 +256,7 @@ export class KubeApi<T extends KubeObject = any> {
this.setResourceVersion("", metadata.resourceVersion);
return items.map(item => new KubeObjectConstructor({
kind: this.kind,
apiVersion: apiVersion,
apiVersion,
...item,
}));
}
@@ -152,7 +152,7 @@ export class AddCluster extends React.Component {
: ClusterStore.embedCustomKubeConfig(clusterId, kubeConfig); // save in app-files folder
return {
id: clusterId,
kubeConfigPath: kubeConfigPath,
kubeConfigPath,
workspace: workspaceStore.currentWorkspaceId,
contextName: kubeConfig.currentContext,
preferences: {
@@ -36,7 +36,7 @@ export class HelmChartStore extends ItemStore<HelmChart> {
const loadVersions = (repo: string) => {
return helmChartsApi.get(repo, chartName).then(({ versions }) => {
return versions.map(chart => ({
repo: repo,
repo,
version: chart.getVersion()
}));
});
@@ -27,7 +27,7 @@ export const ClusterMetrics = observer(() => {
id: metricType + metricNodeRole,
label: metricType.toUpperCase() + " usage",
borderColor: colors[metricType],
data: data
data
}];
const cpuOptions: ChartOptions = {
scales: {
@@ -92,11 +92,11 @@ export class AddSecretDialog extends React.Component<Props> {
const { name, namespace, type } = this;
const { data = [], labels = [], annotations = [] } = this.secret[type];
const secret: Partial<Secret> = {
type: type,
type,
data: this.getDataFromFields(data, val => val ? base64.encode(val) : ""),
metadata: {
name: name,
namespace: namespace,
name,
namespace,
annotations: this.getDataFromFields(annotations),
labels: this.getDataFromFields(labels),
} as IKubeObjectMetadata
@@ -60,7 +60,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
kind: "Namespace",
apiVersion: "v1",
metadata: {
name: name,
name,
uid: "",
resourceVersion: "",
selfLink: `/api/v1/namespaces/${name}`
@@ -137,7 +137,7 @@ export class AddRoleBindingDialog extends React.Component<Props> {
else {
const name = useRoleForBindingName ? selectedRole.getName() : bindingName;
roleBinding = await roleBindingsStore.create({ name, namespace }, {
subjects: subjects,
subjects,
roleRef: {
name: selectedRole.getName(),
kind: selectedRole.kind,
@@ -88,7 +88,7 @@ export class ServiceAccountsDetails extends React.Component<Props> {
apiVersion: "v1",
kind: "Secret",
metadata: {
name: name,
name,
uid: null,
selfLink: null,
resourceVersion: null
+1 -1
View File
@@ -59,7 +59,7 @@ export class App extends React.Component {
name: "cluster",
action: "open",
params: {
clusterId: clusterId
clusterId
}
});
window.addEventListener("online", () => {
@@ -30,7 +30,7 @@ export class Checkbox extends React.PureComponent<CheckboxProps> {
render() {
const { label, inline, className, value, theme, children, ...inputProps } = this.props;
const componentClass = cssNames('Checkbox flex', className, {
inline: inline,
inline,
checked: value,
disabled: this.props.disabled,
["theme-" + theme]: theme,
@@ -55,7 +55,7 @@ export class EditResource extends React.Component<Props> {
}
editResourceStore.setData(this.tabId, {
...this.tabData,
draft: draft,
draft,
});
}
+1 -1
View File
@@ -38,7 +38,7 @@ export class FileInput extends React.Component<Props> {
const reader = new FileReader();
reader.onloadend = () => {
resolve({
file: file,
file,
data: reader.result,
error: reader.error ? String(reader.error) : null,
});
+5 -5
View File
@@ -149,7 +149,7 @@ export class Input extends React.Component<InputProps, State> {
this.setState({
validating: false,
valid: !errors.length,
errors: errors,
errors,
});
}
@@ -273,11 +273,11 @@ export class Input extends React.Component<InputProps, State> {
const className = cssNames("Input", this.props.className, {
[`theme ${theme}`]: theme,
focused: focused,
disabled: disabled,
focused,
disabled,
invalid: !valid,
dirty: dirty,
validating: validating,
dirty,
validating,
validatingLine: validating && showValidationLine,
});
@@ -81,7 +81,7 @@ export class MenuActions extends React.Component<MenuActionsProps> {
...menuProps
} = this.props;
const menuClassName = cssNames("MenuActions flex", className, {
toolbar: toolbar,
toolbar,
gaps: toolbar, // add spacing for .flex
});
const autoClose = !toolbar;
@@ -15,7 +15,7 @@ export class Notifications extends React.Component {
static ok(message: NotificationMessage) {
notificationsStore.add({
message: message,
message,
timeout: 2500,
status: NotificationStatus.OK
});
@@ -23,7 +23,7 @@ export class Notifications extends React.Component {
static error(message: NotificationMessage) {
notificationsStore.add({
message: message,
message,
timeout: 10000,
status: NotificationStatus.ERROR
});
@@ -33,7 +33,7 @@ export class Notifications extends React.Component {
return notificationsStore.add({
status: NotificationStatus.INFO,
timeout: 0,
message: message,
message,
...customOpts,
});
}
+3 -3
View File
@@ -24,10 +24,10 @@ export class RadioGroup extends React.Component<RadioGroupProps, {}> {
<div className={className}>
{radios.map(radio => {
return React.cloneElement(radio, {
name: name,
name,
disabled: disabled !== undefined ? disabled : radio.props.disabled,
checked: radio.props.value === value,
onChange: onChange
onChange
} as any);
})}
</div>
@@ -66,7 +66,7 @@ export class Radio extends React.Component<RadioProps> {
render() {
const { className, label, checked, children, ...inputProps } = this.props;
const componentClass = cssNames('Radio flex align-center', className, {
checked: checked,
checked,
disabled: this.props.disabled,
});
return (
+1 -1
View File
@@ -60,7 +60,7 @@ export class TableCell extends React.Component<TableCellProps> {
render() {
const { className, checkbox, isChecked, sortBy, _sort, _sorting, _nowrap, children, title, renderBoolean: displayBoolean, ...cellProps } = this.props;
const classNames = cssNames("TableCell", className, {
checkbox: checkbox,
checkbox,
nowrap: _nowrap,
sorting: this.isSortable,
});
+1 -1
View File
@@ -82,7 +82,7 @@ export class Table extends React.Component<TableProps> {
typeof elem.props.children === "string" ? elem.props.children : undefined
);
return React.cloneElement(elem, {
title: title,
title,
_sort: this.sort,
_sorting: this.sortParams,
_nowrap: headElem.props.nowrap,
+5 -5
View File
@@ -32,10 +32,10 @@ export class Tabs extends React.PureComponent<TabsProps> {
render() {
const { center, wrap, onChange, value, autoFocus, scrollable = true, withBorder, ...elemProps } = this.props;
const className = cssNames("Tabs", this.props.className, {
center: center,
wrap: wrap,
scrollable: scrollable,
withBorder: withBorder,
center,
wrap,
scrollable,
withBorder,
});
return (
<TabsContext.Provider value={{ autoFocus, value, onChange }}>
@@ -120,7 +120,7 @@ export class Tab extends React.PureComponent<TabProps> {
let { className } = this.props;
className = cssNames("Tab flex gaps align-center", className, {
"active": this.isActive,
"disabled": disabled,
disabled,
});
return (
<div
+2 -2
View File
@@ -180,8 +180,8 @@ export class Tooltip extends React.Component<TooltipProps> {
break;
}
return {
left: left,
top: top,
left,
top,
right: left + tooltipBounds.width,
bottom: top + tooltipBounds.height,
};
+1 -1
View File
@@ -146,7 +146,7 @@ export abstract class KubeObjectStore<T extends KubeObject = any> extends ItemSt
protected bindWatchEventsUpdater(delay = 1000) {
return reaction(() => this.eventsBuffer.toJS()[0], this.updateFromEventsBuffer, {
delay: delay
delay
});
}
+1 -1
View File
@@ -67,7 +67,7 @@ export function getSelectedDetails() {
export function getDetailsUrl(details: string) {
if (!details) return "";
return getQueryString({
details: details,
details,
selected: getSelectedDetails(),
});
}
+1 -1
View File
@@ -1,5 +1,5 @@
export function downloadFile(filename: string, contents: any, type: string) {
const data = new Blob([contents], { type: type });
const data = new Blob([contents], { type });
const url = URL.createObjectURL(data);
const link = document.createElement("a");
link.href = url;
+3 -3
View File
@@ -7,19 +7,19 @@ export function interval(timeSec = 1, callback: IntervalCallback, autoRun = fals
let timer = -1;
let isRunning = false;
const intervalManager = {
start: function (runImmediately = false) {
start (runImmediately = false) {
if (isRunning) return;
const tick = () => callback(++count);
isRunning = true;
timer = window.setInterval(tick, 1000 * timeSec);
if (runImmediately) tick();
},
stop: function () {
stop () {
count = 0;
isRunning = false;
clearInterval(timer);
},
restart: function (runImmediately = false) {
restart (runImmediately = false) {
this.stop();
this.start(runImmediately);
},