Skip to content

Commit 42c187b

Browse files
committed
apply linting over work
1 parent 87301a3 commit 42c187b

File tree

26 files changed

+191
-148
lines changed

26 files changed

+191
-148
lines changed

src-ts/tools/work/work-detail-details/work-detail-details-pane/WorkDetailDetailsPane.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const WorkDetailDetailsPane: FC<WorkDetailDetailsPaneProps> = ({
5050
return <LoadingSpinner />
5151
}
5252

53-
const onTogglePane: () => void = () => {
53+
function onTogglePane(): void {
5454
if (!collapsible) {
5555
return
5656
}

src-ts/tools/work/work-detail-details/work-detail-details-sidebar/WorkDetailDetailsSidebar.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,34 @@ const WorkDetailDetailsSidebar: FC<{}> = () => {
1414
= useState<boolean>(false)
1515

1616
// TODO: update the Button component so it can handle links that don't have arrows
17-
function handleClick(event: MouseEvent<HTMLAnchorElement>, setter: Dispatch<SetStateAction<boolean>>): void {
18-
event.preventDefault()
19-
setter(true)
17+
function getClickHandler(setter: Dispatch<SetStateAction<boolean>>): (event: MouseEvent) => void {
18+
return (event: MouseEvent): void => {
19+
event.preventDefault()
20+
setter(true)
21+
}
2022
}
2123

2224
return (
2325
<>
24-
<OrderContractModal isOpen={isOrderContractModalOpen} onClose={() => setIsOrderContractModalOpen(false)} />
25-
<PrivacyPolicyModal isOpen={isPrivacyPolicyModalOpen} onClose={() => setIsPrivacyPolicyModalOpen(false)} />
26-
<TermsModal isOpen={isTermsModalOpne} onClose={() => setIsTermsModalOpen(false)} />
26+
<OrderContractModal
27+
isOpen={isOrderContractModalOpen}
28+
onClose={function handleOrderClose() { setIsOrderContractModalOpen(false) }}
29+
/>
30+
<PrivacyPolicyModal
31+
isOpen={isPrivacyPolicyModalOpen}
32+
onClose={function handlePPClose() { setIsPrivacyPolicyModalOpen(false) }}
33+
/>
34+
<TermsModal
35+
isOpen={isTermsModalOpne}
36+
onClose={function handleTermsClose() { setIsTermsModalOpen(false) }}
37+
/>
2738

2839
<div className={styles.wrap}>
2940
<h4>supporting information</h4>
3041
<a
3142
className={styles.link}
3243
href={window.location.href}
33-
onClick={e => handleClick(e, setIsOrderContractModalOpen)}
44+
onClick={getClickHandler(setIsOrderContractModalOpen)}
3445
rel='noopener noreferrer'
3546
role='button'
3647
tabIndex={0}
@@ -40,7 +51,7 @@ const WorkDetailDetailsSidebar: FC<{}> = () => {
4051
<a
4152
className={styles.link}
4253
href={window.location.href}
43-
onClick={e => handleClick(e, setIsPrivacyPolicyModalOpen)}
54+
onClick={getClickHandler(setIsPrivacyPolicyModalOpen)}
4455
rel='noopener noreferrer'
4556
role='button'
4657
tabIndex={0}
@@ -50,7 +61,7 @@ const WorkDetailDetailsSidebar: FC<{}> = () => {
5061
<a
5162
className={styles.link}
5263
href={window.location.href}
53-
onClick={e => handleClick(e, setIsTermsModalOpen)}
64+
onClick={getClickHandler(setIsTermsModalOpen)}
5465
rel='noopener noreferrer'
5566
role='button'
5667
tabIndex={0}

src-ts/tools/work/work-detail-header/WorkFeedback/WorkFeedback.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Dispatch, FC, SetStateAction, useState } from 'react'
22

33
import { BaseModal, Form, FormDefinition, formGetInputFields, FormInputModel, formOnReset } from '../../../../lib'
4+
import { FormValue } from '../../../../lib/form/form-functions'
45
import { Challenge } from '../../work-lib'
56

67
import { workFeedbackFormDef } from './work-feedback-form.config'
78
import styles from './WorkFeedback.module.scss'
89

910
interface WorkFeedbackProps {
11+
// eslint-disable-next-line react/no-unused-prop-types
1012
challenge: Challenge
1113
onClose: () => void
1214
saveSurvey: (feedback: any) => void
@@ -20,17 +22,18 @@ interface Feedback {
2022

2123
const WorkFeedback: FC<WorkFeedbackProps> = (props: WorkFeedbackProps) => {
2224

23-
const [formDef, setFormDef]: [FormDefinition, Dispatch<SetStateAction<FormDefinition>>] = useState<FormDefinition>({ ...workFeedbackFormDef })
25+
const [formDef, setFormDef]: [FormDefinition, Dispatch<SetStateAction<FormDefinition>>]
26+
= useState<FormDefinition>({ ...workFeedbackFormDef })
2427

2528
function requestGenerator(inputs: ReadonlyArray<FormInputModel>): Array<Feedback> {
2629
return inputs
2730
.map((input: FormInputModel) => ({
2831
name: input.instructions || input.label as string,
2932
value: input.value,
30-
}))
33+
} as Feedback))
3134
}
3235

33-
async function saveAsync(feedback: Array<Feedback>): Promise<void> {
36+
async function saveAsync(feedback: FormValue): Promise<void> {
3437
props.saveSurvey(feedback)
3538
onClose()
3639
}

src-ts/tools/work/work-detail-header/WorkFeedback/work-feedback-form.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ export const workFeedbackFormDef: FormDefinition = {
5757
},
5858
],
5959
subtitle: 'To mark this work as done, please provide feedback on your experience.',
60-
successMessage: 'Your feedback has been submitted. If your changes do not appear immediately, please reload the page.',
60+
successMessage: (
61+
'Your feedback has been submitted. If your changes do not appear immediately, please reload the page.'
62+
),
6163
}

src-ts/tools/work/work-detail-solutions/WorkDetailSolutions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const WorkDetailSolutions: FC<WorkDetailSolutionsProps> = (props: WorkDetailSolu
3232
Solutions Available for Download
3333
</h3>
3434
<p className='body-small'>
35-
The solutions listed below have met your detailed criteria. They are ranked based on the best solution as determined by Topcoder expert reviewers.
35+
The solutions listed below have met your detailed criteria.
36+
They are ranked based on the best solution as determined by Topcoder expert reviewers.
3637
</p>
3738
</div>
3839
)}

src-ts/tools/work/work-detail-solutions/work-solutions-list/work-solutions-list-item/WorkSolutionsListItem.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ interface WorkSolutionsListItemProps {
1010
solution: WorkSolution
1111
}
1212

13-
const WorkSolutionsListItem: FC<WorkSolutionsListItemProps> = (props: WorkSolutionsListItemProps) => (
14-
<div className={styles.wrap}>
15-
<div className={styles.name}>
16-
<span>Submitted by:</span>
17-
<span>{props.solution.createdBy}</span>
18-
</div>
13+
const WorkSolutionsListItem: FC<WorkSolutionsListItemProps> = (props: WorkSolutionsListItemProps) => {
14+
function handleClick(): void {
15+
props.onDownload(props.solution.id)
16+
}
17+
18+
return (
19+
<div className={styles.wrap}>
20+
<div className={styles.name}>
21+
<span>Submitted by:</span>
22+
<span>{props.solution.createdBy}</span>
23+
</div>
1924

20-
<Button
21-
buttonStyle='secondary'
22-
tabIndex={-1}
23-
label='Download'
24-
size='md'
25-
onClick={() => props.onDownload(props.solution.id)}
26-
/>
27-
</div>
28-
)
25+
<Button
26+
buttonStyle='secondary'
27+
tabIndex={-1}
28+
label='Download'
29+
size='md'
30+
onClick={handleClick}
31+
/>
32+
</div>
33+
)
34+
}
2935

3036
export default WorkSolutionsListItem

src-ts/tools/work/work-detail-summary/WorkDetailHighlights/WorkDetailHighlights.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,34 @@ interface WorkDetailHighlightsProps {
1515

1616
const WorkDetailHighlights: FC<WorkDetailHighlightsProps> = (props: WorkDetailHighlightsProps) => {
1717

18-
const { work }: WorkDetailHighlightsProps = props
19-
2018
const highlights: ReadonlyArray<{
2119
icon: JSX.Element,
2220
info?: number | string
2321
name: string
2422
}> = [
2523
{
2624
icon: <IconOutline.CalendarIcon />,
27-
info: textFormatDateLocaleShortString(work.submittedDate),
25+
info: textFormatDateLocaleShortString(props.work.submittedDate),
2826
name: 'Submitted',
2927
},
3028
{
3129
icon: <IconOutline.CurrencyDollarIcon />,
32-
info: textFormatMoneyLocaleString(work.cost),
30+
info: textFormatMoneyLocaleString(props.work.cost),
3331
name: 'Cost (USD)',
3432
},
3533
{
3634
icon: <IconOutline.UserGroupIcon />,
37-
info: work.participantsCount,
35+
info: props.work.participantsCount,
3836
name: 'Participants',
3937
},
4038
{
4139
icon: <IconOutline.DocumentTextIcon />,
42-
info: work.solutionsCount,
40+
info: props.work.solutionsCount,
4341
name: 'Solutions Received',
4442
},
4543
{
4644
icon: <IconOutline.IdentificationIcon />,
47-
info: work.id,
45+
info: props.work.id,
4846
name: 'Work id',
4947
},
5048
]
@@ -53,7 +51,7 @@ const WorkDetailHighlights: FC<WorkDetailHighlightsProps> = (props: WorkDetailHi
5351
.map((item, index) => (
5452
<div
5553
className={styles.highlight}
56-
key={index}
54+
key={index as any}
5755
>
5856

5957
<div className={styles.icon}>

src-ts/tools/work/work-detail-summary/WorkDetailProgress/WorkDetailProgress.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import styles from './WorkDetailProgress.module.scss'
88

99
const WorkDetailProgress: FC<WorkProgress> = (props: WorkProgress) => {
1010

11-
const { steps, activeStepIndex }: WorkProgress = props
12-
13-
const progressItems: Array<JSX.Element> = steps
11+
const progressItems: Array<JSX.Element> = props.steps
1412
.map((item, index) => (
1513
<WorkDetailProgressItem
1614
{...item}
17-
activeStepIndex={activeStepIndex}
15+
activeStepIndex={props.activeStepIndex}
1816
currentIndex={index}
19-
key={index}
17+
key={index as any}
2018
/>
2119
))
2220

src-ts/tools/work/work-detail-summary/WorkTransferredStatus/WorkTransferredStatus.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const WorkTransferredStatus: FC<{}> = () => (
77
<h3>Transferred</h3>
88
<p>
99
<div className={styles.line}>
10-
We have a few outstanding questions that will help us better understand the work and scope before we can launch your work on our platform.
10+
We have a few outstanding questions that will help us better understand the
11+
work and scope before we can launch your work on our platform.
1112
</div>
1213

1314
<div className={styles.line}>

src-ts/tools/work/work-lib/work-provider/message-functions/message-store/message.store.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { GetUnreadMessageCountResponse } from './get-unread-message-count-respon
55

66
export async function getUnreadCountAsync(workId: string, handle: string): Promise<GetUnreadMessageCountResponse> {
77

8-
const url: string = `${EnvironmentConfig.API.FORUM_V2}/groups/${workId}/member/${handle}?access_token=${EnvironmentConfig.API.FORUM_ACCESS_TOKEN}`
8+
const url: string = [
9+
`${EnvironmentConfig.API.FORUM_V2}/groups/${workId}/member/${handle}`,
10+
`access_token=${EnvironmentConfig.API.FORUM_ACCESS_TOKEN}`,
11+
].join('?')
912

1013
const response: { unreadNotifications: number } = await xhrGetAsync(url)
1114

0 commit comments

Comments
 (0)