Skip to content

Commit 88d0cd7

Browse files
authored
Merge pull request #1235 from isaacphysics/improvement/autofix-eslint-warnings
Autofix ESLint warnings and RS imports
2 parents ad6b07b + c40056c commit 88d0cd7

File tree

232 files changed

+2923
-2854
lines changed

Some content is hidden

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

232 files changed

+2923
-2854
lines changed

src/app/components/content/AnvilApp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const AnvilApp = ({doc}: AnvilAppProps) => {
6363
}
6464

6565
const queryParams = Object.keys(appParams).map((key) => {
66-
return encodeURIComponent(key) + '=' + encodeURIComponent(appParams[key])
66+
return encodeURIComponent(key) + '=' + encodeURIComponent(appParams[key]);
6767
}).join('&');
6868

6969
const iframeSrc = `${baseURL}#?${queryParams}`;
@@ -73,7 +73,7 @@ export const AnvilApp = ({doc}: AnvilAppProps) => {
7373
return;
7474
}
7575

76-
let data = e.data;
76+
const data = e.data;
7777

7878
if (iframeRef.current && (data.fn == "newAppHeight")) {
7979
(iframeRef.current as HTMLIFrameElement).height = data.newHeight + 15;

src/app/components/content/IsaacAccordion.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ export const IsaacAccordion = ({doc}: {doc: ContentDTO}) => {
5454
// Handle conditional display settings
5555
.map(section => {
5656
const sectionDisplay = mergeDisplayOptions(accordionDisplay, section.display);
57-
const sectionDisplaySettings = isIntendedAudience(section.audience, userContext, user) ?
58-
sectionDisplay?.["audience"] : sectionDisplay?.["nonAudience"];
57+
const sectionDisplaySettings = isIntendedAudience(section.audience, userContext, user)
58+
? sectionDisplay?.["audience"]
59+
: sectionDisplay?.["nonAudience"];
5960
if (sectionDisplaySettings?.includes("open")) {section.startOpen = true;}
6061
if (sectionDisplaySettings?.includes("closed")) {section.startOpen = false;}
6162
if (sectionDisplaySettings?.includes("de-emphasised")) {section.deEmphasised = true;}

src/app/components/content/IsaacCallout.tsx

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ import classNames from "classnames";
66
import {siteSpecific} from "../../services";
77

88
const calloutStyle = siteSpecific({
9-
width: "43",
10-
height: "43",
11-
// SVG taken from https://www.svgrepo.com/svg/914/speech-bubble, no attribution needed
12-
src: "/assets/phy/callout-speech-bubble.svg",
13-
style: {
14-
marginTop: -7,
15-
marginLeft: -2,
16-
marginRight: 18
17-
},
18-
colour: "t-grey"
19-
},{
20-
width: "50",
21-
height: "50",
22-
src: {
23-
regular: "/assets/cs/icons/regular-callout.svg",
24-
testData: "/assets/cs/icons/test-callout.svg",
25-
sampleRun: "/assets/cs/icons/run-callout.svg",
26-
scenario: "/assets/cs/icons/scenario-callout.svg",
27-
},
28-
style: {
29-
marginTop: -15,
30-
marginRight: -15
31-
},
32-
colour: {
33-
regular: "hi-cyan-25",
34-
testData: "hi-yellow-25",
35-
sampleRun: "hi-pink-25",
36-
scenario: "hi-yellow-50",
37-
}
38-
});
9+
width: "43",
10+
height: "43",
11+
// SVG taken from https://www.svgrepo.com/svg/914/speech-bubble, no attribution needed
12+
src: "/assets/phy/callout-speech-bubble.svg",
13+
style: {
14+
marginTop: -7,
15+
marginLeft: -2,
16+
marginRight: 18
17+
},
18+
colour: "t-grey"
19+
},{
20+
width: "50",
21+
height: "50",
22+
src: {
23+
regular: "/assets/cs/icons/regular-callout.svg",
24+
testData: "/assets/cs/icons/test-callout.svg",
25+
sampleRun: "/assets/cs/icons/run-callout.svg",
26+
scenario: "/assets/cs/icons/scenario-callout.svg",
27+
},
28+
style: {
29+
marginTop: -15,
30+
marginRight: -15
31+
},
32+
colour: {
33+
regular: "hi-cyan-25",
34+
testData: "hi-yellow-25",
35+
sampleRun: "hi-pink-25",
36+
scenario: "hi-yellow-50",
37+
}
38+
});
3939

4040
const DEFAULT_CALLOUT_STYLE = "regular" as const;
4141
export const IsaacCallout = ({doc}: {doc: ContentDTO}) => {
@@ -49,10 +49,11 @@ export const IsaacCallout = ({doc}: {doc: ContentDTO}) => {
4949
className={classNames("isaac-callout", colourClass)}>
5050
<Col>
5151
<img className={siteSpecific("float-start", "float-end")} style={calloutStyle.style}
52-
width={calloutStyle.width} height={calloutStyle.height} src={iconSrc} alt=""/>
52+
width={calloutStyle.width} height={calloutStyle.height} src={iconSrc} alt=""
53+
/>
5354
<IsaacContentValueOrChildren encoding={doc.encoding} value={doc.value}>
5455
{doc.children}
5556
</IsaacContentValueOrChildren>
5657
</Col>
5758
</Row>;
58-
};
59+
};

src/app/components/content/IsaacCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const PhysicsContentCard = ({doc, imageClassName, className, ...rest}: IsaacCard
1818
const imgSrc = image?.src && apiHelper.determineImageUrl(image.src);
1919

2020
const link = (clickUrl && isAppLink(clickUrl)) ? <Link to={clickUrl} className={"stretched-link"} aria-label={title} aria-disabled={disabled}/> :
21-
<a href={clickUrl} className={"stretched-link"} aria-label={title} aria-disabled={disabled}/>
21+
<a href={clickUrl} className={"stretched-link"} aria-label={title} aria-disabled={disabled}/>;
2222

2323
return <Col className="d-flex h-100 justify-content-center">
2424
{verticalContent ?

src/app/components/content/IsaacCodeSnippet.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ const IsaacCodeSnippet = ({doc}: IsaacCodeProps) => {
4545
{isAda && window.ResizeObserver && <ScrollShadows element={scrollPromptRef} />}
4646
<Row>
4747
<Col>
48-
<pre ref={updateScrollPromptRef} className="line-numbers">
49-
<code ref={codeSnippetRef} className={doc.disableHighlighting ? 'plaintext' : doc.language}>
50-
{doc.code}
51-
</code>
52-
</pre>
48+
<pre ref={updateScrollPromptRef} className="line-numbers">
49+
<code ref={codeSnippetRef} className={doc.disableHighlighting ? 'plaintext' : doc.language}>
50+
{doc.code}
51+
</code>
52+
</pre>
5353
</Col>
5454
</Row>
5555
</div>
@@ -59,6 +59,6 @@ const IsaacCodeSnippet = ({doc}: IsaacCodeProps) => {
5959
<a href={doc.url} onClick={logViewOnGitHub} target="_blank" rel="noopener noreferrer">View on GitHub</a>
6060
</Col>
6161
</Row>}
62-
</>
62+
</>;
6363
};
6464
export default IsaacCodeSnippet;

src/app/components/content/IsaacContentValueOrChildren.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ export const IsaacContentValueOrChildren = ({value, encoding, children}: Content
7070
</div>;
7171
}
7272
})}
73-
</React.Fragment>;
73+
</React.Fragment>;
7474
};

