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

chore(deps): upgrade prettier from v1.x to v3+ #12290

Merged
merged 2 commits into from
Nov 30, 2023
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
6 changes: 4 additions & 2 deletions ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"arrowParens": "avoid",
"bracketSpacing": false,
"jsxSingleQuote": true,
"jsxBracketSameLine": true,
"printWidth": 180,
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 4,
"jsxBracketSameLine": true,
"quoteProps": "consistent"
"trailingComma": "none"
}
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
"copy-webpack-plugin": "^11.0.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"html-webpack-plugin": "^5.5.3",
"jest": "^26.6.3",
"monaco-editor-webpack-plugin": "^7.1.0",
"prettier": "^1.19.1",
"prettier": "^3.0.3",
"raw-loader": "^4.0.2",
"react-hot-loader": "^4.13.1",
"sass": "^1.69.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {useState} from 'react';

import {ClusterWorkflowTemplate} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand All @@ -18,11 +19,13 @@ export function ClusterWorkflowTemplateCreator({onCreate}: {onCreate: (workflow:
<UploadButton onUpload={setTemplate} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.clusterWorkflowTemplate
.create(template)
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newTemplate = await services.clusterWorkflowTemplate.create(template);
onCreate(newTemplate);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/cron-workflows/components/cron-workflow-creator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {useState} from 'react';

import {CronWorkflow} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand All @@ -19,11 +20,13 @@ export function CronWorkflowCreator({onCreate, namespace}: {namespace: string; o
<UploadButton onUpload={setCronWorkflow} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.cronWorkflows
.create(cronWorkflow, Utils.getNamespaceWithDefault(cronWorkflow.metadata.namespace))
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newCronWorkflow = await services.cronWorkflows.create(cronWorkflow, Utils.getNamespaceWithDefault(cronWorkflow.metadata.namespace));
onCreate(newCronWorkflow);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,11 @@ export function EventFlowPage({history, location, match}: RouteComponentProps<an
source={{
key: 'logs',
loadLogs: () =>
((selected.kind === 'Sensor'
? services.sensor.sensorsLogs(namespace, selected.name, selected.key, '', 50)
: services.eventSource.eventSourcesLogs(namespace, selected.name, '', selected.key, '', 50)) as Observable<any>).pipe(
(
(selected.kind === 'Sensor'
? services.sensor.sensorsLogs(namespace, selected.name, selected.key, '', 50)
: services.eventSource.eventSourcesLogs(namespace, selected.name, '', selected.key, '', 50)) as Observable<any>
).pipe(
filter(e => !!e),
map(
e =>
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/event-sources/components/event-source-creator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {useState} from 'react';

import {EventSource} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand All @@ -18,11 +19,13 @@ export function EventSourceCreator({onCreate, namespace}: {namespace: string; on
<UploadButton onUpload={setEventSource} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.eventSource
.create(eventSource, Utils.getNamespaceWithDefault(eventSource.metadata.namespace))
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newEventSource = await services.eventSource.create(eventSource, Utils.getNamespaceWithDefault(eventSource.metadata.namespace));
onCreate(newEventSource);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand Down
17 changes: 10 additions & 7 deletions ui/src/app/sensors/components/sensor-creator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {useState} from 'react';

import {Sensor} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand All @@ -9,7 +10,7 @@ import {services} from '../../shared/services';
import {Utils} from '../../shared/utils';
import {SensorEditor} from './sensor-editor';

export const SensorCreator = ({namespace, onCreate}: {namespace: string; onCreate: (sensor: Sensor) => void}) => {
export function SensorCreator({namespace, onCreate}: {namespace: string; onCreate: (sensor: Sensor) => void}) {
const [sensor, setSensor] = useState<Sensor>(exampleSensor(Utils.getNamespaceWithDefault(namespace)));
const [error, setError] = useState<Error>();
return (
Expand All @@ -18,11 +19,13 @@ export const SensorCreator = ({namespace, onCreate}: {namespace: string; onCreat
<UploadButton onUpload={setSensor} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.sensor
.create(sensor, Utils.getNamespaceWithDefault(sensor.metadata.namespace))
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newSensor = await services.sensor.create(sensor, Utils.getNamespaceWithDefault(sensor.metadata.namespace));
onCreate(newSensor);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand All @@ -36,4 +39,4 @@ export const SensorCreator = ({namespace, onCreate}: {namespace: string; onCreat
</p>
</>
);
};
}
5 changes: 1 addition & 4 deletions ui/src/app/shared/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ export const nodeArtifacts = (node: NodeStatus, ar: ArtifactRepository) =>
.map(a => ({
...a,
// trim trailing slash to get the correct filename for a directory
filename: a.key
.replace(/\/$/, '')
.split('/')
.pop()
filename: a.key.replace(/\/$/, '').split('/').pop()
}));

export const artifactURN = <A extends Artifact>(a: A, ar: ArtifactRepository) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ export const WorkflowParametersEditor = <T extends WorkflowSpec>(props: {value:
props.value.arguments.parameters &&
props.value.arguments.parameters
.map(param => [param.name, param.value])
.reduce((obj, [key, val]) => {
obj[key] = val;
return obj;
}, {} as {[key: string]: string});
.reduce(
(obj, [key, val]) => {
obj[key] = val;
return obj;
},
{} as {[key: string]: string}
);

return (
<>
Expand All @@ -29,7 +32,7 @@ export const WorkflowParametersEditor = <T extends WorkflowSpec>(props: {value:
({
name: k,
value: v
} as Parameter)
}) as Parameter
);
props.onChange(props.value);
}}
Expand Down
5 changes: 1 addition & 4 deletions ui/src/app/shared/cron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import parser from 'cron-parser';
export function getNextScheduledTime(schedule: string, tz: string): Date {
let out: Date;
try {
out = parser
.parseExpression(schedule, {utc: !tz, tz})
.next()
.toDate();
out = parser.parseExpression(schedule, {utc: !tz, tz}).next().toDate();
} catch (e) {
// Do nothing
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const WorkflowsService = {
return from(requests.get(this.getArtifactLogsPath(workflow, nodeId, container, archived)));
}),
mergeMap(r => r.text.split('\n')),
map(content => ({content, podName: workflow.status.nodes[nodeId].displayName} as LogEntry)),
map(content => ({content, podName: workflow.status.nodes[nodeId].displayName}) as LogEntry),
filter(x => !!x.content.match(grep))
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {useState} from 'react';

import {WorkflowTemplate} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand All @@ -19,11 +20,13 @@ export function WorkflowTemplateCreator({namespace, onCreate}: {namespace: strin
<UploadButton onUpload={setTemplate} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.workflowTemplate
.create(template, Utils.getNamespaceWithDefault(template.metadata.namespace))
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newTemplate = await services.workflowTemplate.create(template, Utils.getNamespaceWithDefault(template.metadata.namespace));
onCreate(newTemplate);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/workflows/components/workflow-creator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Select} from 'argo-ui/src/components/select/select';
import * as React from 'react';
import {useEffect, useState} from 'react';

import {Workflow, WorkflowTemplate} from '../../../models';
import {Button} from '../../shared/components/button';
import {ErrorNotice} from '../../shared/components/error-notice';
Expand Down Expand Up @@ -105,11 +106,13 @@ export function WorkflowCreator({namespace, onCreate}: {namespace: string; onCre
<UploadButton onUpload={setWorkflow} onError={setError} />
<Button
icon='plus'
onClick={() => {
services.workflows
.create(workflow, Utils.getNamespaceWithDefault(workflow.metadata.namespace))
.then(onCreate)
.catch(setError);
onClick={async () => {
try {
const newWorkflow = await services.workflows.create(workflow, Utils.getNamespaceWithDefault(workflow.metadata.namespace));
onCreate(newWorkflow);
} catch (err) {
setError(err);
}
}}>
Create
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,7 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
return;
}

updateOutputParametersForNodeIfRequired()
.then(resumeNode)
.catch(setError);
updateOutputParametersForNodeIfRequired().then(resumeNode).catch(setError);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ function EnvVar(props: {env: models.kubernetes.EnvVar}) {
</Tooltip>
{secret.name}/{secret.key}
</>
) : (
undefined
);
) : undefined;

return (
<pre key={env.name}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function WorkflowsList({match, location, history}: RouteComponentProps<an
// save history and localStorage
useEffect(() => {
// add empty selectedPhases + selectedLabels for forward-compat w/ old version: previous code relies on them existing, so if you move up a version and back down, it breaks
const options = ({selectedPhases: [], selectedLabels: []} as unknown) as WorkflowListRenderOptions;
const options = {selectedPhases: [], selectedLabels: []} as unknown as WorkflowListRenderOptions;
options.phases = phases;
options.labels = labels;
if (pagination.limit) {
Expand Down
Loading