Skip to content

Commit

Permalink
Upgrade prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy committed Feb 25, 2020
1 parent 9998a71 commit 9c98002
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 75 deletions.
6 changes: 3 additions & 3 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"enzyme-to-json": "^3.3.4",
"prettier": "1.18.2",
"prettier": "^1.19.1",
"react-router-test-context": "^0.1.0",
"react-scripts": "^3.4.0",
"react-test-renderer": "^16.5.2",
Expand Down
28 changes: 16 additions & 12 deletions frontend/src/apis/run/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1486,10 +1486,12 @@ export const RunServiceApiFactory = function(
* @throws {RequiredError}
*/
readArtifact(run_id: string, node_id: string, artifact_name: string, options?: any) {
return RunServiceApiFp(configuration).readArtifact(run_id, node_id, artifact_name, options)(
fetch,
basePath,
);
return RunServiceApiFp(configuration).readArtifact(
run_id,
node_id,
artifact_name,
options,
)(fetch, basePath);
},
/**
*
Expand All @@ -1500,10 +1502,11 @@ export const RunServiceApiFactory = function(
* @throws {RequiredError}
*/
reportRunMetrics(run_id: string, body: ApiReportRunMetricsRequest, options?: any) {
return RunServiceApiFp(configuration).reportRunMetrics(run_id, body, options)(
fetch,
basePath,
);
return RunServiceApiFp(configuration).reportRunMetrics(
run_id,
body,
options,
)(fetch, basePath);
},
/**
*
Expand Down Expand Up @@ -1661,10 +1664,11 @@ export class RunServiceApi extends BaseAPI {
* @memberof RunServiceApi
*/
public reportRunMetrics(run_id: string, body: ApiReportRunMetricsRequest, options?: any) {
return RunServiceApiFp(this.configuration).reportRunMetrics(run_id, body, options)(
this.fetch,
this.basePath,
);
return RunServiceApiFp(this.configuration).reportRunMetrics(
run_id,
body,
options,
)(this.fetch, this.basePath);
}

/**
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/atoms/ExternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ const css = stylesheet({
},
});

export const ExternalLink: React.FC<
DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
> = props => (
export const ExternalLink: React.FC<DetailedHTMLProps<
AnchorHTMLAttributes<HTMLAnchorElement>,
HTMLAnchorElement
>> = props => (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a {...props} className={css.link} target='_blank' rel='noopener' />
);

export const AutoLink: React.FC<
DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
> = props =>
export const AutoLink: React.FC<DetailedHTMLProps<
AnchorHTMLAttributes<HTMLAnchorElement>,
HTMLAnchorElement
>> = props =>
props.href && props.href.startsWith('#') ? (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a {...props} className={css.link} />
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/CompareTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ describe('CompareTable', () => {
expect(tree).toMatchSnapshot();
});

const rows = [['1', '2', '3'], ['4', '5', '6'], ['cell7', 'cell8', 'cell9']];
const rows = [
['1', '2', '3'],
['4', '5', '6'],
['cell7', 'cell8', 'cell9'],
];
const xLabels = ['col1', 'col2', 'col3'];
const yLabels = ['row1', 'row2', 'row3'];

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/CustomTableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('CustomTable', () => {
};

it('renders some rows using a custom renderer', async () => {
columns[0].customRenderer = () => <span>this is custom output</span> as any;
columns[0].customRenderer = () => (<span>this is custom output</span>) as any;
const tree = shallow(<CustomTableRow {...props} row={row} columns={columns} />);
await TestUtils.flushPromises();
expect(tree).toMatchSnapshot();
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/DetailsTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ describe('DetailsTable', () => {
});

it('does not render booleans as JSON', () => {
const tree = shallow(<DetailsTable fields={[['key1', 'true'], ['key2', 'false']]} />);
const tree = shallow(
<DetailsTable
fields={[
['key1', 'true'],
['key2', 'false'],
]}
/>,
);
expect(tree).toMatchSnapshot();
});

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/viewers/ConfusionMatrix.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ describe('ConfusionMatrix', () => {
expect(tree).toMatchSnapshot();
});

const data = [[0, 1, 2], [3, 4, 5], [6, 7, 8]];
const data = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
];
const config: ConfusionMatrixConfig = {
axes: ['test x axis', 'test y axis'],
data,
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/viewers/PagedTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ describe('PagedTable', () => {
expect(tree).toMatchSnapshot();
});

const data = [['col1', 'col2', 'col3'], ['col4', 'col5', 'col6']];
const data = [
['col1', 'col2', 'col3'],
['col4', 'col5', 'col6'],
];
const labels = ['field1', 'field2', 'field3'];

it('renders simple data', () => {
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/lib/CompareUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@ describe('CompareUtils', () => {
} as ApiRun,
];
expect(CompareUtils.multiRunMetricsCompareProps(runs)).toEqual({
rows: [['0.330', ''], ['', '0.660']],
rows: [
['0.330', ''],
['', '0.660'],
],
xLabels: ['run1', 'run2'],
yLabels: ['some-metric', 'another-metric'],
});
Expand Down Expand Up @@ -396,7 +399,10 @@ describe('CompareUtils', () => {
name: 'run1',
} as ApiRun;
expect(CompareUtils.singleRunToMetricsCompareProps(run)).toEqual({
rows: [['0.230', ''], ['', '0.540']],
rows: [
['0.230', ''],
['', '0.540'],
],
xLabels: ['some-metric-name', 'another-metric-name'],
yLabels: ['someNodeId', 'anotherNodeId'],
});
Expand Down
23 changes: 19 additions & 4 deletions frontend/src/lib/OutputArtifactLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ describe('OutputArtifactLoader', () => {
const result = await OutputArtifactLoader.buildConfusionMatrixConfig(metadata as any);
expect(result).toEqual({
axes: ['field1', 'field2'],
data: [[0, 0], [0, 0]],
data: [
[0, 0],
[0, 0],
],
labels: ['field1', 'field2'],
type: PlotType.CONFUSION_MATRIX,
} as ConfusionMatrixConfig);
Expand Down Expand Up @@ -372,7 +375,11 @@ describe('OutputArtifactLoader', () => {
6,7,8
`;
expect(await OutputArtifactLoader.buildRocCurveConfig(metadata as any)).toEqual({
data: [{ label: '2', x: 0, y: 1 }, { label: '5', x: 3, y: 4 }, { label: '8', x: 6, y: 7 }],
data: [
{ label: '2', x: 0, y: 1 },
{ label: '5', x: 3, y: 4 },
{ label: '8', x: 6, y: 7 },
],
type: PlotType.ROC,
} as ROCCurveConfig);
});
Expand All @@ -388,7 +395,11 @@ describe('OutputArtifactLoader', () => {
6,7,8
`;
expect(await OutputArtifactLoader.buildRocCurveConfig(metadata as any)).toEqual({
data: [{ label: '0', x: 2, y: 1 }, { label: '3', x: 5, y: 4 }, { label: '6', x: 8, y: 7 }],
data: [
{ label: '0', x: 2, y: 1 },
{ label: '3', x: 5, y: 4 },
{ label: '6', x: 8, y: 7 },
],
type: PlotType.ROC,
} as ROCCurveConfig);
});
Expand All @@ -404,7 +415,11 @@ describe('OutputArtifactLoader', () => {
6,7,8
`;
expect(await OutputArtifactLoader.buildRocCurveConfig(metadata as any)).toEqual({
data: [{ label: '2', x: 0, y: 1 }, { label: '5', x: 3, y: 4 }, { label: '8', x: 6, y: 7 }],
data: [
{ label: '2', x: 0, y: 1 },
{ label: '5', x: 3, y: 4 },
{ label: '8', x: 6, y: 7 },
],
type: PlotType.ROC,
} as ROCCurveConfig);
});
Expand Down
40 changes: 32 additions & 8 deletions frontend/src/lib/StaticGraphParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,19 @@ describe('StaticGraphParser', () => {
container: {},
dag: [],
inputs: {
parameters: [{ name: 'param1', value: 'val1' }, { name: 'param2', value: 'val2' }],
parameters: [
{ name: 'param1', value: 'val1' },
{ name: 'param2', value: 'val2' },
],
},
name: 'template-1',
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('container');
expect(nodeInfo.inputs).toEqual([['param1', 'val1'], ['param2', 'val2']]);
expect(nodeInfo.inputs).toEqual([
['param1', 'val1'],
['param2', 'val2'],
]);
});

it('returns nodeInfo of a container with empty strings for inputs with no specified value', () => {
Expand All @@ -613,7 +619,10 @@ describe('StaticGraphParser', () => {
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('container');
expect(nodeInfo.inputs).toEqual([['param1', ''], ['param2', '']]);
expect(nodeInfo.inputs).toEqual([
['param1', ''],
['param2', ''],
]);
});

it('returns nodeInfo containing container outputs as list of name/value tuples, pulling from valueFrom if necessary', () => {
Expand Down Expand Up @@ -651,7 +660,10 @@ describe('StaticGraphParser', () => {
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('container');
expect(nodeInfo.outputs).toEqual([['param1', ''], ['param2', '']]);
expect(nodeInfo.outputs).toEqual([
['param1', ''],
['param2', ''],
]);
});

it('returns nodeInfo of a resource with empty values if template does not have inputs and/or outputs', () => {
Expand All @@ -672,14 +684,20 @@ describe('StaticGraphParser', () => {
const template = {
dag: [],
inputs: {
parameters: [{ name: 'param1', value: 'val1' }, { name: 'param2', value: 'val2' }],
parameters: [
{ name: 'param1', value: 'val1' },
{ name: 'param2', value: 'val2' },
],
},
name: 'template-1',
resource: {},
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('resource');
expect(nodeInfo.inputs).toEqual([['param1', 'val1'], ['param2', 'val2']]);
expect(nodeInfo.inputs).toEqual([
['param1', 'val1'],
['param2', 'val2'],
]);
});

it('returns nodeInfo of a resource with empty strings for inputs with no specified value', () => {
Expand All @@ -693,7 +711,10 @@ describe('StaticGraphParser', () => {
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('resource');
expect(nodeInfo.inputs).toEqual([['param1', ''], ['param2', '']]);
expect(nodeInfo.inputs).toEqual([
['param1', ''],
['param2', ''],
]);
});

it('returns nodeInfo containing resource outputs as list of name/value tuples, pulling from valueFrom if necessary', () => {
Expand Down Expand Up @@ -731,7 +752,10 @@ describe('StaticGraphParser', () => {
} as any;
const nodeInfo = _populateInfoFromTemplate(new SelectedNodeInfo(), template);
expect(nodeInfo.nodeType).toEqual('resource');
expect(nodeInfo.outputs).toEqual([['param1', ''], ['param2', '']]);
expect(nodeInfo.outputs).toEqual([
['param1', ''],
['param2', ''],
]);
});
});
});
6 changes: 4 additions & 2 deletions frontend/src/pages/AllRunsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class AllRunsList extends Page<{}, AllRunsListState> {
.newExperiment()
.compareRuns(() => this.state.selectedIds)
.cloneRun(() => this.state.selectedIds, false)
.archive(() => this.state.selectedIds, false, selectedIds =>
this._selectionChanged(selectedIds),
.archive(
() => this.state.selectedIds,
false,
selectedIds => this._selectionChanged(selectedIds),
)
.refresh(this.refresh.bind(this))
.getToolbarActionMap(),
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/Compare.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ describe('Compare', () => {
const workflow = {
spec: {
arguments: {
parameters: [{ name: 'param1', value: 'value1' }, { name: 'param2', value: 'value2' }],
parameters: [
{ name: 'param1', value: 'value1' },
{ name: 'param2', value: 'value2' },
],
},
},
} as Workflow;
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/ExperimentDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ describe('ExperimentDetails', () => {
});

it('navigates to the compare runs page', async () => {
const runs = [{ id: 'run-1-id', name: 'run-1' }, { id: 'run-2-id', name: 'run-2' }];
const runs = [
{ id: 'run-1-id', name: 'run-1' },
{ id: 'run-2-id', name: 'run-2' },
];
listRunsSpy.mockImplementation(() => ({ runs }));
await listRunsSpy;

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/pages/ExperimentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ class ExperimentDetails extends Page<{}, ExperimentDetailsState> {
.newRecurringRun(this.props.match.params[RouteParams.experimentId])
.compareRuns(() => this.state.selectedIds)
.cloneRun(() => this.state.selectedIds, false)
.archive(() => this.state.selectedIds, false, ids => this._selectionChanged(ids))
.archive(
() => this.state.selectedIds,
false,
ids => this._selectionChanged(ids),
)
.getToolbarActionMap(),
breadcrumbs: [],
pageTitle: 'Runs',
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/pages/ExperimentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class ExperimentList extends Page<{}, ExperimentListState> {
.newExperiment()
.compareRuns(() => this.state.selectedIds)
.cloneRun(() => this.state.selectedIds, false)
.archive(() => this.state.selectedIds, false, ids => this._selectionChanged(ids))
.archive(
() => this.state.selectedIds,
false,
ids => this._selectionChanged(ids),
)
.refresh(this.refresh.bind(this))
.getToolbarActionMap(),
breadcrumbs: [],
Expand Down
Loading

0 comments on commit 9c98002

Please sign in to comment.