src/app/components/content/IsaacFeaturedProfile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export const IsaacFeaturedProfile = ({doc, contentIndex}: IsaacFeaturedProfilePr
3939
<img src='/assets/phy/icons/icon-mailto.png' alt=""/>
4040
<span className="visually-hidden">{"Email " + doc.title}</span>
4141
</a>}
42-
</div>
42+
</div>;
4343
};

src/app/components/content/IsaacGlossaryTerm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const IsaacGlossaryTermComponent = ({doc, inPortal, linkToGlossary}: IsaacGlossa
3333
{doc.explanation && <IsaacContent doc={doc.explanation} />}
3434
{/* {_tags && _tags.length > 0 && <p className="topics">Used in: {_tags.map(tag => tag.title).join(', ')}</p>} */}
3535
</Col>
36-
</>
36+
</>;
3737

3838
return (inPortal === true) ? termContents : <Row className="glossary_term" key={doc.id}>{termContents}</Row>;
3939
};

src/app/components/content/IsaacGraphSketcherQuestion.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ const IsaacGraphSketcherQuestion = ({doc, questionId, readonly}: IsaacQuestionPr
9292
</IsaacContentValueOrChildren>
9393
</div>
9494
<div className="sketch-preview d-flex justify-content-center overflow-auto" onClick={openModal} onKeyUp={openModal} role={readonly ? undefined : "button"}
95-
tabIndex={readonly ? undefined : 0}>
95+
tabIndex={readonly ? undefined : 0}
96+
>
9697
<div ref={previewRef} className={`${questionId}-graph-sketcher-preview`} />
9798
</div>
9899
{modalVisible && <GraphSketcherModal
@@ -107,4 +108,4 @@ const IsaacGraphSketcherQuestion = ({doc, questionId, readonly}: IsaacQuestionPr
107108
</div>
108109
</div>;
109110
};
110-
export default IsaacGraphSketcherQuestion;
111+
export default IsaacGraphSketcherQuestion;

src/app/components/content/IsaacHintModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ export const IsaacHintModal = (props: HintModalProps) => {
5555
<IsaacContent doc={body} />
5656
</ModalBody>
5757
</Modal>
58-
</div>
58+
</div>;
5959
};

src/app/components/content/IsaacHints.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export const IsaacLinkHints = ({hints, questionPartId}: HintsProps) => {
2929
{
3030
hints?.map((hint, index) =>
3131
<Col key={index} xs={{size: 3}} lg={{size: 2}}>
32-
<IsaacHintModal questionPartId={questionPartId} hintIndex={index}
33-
label={`Hint ${index + 1}`} title={hint.title || `Hint ${index + 1}`}
34-
body={hint} scrollable />
32+
<IsaacHintModal questionPartId={questionPartId} hintIndex={index}
33+
label={`Hint ${index + 1}`} title={hint.title || `Hint ${index + 1}`}
34+
body={hint} scrollable
35+
/>
3536
</Col>
3637
)
3738
}

src/app/components/content/IsaacInlineRegion.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,18 @@ export const useInlineRegionPart = (pageQuestions: AppQuestionDTO[] | undefined)
5353
...currentAttempts?.[currentFeedbackPart ?? 0]?.explanation,
5454
value: undefined,
5555
// if the response explanation exists (i.e. it has a value or children), use it; otherwise use the default feedback
56-
children: currentFeedbackPart !== undefined ? [
57-
(currentAttempts?.[currentFeedbackPart]?.explanation?.value || currentAttempts?.[currentFeedbackPart]?.explanation?.children?.length) &&
58-
currentAttempts?.[currentFeedbackPart]?.explanation !== undefined ? currentAttempts?.[currentFeedbackPart]?.explanation as ContentDTO : defaultFeedback(
59-
currentAttempts?.[currentFeedbackPart]?.correct ? "CORRECT" :
60-
currentAttempts?.[currentFeedbackPart]?.answer?.value !== undefined ? "INCORRECT" : "NOT_ANSWERED"
61-
)
62-
] : undefined,
56+
children: currentFeedbackPart !== undefined
57+
? [
58+
(currentAttempts?.[currentFeedbackPart]?.explanation?.value || currentAttempts?.[currentFeedbackPart]?.explanation?.children?.length) &&
59+
currentAttempts?.[currentFeedbackPart]?.explanation !== undefined
60+
? currentAttempts?.[currentFeedbackPart]?.explanation as ContentDTO
61+
: defaultFeedback(
62+
currentAttempts?.[currentFeedbackPart]?.correct
63+
? "CORRECT"
64+
: currentAttempts?.[currentFeedbackPart]?.answer?.value !== undefined ? "INCORRECT" : "NOT_ANSWERED"
65+
)
66+
]
67+
: undefined,
6368
};
6469
const lockedDates = inlineQuestions?.map(q => q.locked).filter(d => d) as Date[] | undefined;
6570
return {

src/app/components/content/IsaacInteractiveCodeSnippet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ export const IsaacInteractiveCodeSnippet = ({doc}: IsaacInteractiveCodeProps) =>
131131
}
132132
} scrolling="no" allowTransparency={true} frameBorder={0} allow={"clipboard-read; clipboard-write"}/>
133133
</>;
134-
}
134+
};

