Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: fix lint issues #740

Merged
merged 2 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webui/react/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
'indent': 'off',
'max-len': [ 'error', 100, { tabWidth: 2 } ],
'no-console': [ 'error', { allow: [ 'warn' ] } ],
'no-multi-spaces': [ 'warn', { ignoreEOLComments: true } ],
'no-multi-spaces': [ 'error', { ignoreEOLComments: true } ],
'no-multiple-empty-lines': [ 'error', { max: 1, maxBOF: 0, maxEOF: 0 } ],
'no-trailing-spaces': [ 'error', {} ],
'object-curly-spacing': [ 'error', 'always' ],
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/components/Logo.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
component: Logo,
parameters: {
backgrounds: [
{ default: true, name: 'dark background', value: '#111' },
{ default: true, name: 'dark background', value: '#111' },
],
},
title: 'Logo',
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/components/ResourceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const SlotChart: React.FC<Props> = ({ title, resources, ...rest }: Props) => {
return (
<Plot
{...rest}
config={{ displaylogo: false, responsive: true }}
config={{ displaylogo: false, responsive: true }}
data={plotInfo.data}
layout={plotInfo.layout}
/>
Expand Down
6 changes: 3 additions & 3 deletions webui/react/src/services/apiConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sha512 } from 'js-sha512';
import { sha512 } from 'js-sha512';
import queryString from 'query-string';

import { decode, ioTypeUser, ioUser } from 'ioTypes';
Expand Down Expand Up @@ -31,7 +31,7 @@ const commandToEndpoint: Record<CommandType, string> = {

/* Authentication */

export const getCurrentUser: Api<{}, User> = {
export const getCurrentUser: Api<{}, User> = {
httpOptions: () => ({ url: '/users/me' }),
name: 'getCurrentUser',
postProcess: (response) => {
Expand Down Expand Up @@ -124,7 +124,7 @@ export const killExperiment: Api<KillExpParams, void> = {
name: 'killExperiment',
};

export const getExperimentSummaries: Api<ExperimentsParams, Experiment[]> = {
export const getExperimentSummaries: Api<ExperimentsParams, Experiment[]> = {
httpOptions: (params) => ({
url: '/experiment-summaries' + (params.states ? '?states='+params.states.join(',') : ''),
}),
Expand Down
14 changes: 7 additions & 7 deletions webui/react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export enum CommandState {
Terminated = 'TERMINATED',
}

export type State = CommandState | RunState
export type State = CommandState | RunState;

export interface CommandAddress {
containerIp: string;
Expand Down Expand Up @@ -199,16 +199,16 @@ export type RecentEvent = {
name: string;
date: string;
};
}
};

export type AnyTask = CommandTask | ExperimentTask
export type AnyTask = CommandTask | ExperimentTask;
export type RecentTask = AnyTask & RecentEvent;
export type RecentCommandTask = CommandTask & RecentEvent
export type RecentExperimentTask = ExperimentTask & RecentEvent
export type RecentCommandTask = CommandTask & RecentEvent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make these Error level failures so they break CI test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the multiple space rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep I like that. I wasn't sure if that was too severe but with auto fix I think that's reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update this PR to make it error level.

export type RecentExperimentTask = ExperimentTask & RecentEvent;

export type PropsWithClassName<T> = T & {className?: string};

export type TaskType = CommandType | 'Experiment'
export type TaskType = CommandType | 'Experiment';

export enum TBSourceType {
Trial,
Expand All @@ -219,7 +219,7 @@ export type CommonProps = {
className?: string;
children?: React.ReactNode;
title?: string;
}
};

export enum LogLevel {
Debug = 'debug',
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/utils/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
enum Level {
Warn = 'warn',
Warn = 'warn',
Error = 'error',
}

Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const clone = (data: any, deep = true): any => {
return deep ? JSON.parse(JSON.stringify(data)) : { ...data };
};

export const categorize = <T>(array: T[], keyFn: ((arg0: T) => string)): Record<string, T[]> => {
export const categorize = <T>(array: T[], keyFn: ((arg0: T) => string)): Record<string, T[]> => {
const d: Record<string, T[]> = {};
array.forEach(item => {
const key = keyFn(item);
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/utils/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const generateTasks = (count = 10): RecentTask[] => {
};

export const isExperimentTask = (task: AnyTask): task is ExperimentTask => {
return ('archived' in task) && !('type' in task);
return ('archived' in task) && !('type' in task);
};

export const canBeOpened = (task: AnyTask): boolean => {
Expand Down