Skip to content

Commit afc052c

Browse files
Merge pull request #401 from topcoder-platform/TCA-645_auto-fix
TCA-645 Auto-fix Lint Issues -> TCA-499_eslint
2 parents e516391 + 5d9d5a8 commit afc052c

File tree

162 files changed

+1487
-1579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+1487
-1579
lines changed

src-ts/header/Header.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ import { Logo } from './logo'
55
import { ToolSelectors } from './tool-selectors'
66
import { UtilitySelectors } from './utility-selectors'
77

8-
const Header: FC<{}> = () => {
9-
return (
10-
<div className={styles['header-wrap']}>
11-
<header className={styles.header}>
12-
<ToolSelectors isWide={false} />
13-
<Logo />
14-
<ToolSelectors isWide={true} />
15-
<UtilitySelectors />
16-
</header>
17-
<div id='page-subheader-portal-el' className={styles.subheader}></div>
18-
</div>
19-
)
20-
}
8+
const Header: FC<{}> = () => (
9+
<div className={styles['header-wrap']}>
10+
<header className={styles.header}>
11+
<ToolSelectors isWide={false} />
12+
<Logo />
13+
<ToolSelectors isWide />
14+
<UtilitySelectors />
15+
</header>
16+
<div id='page-subheader-portal-el' className={styles.subheader} />
17+
</div>
18+
)
2119

2220
export default Header

src-ts/header/tool-selectors/ToolSelectors.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ interface ToolSelectorsProps {
77
isWide: boolean
88
}
99

10-
const ToolSelectors: FC<ToolSelectorsProps> = (props: ToolSelectorsProps) => {
11-
return props.isWide ? <ToolSelectorsWide /> : <ToolSelectorsNarrow />
12-
}
10+
const ToolSelectors: FC<ToolSelectorsProps> = (props: ToolSelectorsProps) => props.isWide ? <ToolSelectorsWide /> : <ToolSelectorsNarrow />
1311

1412
export default ToolSelectors

src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const ToolSelectorWide: FC<ToolSelectorWideProps> = (props: ToolSelectorWideProp
4646
>
4747
{toolRoute.title}
4848
</Link>
49-
<div className={styles['active-indicator']}></div>
49+
<div className={styles['active-indicator']} />
5050
</div>
5151
)
5252
}

src-ts/header/utility-selectors/UtilitySelectors.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import { FC } from 'react'
33
import ProfileSelector from './UtilitySelector/ProfileSelector/ProfileSelector'
44
import styles from './UtilitySelectors.module.scss'
55

6-
const UtilitySelectors: FC<{}> = () => {
7-
return (
8-
<div className={styles['utility-selectors']}>
9-
{/* TODO: make this configurable */}
10-
<ProfileSelector />
11-
</div>
12-
)
13-
}
6+
const UtilitySelectors: FC<{}> = () => (
7+
<div className={styles['utility-selectors']}>
8+
{/* TODO: make this configurable */}
9+
<ProfileSelector />
10+
</div>
11+
)
1412

1513
export default UtilitySelectors

src-ts/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
export { default as AppNextGen } from './App'
55
export { EnvironmentConfig } from './config'
66
export {
7-
Analytics,
8-
Breadcrumb,
9-
ContactSupportModal,
10-
logInitialize,
11-
OrderContractModal,
12-
PageFooter,
13-
PrivacyPolicyModal,
14-
profileContext,
15-
ProfileProvider,
16-
RouteProvider,
17-
TabsNavbar,
18-
TermsModal,
19-
xhrGetAsync,
20-
xhrGetBlobAsync,
21-
xhrPatchAsync,
22-
xhrPostAsync,
7+
Analytics,
8+
Breadcrumb,
9+
ContactSupportModal,
10+
logInitialize,
11+
OrderContractModal,
12+
PageFooter,
13+
PrivacyPolicyModal,
14+
profileContext,
15+
ProfileProvider,
16+
RouteProvider,
17+
TabsNavbar,
18+
TermsModal,
19+
xhrGetAsync,
20+
xhrGetBlobAsync,
21+
xhrPatchAsync,
22+
xhrPostAsync,
2323
} from './lib'
2424
export * from './tools'
2525
export * from './utils'

src-ts/lib/analytics/Analytics.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import { FC } from 'react'
33
import { GoogleTagManager } from './google-tag-manater'
44
import { SegmentAnalytics } from './segment-analytics'
55

6-
const Analytics: FC<{}> = () => {
7-
8-
return (
9-
<>
10-
<GoogleTagManager />
11-
<SegmentAnalytics />
12-
</>
13-
)
14-
}
6+
const Analytics: FC<{}> = () => (
7+
<>
8+
<GoogleTagManager />
9+
<SegmentAnalytics />
10+
</>
11+
)
1512

