Skip to content

Commit c175378

Browse files
committed
fix lint
1 parent d0bf0f0 commit c175378

File tree

8 files changed

+195
-88
lines changed

8 files changed

+195
-88
lines changed

integration-tests/cypress/support/commands/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Cypress.Commands.add('checkErrors', () => {
153153

154154
Cypress.Commands.add(
155155
'waitUntilEnabled',
156-
(selector: string, timeout: number = 20000): any => {
156+
(selector: string, timeout = 20000): any => {
157157
const start = new Date().getTime();
158158

159159
return cy.get(selector).then(($el) => {

integration-tests/cypress/support/pages/functions/createGitWorkload.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export const createGitWorkload = (
4343
};
4444

4545
export const createGitWorkloadIfNotExistsOnTopologyPage = (
46-
gitUrl: string = 'https://github.com/sclorg/nodejs-ex.git',
47-
componentName: string = 'nodejs-ex-git',
48-
resourceType: string = 'Deployment',
46+
gitUrl = 'https://github.com/sclorg/nodejs-ex.git',
47+
componentName = 'nodejs-ex-git',
48+
resourceType = 'Deployment',
4949
appName?: string,
50-
isPipelineSelected: boolean = false,
51-
isServerlessFunction: boolean = false,
50+
isPipelineSelected = false,
51+
isServerlessFunction = false,
5252
) => {
5353
navigateTo(devNavigationMenu.Topology);
5454
topologyPage.waitForLoad();

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@types/react-router-dom": "^5.3.2",
6161
"@types/react-transition-group": "2.x",
6262
"@types/react-virtualized": "9.x",
63-
"@typescript-eslint/eslint-plugin": "^8.29.0",
63+
"@typescript-eslint/eslint-plugin": "^5.14.0",
6464
"@typescript-eslint/parser": "^5.14.0",
6565
"@wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
6666
"babel-jest": "^29.7.0",

src/components/logs/Logs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const Logs: React.FC<LogsProps> = ({
111111
onError: () => void,
112112
retryCount = 0,
113113
) => {
114-
let ws = new WSFactory(watchURL, wsOpts);
114+
const ws = new WSFactory(watchURL, wsOpts);
115115
const handleError = () => {
116116
if (retryCount < 5) {
117117
setTimeout(() => {

src/components/pipeline-builder/CodeEditorSidebar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const CodeEditorSidebar: React.FC<CodeEditorSidebarProps> = ({
3131
const editor = editorRef.current?.editor;
3232

3333
const insertYamlContent = React.useCallback(
34-
(id: string = 'default', yamlContent: string = '', kind) => {
34+
(id = 'default', yamlContent = '', kind) => {
3535
const yaml = sanitizeYamlContent
3636
? sanitizeYamlContent(id, yamlContent, kind)
3737
: yamlContent;
@@ -73,7 +73,7 @@ const CodeEditorSidebar: React.FC<CodeEditorSidebarProps> = ({
7373
);
7474

7575
const replaceYamlContent = React.useCallback(
76-
(id: string = 'default', yamlContent: string = '', kind: string) => {
76+
(id = 'default', yamlContent = '', kind: string) => {
7777
const yaml = sanitizeYamlContent
7878
? sanitizeYamlContent(id, yamlContent, kind)
7979
: yamlContent;
@@ -83,7 +83,7 @@ const CodeEditorSidebar: React.FC<CodeEditorSidebarProps> = ({
8383
);
8484

8585
const downloadYamlContent = React.useCallback(
86-
(id: string = 'default', yamlContent: string = '', kind: string) => {
86+
(id = 'default', yamlContent = '', kind: string) => {
8787
try {
8888
const yaml = sanitizeYamlContent
8989
? sanitizeYamlContent(id, yamlContent, kind)

src/components/pipeline-builder/__tests__/switch-to-form-validation-utils.spec.ts

+136-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { initialPipelineFormData } from '../const';
2-
import { hasMultipleErrors, withFormData } from './switch-to-form-validation-utils-data';
2+
import {
3+
hasMultipleErrors,
4+
withFormData,
5+
} from './switch-to-form-validation-utils-data';
36
import {
47
createSafeTask,
58
embeddedTaskSpec,
@@ -14,11 +17,17 @@ const requiredMessage = 'Required';
1417

1518
describe('Pipeline Builder YAML to Form switch validation schema', () => {
1619
it('should pass initial values', async () => {
17-
await withFormData(formDataBasicPassState, '', {}).then(hasResults).catch(shouldHavePassed);
20+
await withFormData(formDataBasicPassState, '', {})
21+
.then(hasResults)
22+
.catch(shouldHavePassed);
1823
});
1924

2025
it('should pass if there is an invalid name', async () => {
21-
await withFormData(formDataBasicPassState, 'metadata.name', '123NoTaVaLiDnAmE-')
26+
await withFormData(
27+
formDataBasicPassState,
28+
'metadata.name',
29+
'123NoTaVaLiDnAmE-',
30+
)
2231
.then(hasResults)
2332
.catch(shouldHavePassed);
2433
});
@@ -103,7 +112,10 @@ describe('Pipeline Builder YAML to Form switch validation schema', () => {
103112
});
104113

105114
it('should fail if resource is not an array', async () => {
106-
await withFormData(formDataBasicPassState, 'spec.resources', { name: 'git-value', type: 'git' })
115+
await withFormData(formDataBasicPassState, 'spec.resources', {
116+
name: 'git-value',
117+
type: 'git',
118+
})
107119
.then(shouldHaveFailed)
108120
.catch(
109121
hasError(
@@ -138,13 +150,17 @@ describe('Pipeline Builder YAML to Form switch validation schema', () => {
138150
});
139151

140152
it('should pass when provided with a valid workspace name', async () => {
141-
await withFormData(formDataBasicPassState, 'spec.workspaces', [{ name: 'valid-name' }])
153+
await withFormData(formDataBasicPassState, 'spec.workspaces', [
154+
{ name: 'valid-name' },
155+
])
142156
.then(hasResults)
143157
.catch(shouldHavePassed);
144158
});
145159

146160
it('should pass when workspaces do not have a name', async () => {
147-
await withFormData(formDataBasicPassState, 'spec.workspaces', [{ notName: 'not-valid' }])
161+
await withFormData(formDataBasicPassState, 'spec.workspaces', [
162+
{ notName: 'not-valid' },
163+
])
148164
.then(hasResults)
149165
.catch(shouldHavePassed);
150166
});
@@ -173,13 +189,17 @@ describe('Tasks validation', () => {
173189
});
174190

175191
it('should pass even if a task has an incomplete taskRef', async () => {
176-
await withFormData(formDataBasicPassState, 'spec.tasks', [{ name: 'test', taskRef: {} }])
192+
await withFormData(formDataBasicPassState, 'spec.tasks', [
193+
{ name: 'test', taskRef: {} },
194+
])
177195
.then(hasResults)
178196
.catch(shouldHavePassed);
179197
});
180198

181199
it('should pass if provided a taskSpec and name', async () => {
182-
await withFormData(formDataBasicPassState, 'spec.tasks', [{ name: 'test', taskSpec: {} }])
200+
await withFormData(formDataBasicPassState, 'spec.tasks', [
201+
{ name: 'test', taskSpec: {} },
202+
])
183203
.then(hasResults)
184204
.catch(shouldHavePassed);
185205
});
@@ -195,7 +215,9 @@ describe('Tasks validation', () => {
195215
it('should fail if a task just has a name', async () => {
196216
await withFormData(formDataBasicPassState, 'spec.tasks', [{ name: 'test' }])
197217
.then(shouldHaveFailed)
198-
.catch(hasError('spec.tasks[0]', 'TaskSpec or TaskRef must be provided.'));
218+
.catch(
219+
hasError('spec.tasks[0]', 'TaskSpec or TaskRef must be provided.'),
220+
);
199221
});
200222

201223
it('should fail if a task has a name of invalid type', async () => {
@@ -269,7 +291,11 @@ describe('Tasks validation', () => {
269291
describe('Validate Task Run Afters', () => {
270292
it('should fail if runAfter has invalid entry', async () => {
271293
await withFormData(formDataBasicPassState, 'spec.tasks', [
272-
{ name: 'test', runAfter: 'not-an-array', taskRef: { name: 'external-task' } },
294+
{
295+
name: 'test',
296+
runAfter: 'not-an-array',
297+
taskRef: { name: 'external-task' },
298+
},
273299
])
274300
.then(shouldHaveFailed)
275301
.catch(
@@ -287,10 +313,11 @@ describe('Validate Task Run Afters', () => {
287313
runAfter: ['other-task'],
288314
taskRef: { name: 'external-task' },
289315
};
290-
await withFormData({ ...initialPipelineFormData, tasks: [firstTask] }, 'spec.tasks', [
291-
firstTask,
292-
secondTask,
293-
])
316+
await withFormData(
317+
{ ...initialPipelineFormData, tasks: [firstTask] },
318+
'spec.tasks',
319+
[firstTask, secondTask],
320+
)
294321
.then(shouldHaveFailed)
295322
.catch(hasError('spec.tasks[1].runAfter[0]', 'Invalid runAfter'));
296323
});
@@ -349,10 +376,11 @@ describe('Validate Task Run Afters', () => {
349376
runAfter: ['second-task'],
350377
taskRef: { name: 'second-task' },
351378
};
352-
await withFormData({ ...initialPipelineFormData, tasks: [firstTask] }, 'spec.tasks', [
353-
firstTask,
354-
secondTask,
355-
])
379+
await withFormData(
380+
{ ...initialPipelineFormData, tasks: [firstTask] },
381+
'spec.tasks',
382+
[firstTask, secondTask],
383+
)
356384
.then(shouldHaveFailed)
357385
.catch(hasError('spec.tasks[1].runAfter[0]', 'Invalid runAfter'));
358386
});
@@ -492,7 +520,9 @@ describe('Validate Task Parameters', () => {
492520
{
493521
name: 'test-task',
494522
taskRef: { name: 'external-task' },
495-
params: [{ name: { label: 'param-name' }, value: { label: 'param-value' } }],
523+
params: [
524+
{ name: { label: 'param-name' }, value: { label: 'param-value' } },
525+
],
496526
},
497527
];
498528
await withFormData(formDataBasicPassState, 'spec.tasks', tasks)
@@ -518,7 +548,12 @@ describe('Validate Task Parameters', () => {
518548
{
519549
name: 'test-task',
520550
taskRef: { name: 'external-task' },
521-
params: [{ name: 'param-name', value: ['valid-param-value', ['invalid-param-value']] }],
551+
params: [
552+
{
553+
name: 'param-name',
554+
value: ['valid-param-value', ['invalid-param-value']],
555+
},
556+
],
522557
},
523558
];
524559
await withFormData(formDataBasicPassState, 'spec.tasks', tasks)
@@ -580,7 +615,10 @@ describe('Validate Resources', () => {
580615
{
581616
name: 'test-task',
582617
taskRef: { name: 'external-task' },
583-
resources: { notInputs: 'not-input', outputs: [{ name: 'output', resource: 'image' }] },
618+
resources: {
619+
notInputs: 'not-input',
620+
outputs: [{ name: 'output', resource: 'image' }],
621+
},
584622
},
585623
];
586624
await withFormData(formDataBasicPassState, 'spec.tasks', tasks)
@@ -891,8 +929,16 @@ describe('Validate Task When', () => {
891929
name: 'test-task',
892930
taskRef: { name: 'external-task' },
893931
when: [
894-
{ input: '$(params.test)', operator: 'in', values: ['test-values-one'] },
895-
{ input: '$(params.test)', operator: 'in', values: ['test-value-two'] },
932+
{
933+
input: '$(params.test)',
934+
operator: 'in',
935+
values: ['test-values-one'],
936+
},
937+
{
938+
input: '$(params.test)',
939+
operator: 'in',
940+
values: ['test-value-two'],
941+
},
896942
],
897943
},
898944
];
@@ -907,8 +953,16 @@ describe('Validate Task When', () => {
907953
name: 'test-task',
908954
taskRef: { name: 'external-task' },
909955
when: [
910-
{ notInput: 'not-input', operator: 'in', values: ['test-values-one'] },
911-
{ input: '$(params.test)', operator: 'in', values: ['test-value-two'] },
956+
{
957+
notInput: 'not-input',
958+
operator: 'in',
959+
values: ['test-values-one'],
960+
},
961+
{
962+
input: '$(params.test)',
963+
operator: 'in',
964+
values: ['test-value-two'],
965+
},
912966
],
913967
},
914968
];
@@ -923,8 +977,16 @@ describe('Validate Task When', () => {
923977
name: 'test-task',
924978
taskRef: { name: 'external-task' },
925979
when: [
926-
{ input: '$(params.test)', notOperator: 'not-operator', values: ['test-values-one'] },
927-
{ input: '$(params.test)', operator: 'in', values: ['test-value-two'] },
980+
{
981+
input: '$(params.test)',
982+
notOperator: 'not-operator',
983+
values: ['test-values-one'],
984+
},
985+
{
986+
input: '$(params.test)',
987+
operator: 'in',
988+
values: ['test-value-two'],
989+
},
928990
],
929991
},
930992
];
@@ -940,7 +1002,11 @@ describe('Validate Task When', () => {
9401002
taskRef: { name: 'external-task' },
9411003
when: [
9421004
{ input: '$(params.test)', operator: 'in', notValues: 'not-values' },
943-
{ input: '$(params.test)', operator: 'in', values: ['test-value-two'] },
1005+
{
1006+
input: '$(params.test)',
1007+
operator: 'in',
1008+
values: ['test-value-two'],
1009+
},
9441010
],
9451011
},
9461012
];
@@ -954,7 +1020,11 @@ describe('Validate Task When', () => {
9541020
{
9551021
name: 'test-task',
9561022
taskRef: { name: 'external-task' },
957-
when: { input: '$(params.test)', operator: 'in', values: ['test-values-one'] },
1023+
when: {
1024+
input: '$(params.test)',
1025+
operator: 'in',
1026+
values: ['test-values-one'],
1027+
},
9581028
},
9591029
];
9601030
await withFormData(formDataBasicPassState, 'spec.tasks', tasks)
@@ -979,8 +1049,18 @@ describe('Validate Task When', () => {
9791049
name: 'test-task',
9801050
taskRef: { name: 'external-task' },
9811051
when: [
982-
{ input: '$(params.test)', operator: 'in', values: ['test-values-one'] },
983-
[{ input: '$(params.test)', operator: 'in', values: ['test-value-two'] }],
1052+
{
1053+
input: '$(params.test)',
1054+
operator: 'in',
1055+
values: ['test-values-one'],
1056+
},
1057+
[
1058+
{
1059+
input: '$(params.test)',
1060+
operator: 'in',
1061+
values: ['test-value-two'],
1062+
},
1063+
],
9841064
],
9851065
},
9861066
];
@@ -1008,9 +1088,21 @@ describe('Validate Task When', () => {
10081088
name: 'test-task',
10091089
taskRef: { name: 'external-task' },
10101090
when: [
1011-
{ input: ['$(params.test1)'], operator: 'in', values: ['test-values-one'] },
1012-
{ input: '$(params.test2)', operator: ['or'], values: ['test-value-two'] },
1013-
{ input: '$(params.test3)', operator: 'and', values: 'test-value-three' },
1091+
{
1092+
input: ['$(params.test1)'],
1093+
operator: 'in',
1094+
values: ['test-values-one'],
1095+
},
1096+
{
1097+
input: '$(params.test2)',
1098+
operator: ['or'],
1099+
values: ['test-value-two'],
1100+
},
1101+
{
1102+
input: '$(params.test3)',
1103+
operator: 'and',
1104+
values: 'test-value-three',
1105+
},
10141106
],
10151107
},
10161108
];
@@ -1043,8 +1135,16 @@ describe('Validate Task When', () => {
10431135
name: 'test-task',
10441136
taskRef: { name: 'external-task' },
10451137
when: [
1046-
{ input: '$(params.test)', operator: 'in', values: ['test-values-one'] },
1047-
{ input: '$(params.test)', operator: 'in', values: [{ test: 'test-value-two' }] },
1138+
{
1139+
input: '$(params.test)',
1140+
operator: 'in',
1141+
values: ['test-values-one'],
1142+
},
1143+
{
1144+
input: '$(params.test)',
1145+
operator: 'in',
1146+
values: [{ test: 'test-value-two' }],
1147+
},
10481148
],
10491149
},
10501150
];

0 commit comments

Comments
 (0)