Skip to content

Commit 4744265

Browse files
Merge branch 'TCA-499_eslint_fix-linting' of https://github.com/topcoder-platform/platform-ui into TCA-499_eslint_fix-linting
2 parents 8e084d1 + 21f4512 commit 4744265

File tree

32 files changed

+177
-114
lines changed

32 files changed

+177
-114
lines changed

src-ts/.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ module.exports = {
8383
'jsx-a11y/tabindex-no-positive': [
8484
'warn'
8585
],
86+
'newline-per-chained-call': [
87+
'error',
88+
{
89+
ignoreChainWithDepth: 1,
90+
}
91+
],
8692
'max-len': [
8793
'error',
8894
120,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const ContactSupportForm: FC<ContactSupportFormProps> = (props: ContactSupportFo
5656
return contactSupportSubmitRequestAsync(request)
5757
.then(() => {
5858
setSaveOnSuccess(true)
59-
}).finally(() => setLoading(false))
59+
})
60+
.finally(() => setLoading(false))
6061
}, [])
6162

6263
const emailElement: JSX.Element | undefined = !!profile?.email

src-ts/lib/form/form-groups/form-card-set/FormCardSet.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ const FormCardSet: React.FC<FormCardSetProps> = (props: FormCardSetProps) => {
2727
return <></>
2828
}
2929

30-
const iconName: string = `${icon.split('-').map((chunk: string) => chunk.charAt(0).toUpperCase() + chunk.slice(1)).join('')}Icon`
30+
const iconName: string = `${icon.split('-')
31+
.map((chunk: string) => chunk.charAt(0)
32+
.toUpperCase() + chunk.slice(1))
33+
.join('')}Icon`
3134
const IconComponent: React.FC<SVGProps<SVGSVGElement>> = IconOutline[iconName as keyof typeof IconOutline]
3235
return <IconComponent className={styles['card-row-icon']} />
3336
}

src-ts/lib/modals/base-modal/use-fetch-modal-content.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Dispatch, SetStateAction, useEffect, useState} from 'react'
1+
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
22

33
import { xhrGetAsync } from '../../functions'
44

@@ -15,7 +15,8 @@ export function useFetchModalContent(contentUrl?: string, enabled?: boolean): Mo
1515
}
1616

1717
if (!content) {
18-
xhrGetAsync<string>(contentUrl).then(setContent)
18+
xhrGetAsync<string>(contentUrl)
19+
.then(setContent)
1920
}
2021
}, [contentUrl, content, enabled])
2122

src-ts/lib/page-footer/PageFooter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ const PageFooter: FC<{}> = () => {
4848
<div>
4949
<span>
5050
©
51-
{(new Date()).getFullYear()}
51+
{(new Date())
52+
.getFullYear()}
5253
{' '}
5354
Topcoder
5455
</span>

src-ts/lib/route-provider/router.utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ export type LazyLoadType = (
1414
* (while react's `lazy` method only allows to import default exports)
1515
*/
1616
export const lazyLoad: LazyLoadType = (moduleImport: () => Promise<any>, namedExport: string = 'default') => (
17-
lazy(() => moduleImport().then(m => ({ default: get(m, namedExport) })))
17+
lazy(() => moduleImport()
18+
.then(m => ({ default: get(m, namedExport) })))
1819
)

src-ts/tools/dev-center/dev-center-lib/MarkdownDoc/markdownRenderer/renderer.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,18 @@ export class Renderer implements MarkdownRenderer {
8080
const children: ReturnType<typeof this.groupBy> = this.groupBy(
8181
nodes,
8282
options,
83-
).map(node => {
84-
if (Array.isArray(node)) {
85-
return (
86-
<MarkdownAccordion>
87-
{React.Children.map(node, child => child)}
88-
</MarkdownAccordion>
89-
)
90-
}
83+
)
84+
.map(node => {
85+
if (Array.isArray(node)) {
86+
return (
87+
<MarkdownAccordion>
88+
{React.Children.map(node, child => child)}
89+
</MarkdownAccordion>
90+
)
91+
}
9192

92-
return node
93-
})
93+
return node
94+
})
9495

9596
return (
9697
<div className={styles['markdown-doc']}>
@@ -287,7 +288,8 @@ export class Renderer implements MarkdownRenderer {
287288
const h: string = marked.parser([token], parserOptions)
288289
const level: number = token.depth
289290
const title: string = removeLineBreak(stripTag(h, `h${level}`))
290-
const headingId: string = extractId(h, `h${level}`, index).trim()
291+
const headingId: string = extractId(h, `h${level}`, index)
292+
.trim()
291293

292294
options.toc.push({
293295
headingId,
@@ -351,12 +353,14 @@ export class Renderer implements MarkdownRenderer {
351353
const tag: string = extractTag(html)
352354
if (tag) {
353355
const isParagraphTag: boolean = tag === MarkdownParagraphTag.p
354-
const isHeaderTag: boolean = Object.values(MarkdownHeaderTag).indexOf(tag as MarkdownHeaderTag) !== -1
356+
const isHeaderTag: boolean = Object.values(MarkdownHeaderTag)
357+
.indexOf(tag as MarkdownHeaderTag) !== -1
355358
if (isParagraphTag || isHeaderTag) {
356359
let id: string | undefined
357360
if (isHeaderTag) {
358361
token = token as marked.Tokens.Heading
359-
id = extractId(html, `h${token.depth}`, index).trim()
362+
id = extractId(html, `h${token.depth}`, index)
363+
.trim()
360364
}
361365

362366
return React.createElement(tag, {

src-ts/tools/dev-center/dev-center-lib/MarkdownDoc/markdownRenderer/util.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ export function renderMarkdown(
3030
const matchStr: string = matches ? matches[0] : ''
3131
return matchStr
3232
? {
33-
s: fromStr.replace(matchStr, '').trimStart(),
34-
title: matchStr.replace(/^#/, '').replace(/`/g, '').trim(),
33+
s: fromStr.replace(matchStr, '')
34+
.trimStart(),
35+
title: matchStr.replace(/^#/, '')
36+
.replace(/`/g, '')
37+
.trim(),
3538
}
3639
: { title, s }
3740
}

src-ts/tools/dev-center/dev-center-pages/community-app/landing-page/dev-center-articles-section/CardSection/CardSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const CardSection: FC = () => {
3333
return blog
3434
}
3535
}),
36-
).then(arr => setArticles(arr))
36+
)
37+
.then(arr => setArticles(arr))
3738
}, [])
3839

3940
const articleStyles: Array<any> = [

src-ts/tools/gamification-admin/pages/badge-detail/AwardedMembersTab/awarded-members-table/member-awardedAt-renderer/MemberAwaredAtRenderer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const MemberAwaredAtRenderer = (memberAward: MemberBadgeAward): JSX.Element => {
1212
}
1313

1414
return (
15-
<div className={styles.memberAwardedAt}>{new Date(memberAward.awarded_at).toLocaleString(undefined, dateFormat)}</div>
15+
<div className={styles.memberAwardedAt}>
16+
{new Date(memberAward.awarded_at)
17+
.toLocaleString(undefined, dateFormat)}
18+
</div>
1619
)
1720
}
1821

0 commit comments

Comments
 (0)