src/app/components/content/IsaacParsonsQuestion.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -315,27 +315,27 @@ const IsaacParsonsQuestion = ({doc, questionId, readonly} : IsaacQuestionProps<I
315315
{...provided.dragHandleProps}
316316
style={getStyle(provided.draggableProps.style, snapshot)}
317317
>
318-
<pre>
319-
{item.value}
320-
{canIndent && <div className="controls">
321-
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
322-
<span
323-
className={`reduce ${canDecreaseIndentation ? 'show' : 'hide' }`}
324-
role="img" onMouseUp={() => reduceIndentation(index)}
325-
aria-label={`reduce indentation ${!canDecreaseIndentation ? "(disabled)" : ""}`}
326-
>
318+
<pre>
319+
{item.value}
320+
{canIndent && <div className="controls">
321+
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
322+
<span
323+
className={`reduce ${canDecreaseIndentation ? 'show' : 'hide' }`}
324+
role="img" onMouseUp={() => reduceIndentation(index)}
325+
aria-label={`reduce indentation ${!canDecreaseIndentation ? "(disabled)" : ""}`}
326+
>
327327
&nbsp;
328-
</span>
329-
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
330-
<span
331-
className={`increase ${canIncreaseIndentation ? 'show' : 'hide' }`}
332-
role="img" onMouseUp={() => increaseIndentation(index)}
333-
aria-label={`increase indentation ${!canIncreaseIndentation ? "(disabled)" : ""}`}
334-
>
328+
</span>
329+
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
330+
<span
331+
className={`increase ${canIncreaseIndentation ? 'show' : 'hide' }`}
332+
role="img" onMouseUp={() => increaseIndentation(index)}
333+
aria-label={`increase indentation ${!canIncreaseIndentation ? "(disabled)" : ""}`}
334+
>
335335
&nbsp;
336-
</span>
337-
</div>}
338-
</pre>
336+
</span>
337+
</div>}
338+
</pre>
339339
</div>;
340340
}}
341341
</Draggable>;

0 commit comments

Comments
 (0)