1613
export default Analytics
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
import { FC } from 'react'
22
import { Link } from 'react-router-dom'
33

4-
import styles from './../Breadcrumb.module.scss'
4+
import styles from "../Breadcrumb.module.scss"
55
import { BreadcrumbItemModel } from './breadcrumb-item.model'
66

77
interface BreadcrumbItemProps {
88
index: number
99
item: BreadcrumbItemModel
1010
}
1111

12-
const BreadcrumbItem: FC<BreadcrumbItemProps> = (props: BreadcrumbItemProps) => {
13-
return (
14-
<li key={props.index} onClick={() => props.item.onClick?.(props.item)}>
15-
<Link className={props.item.isElipsis && styles['elipsis']} to={props.item.url}>
16-
{props.item.name}
17-
</Link>
18-
</li>
19-
)
20-
}
12+
const BreadcrumbItem: FC<BreadcrumbItemProps> = (props: BreadcrumbItemProps) => (
13+
<li key={props.index} onClick={() => props.item.onClick?.(props.item)}>
14+
<Link className={props.item.isElipsis && styles.elipsis} to={props.item.url}>
15+
{props.item.name}
16+
</Link>
17+
</li>
18+
)
2119

2220
export default BreadcrumbItem

src-ts/lib/contact-support-form/ContactSupportForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const ContactSupportForm: FC<ContactSupportFormProps> = (props: ContactSupportFo
2323
const [saveOnSuccess, setSaveOnSuccess]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
2424

2525
useEffect(() => {
26-
if (!loading && saveOnSuccess) {
27-
props.onSave()
28-
}
26+
if (!loading && saveOnSuccess) {
27+
props.onSave()
28+
}
2929
}, [loading, saveOnSuccess])
3030

3131
function generateRequest(inputs: ReadonlyArray<FormInputModel>): ContactSupportRequest {
@@ -47,7 +47,7 @@ const ContactSupportForm: FC<ContactSupportFormProps> = (props: ContactSupportFo
4747
setLoading(true)
4848
return contactSupportSubmitRequestAsync(request)
4949
.then(() => {
50-
setSaveOnSuccess(true)
50+
setSaveOnSuccess(true)
5151
}).finally(() => setLoading(false))
5252
}
5353

src-ts/lib/content-layout/ContentLayout.tsx

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,40 @@ export interface ContentLayoutProps {
1616
titleClass?: string
1717
}
1818

19-
const ContentLayout: FC<ContentLayoutProps> = (props: ContentLayoutProps) => {
20-
return (
21-
<div className={classNames(styles.content, props.contentClass)}>
19+
const ContentLayout: FC<ContentLayoutProps> = (props: ContentLayoutProps) => (
20+
<div className={classNames(styles.content, props.contentClass)}>
2221

23-
<div className={classNames(styles['content-outer'], props.outerClass)}>
22+
<div className={classNames(styles['content-outer'], props.outerClass)}>
2423

25-
<div className={classNames(styles['content-inner'], props.innerClass)}>
24+
<div className={classNames(styles['content-inner'], props.innerClass)}>
2625

27-
{!!props.title && (
28-
<div className={classNames(styles['page-header'], props.titleClass)}>
26+
{!!props.title && (
27+
<div className={classNames(styles['page-header'], props.titleClass)}>
2928

30-
<h1>
31-
{props.title}
32-
</h1>
29+
<h1>
30+
{props.title}
31+
</h1>
3332

34-
{!!props.buttonConfig && (
35-
<div>
36-
<Button
37-
{...props.buttonConfig}
38-
buttonStyle='primary'
39-
size='lg'
40-
/>
41-
</div>
42-
)}
33+
{!!props.buttonConfig && (
34+
<div>
35+
<Button
36+
{...props.buttonConfig}
37+
buttonStyle='primary'
38+
size='lg'
39+
/>
40+
</div>
41+
)}
4342

44-
</div>
45-
)}
43+
</div>
44+
)}
4645

47-
{props.children}
48-
49-
</div>
46+
{props.children}
5047

5148
</div>
5249

5350
</div>
54-
)
55-
}
51+
52+
</div>
53+
)
5654

5755
export default ContentLayout

src-ts/lib/form/Form.tsx

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ const Form: <ValueType extends any, RequestType extends any>(props: FormProps<Va
8686
inputs,
8787
])
8888

89-
useEffect(() => {
90-
return () => {
91-
if (props.resetFormOnUnmount) {
92-
onReset()
93-
}
89+
useEffect(() => () => {
90+
if (props.resetFormOnUnmount) {
91+
onReset()
9492
}
9593
}, [])
9694

@@ -148,34 +146,32 @@ const Form: <ValueType extends any, RequestType extends any>(props: FormProps<Va
148146
formInitializeValues(inputs, props.formValues)
149147

150148
const setOnClickOnReset: (button: FormButton) => FormButton = (button) => {
151-
// if this is a reset button, set its onclick to reset
152-
if (!!button.isReset) {
153-
button = {
154-
...button,
155-
onClick: onReset,
156-
}
157-
}
158-
159-
return button
160-
}
149+
// if this is a reset button, set its onclick to reset
150+
if (!!button.isReset) {
151+
button = {
152+
...button,
153+
onClick: onReset,
154+
}
155+
}
161156

162-
const createButtonGroup: (groups: ReadonlyArray<FormButton>, isPrimaryGroup: boolean) => Array<JSX.Element> = (groups, isPrimaryGroup) => {
163-
return groups.map((button, index) => {
164-
button = setOnClickOnReset(button)
165-
166-
const disabled: boolean = (button.isSubmit && isFormInvalid) || !!props.shouldDisableButton?.(isPrimaryGroup, index)
167-
168-
return (
169-
<Button
170-
{...button}
171-
key={button.label || `button-${index}`}
172-
disable={disabled}
173-
tabIndex={button.notTabble ? -1 : index + (inputs ? inputs.length : 0) + (formDef.tabIndexStart || 0)}
174-
/>
175-
)
176-
})
157+
return button
177158
}
178159

160+
const createButtonGroup: (groups: ReadonlyArray<FormButton>, isPrimaryGroup: boolean) => Array<JSX.Element> = (groups, isPrimaryGroup) => groups.map((button, index) => {
161+
button = setOnClickOnReset(button)
162+
163+
const disabled: boolean = (button.isSubmit && isFormInvalid) || !!props.shouldDisableButton?.(isPrimaryGroup, index)
164+
165+
return (
166+
<Button
167+
{...button}
168+
key={button.label || `button-${index}`}
169+
disable={disabled}
170+
tabIndex={button.notTabble ? -1 : index + (inputs ? inputs.length : 0) + (formDef.tabIndexStart || 0)}
171+
/>
172+
)
173+
})
174+
179175
const secondaryGroupButtons: Array<JSX.Element> = createButtonGroup(formDef.buttons.secondaryGroup || [], false)
180176

181177
const primaryGroupButtons: Array<JSX.Element> = createButtonGroup(formDef.buttons.primaryGroup, true)
@@ -197,7 +193,7 @@ const Form: <ValueType extends any, RequestType extends any>(props: FormProps<Va
197193

198194
return (
199195
<form
200-
action={''}
196+
action=""
201197
className={styles.form}
202198
key={formKey}
203199
onSubmit={onSubmitAsync}

src-ts/lib/form/form-functions/form.functions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ export async function onSubmitAsync<T>(
109109
toast.success(safeSuccessMessage)
110110
onSuccess?.()
111111
})
112-
.catch(error => {
113-
return Promise.reject(error.response?.data?.result?.content || error.message || error)
114-
})
112+
.catch(error => Promise.reject(error.response?.data?.result?.content || error.message || error))
115113
}
116114

117115
function handleFieldEvent<T>(input: HTMLInputElement | HTMLTextAreaElement, inputs: ReadonlyArray<FormInputModel>, event: 'blur' | 'change', formValues?: T): void {
@@ -126,6 +124,7 @@ function handleFieldEvent<T>(input: HTMLInputElement | HTMLTextAreaElement, inpu
126124
if (event === 'change') {
127125
inputDef.dirty = input.value !== originalValue
128126
}
127+
129128
inputDef.touched = true
130129

131130
// set the def value
@@ -174,6 +173,7 @@ function validateField(formInputDef: FormInputModel, formElements: HTMLFormContr
174173
if (!nextError) {
175174
formInputDef.error = undefined
176175
}
176+
177177
return
178178
}
179179

src-ts/lib/form/form-groups/FormGroups.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,15 @@ const FormGroups: (props: FormGroupsProps) => JSX.Element = (props: FormGroupsPr
124124
}
125125

126126
const formGroups: Array<JSX.Element | undefined> = formDef?.groups
127-
?.map((element: FormGroup, index: number) => {
128-
return (
129-
<FormGroupItem
130-
key={`element-${index}`}
131-
group={element}
132-
renderFormInput={renderInputField}
133-
totalGroupCount={formDef.groups?.length || 0}
134-
renderDividers={props.formDef.groupsOptions?.renderGroupDividers}
135-
/>
136-
)
137-
})
127+
?.map((element: FormGroup, index: number) => (
128+
<FormGroupItem
129+
key={`element-${index}`}
130+
group={element}
131+
renderFormInput={renderInputField}
132+
totalGroupCount={formDef.groups?.length || 0}
133+
renderDividers={props.formDef.groupsOptions?.renderGroupDividers}
134+
/>
135+
))
138136
|| []
139137

140138
return (

0 commit comments

Comments
 (0)