Skip to content

Commit 4fc5edd

Browse files
committed
fix: lint issues
1 parent 48ce7fb commit 4fc5edd

5 files changed

Lines changed: 54 additions & 45 deletions

File tree

src/generic/key-utils.test.ts

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,16 @@ describe('component utils', () => {
169169
});
170170

171171
describe('isContainerType', () => {
172-
for (const containerType of [
173-
ContainerType.Vertical,
174-
ContainerType.Sequential,
175-
ContainerType.Chapter,
176-
ContainerType.Unit,
177-
ContainerType.Subsection,
178-
ContainerType.Section,
179-
] as const) {
172+
for (
173+
const containerType of [
174+
ContainerType.Vertical,
175+
ContainerType.Sequential,
176+
ContainerType.Chapter,
177+
ContainerType.Unit,
178+
ContainerType.Subsection,
179+
ContainerType.Section,
180+
] as const
181+
) {
180182
it(`returns true for '${containerType}'`, () => {
181183
expect(isContainerType(containerType)).toBe(true);
182184
});
@@ -190,30 +192,34 @@ describe('component utils', () => {
190192
});
191193

192194
describe('isContainerUsageKey', () => {
193-
for (const usageKey of [
194-
'lct:org:lib:section:my-section-9284e2',
195-
'lct:org:lib:subsection:my-subsection-9284e2',
196-
'lct:org:lib:unit:my-unit-9284e2',
197-
'block-v1:org+type@chapter+block@1',
198-
'block-v1:org+type@sequential+block@1',
199-
'block-v1:org+type@vertical+block@1',
200-
'block-v1:org+type@section+block@1',
201-
'block-v1:org+type@subsection+block@1',
202-
'block-v1:org+type@unit+block@1',
203-
]) {
195+
for (
196+
const usageKey of [
197+
'lct:org:lib:section:my-section-9284e2',
198+
'lct:org:lib:subsection:my-subsection-9284e2',
199+
'lct:org:lib:unit:my-unit-9284e2',
200+
'block-v1:org+type@chapter+block@1',
201+
'block-v1:org+type@sequential+block@1',
202+
'block-v1:org+type@vertical+block@1',
203+
'block-v1:org+type@section+block@1',
204+
'block-v1:org+type@subsection+block@1',
205+
'block-v1:org+type@unit+block@1',
206+
]
207+
) {
204208
it(`returns true for '${usageKey}'`, () => {
205209
expect(isContainerUsageKey(usageKey)).toBe(true);
206210
});
207211
}
208212

209-
for (const usageKey of [
210-
'lb:org:lib:html:id',
211-
'block-v1:org+type@problem+block@1',
212-
'not a key',
213-
'',
214-
undefined,
215-
null,
216-
]) {
213+
for (
214+
const usageKey of [
215+
'lb:org:lib:html:id',
216+
'block-v1:org+type@problem+block@1',
217+
'not a key',
218+
'',
219+
undefined,
220+
null,
221+
]
222+
) {
217223
it(`returns false for '${usageKey}'`, () => {
218224
expect(isContainerUsageKey(usageKey as any)).toBe(false);
219225
});

src/library-authoring/LibraryBlock/LibraryBlock.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ export const LibraryBlock = ({
5353
const intl = useIntl();
5454
const params = new URLSearchParams();
5555

56-
if (version === 0) {
57-
return null;
58-
}
59-
6056
if (version) {
6157
params.set('version', version.toString());
6258
}
@@ -86,6 +82,10 @@ export const LibraryBlock = ({
8682

8783
useIframeContent(iframeRef, setIframeRef);
8884

85+
if (version === 0) {
86+
return null;
87+
}
88+
8989
return (
9090
<iframe
9191
ref={iframeRef}

src/library-authoring/component-comparison/CompareChangesWidget.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,19 @@ const CompareChangesWidget = ({
104104

105105
return (
106106
<div className="bg-light-300 py-2 px-1">
107-
{sideBySide ? (
108-
<Stack direction='horizontal' gap={3}>
109-
{oldBlock}
110-
{newBlock}
111-
</Stack>
112-
) : (
113-
<Tabs variant="tabs" defaultActiveKey="new" id="preview-version-toggle" mountOnEnter>
114-
{oldBlock && <Tab eventKey="old" title={oldTabMessage}>{oldBlock}</Tab>}
115-
<Tab eventKey="new" title={newTabMessage}>{newBlock}</Tab>
116-
</Tabs>
117-
)}
107+
{sideBySide ?
108+
(
109+
<Stack direction="horizontal" gap={3}>
110+
{oldBlock}
111+
{newBlock}
112+
</Stack>
113+
) :
114+
(
115+
<Tabs variant="tabs" defaultActiveKey="new" id="preview-version-toggle" mountOnEnter>
116+
{oldBlock && <Tab eventKey="old" title={oldTabMessage}>{oldBlock}</Tab>}
117+
<Tab eventKey="new" title={newTabMessage}>{newBlock}</Tab>
118+
</Tabs>
119+
)}
118120
</div>
119121
);
120122
};

src/library-authoring/generic/history-log/HistoryCompareChangesModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ const HistoryCompareChangesModal = ({
4343
isOpen={isOpen}
4444
onClose={onClose}
4545
size="xl"
46-
className={classNames({'w-xl-100 mw-xl': sideBySide})}
46+
className={classNames({ 'w-xl-100 mw-xl': sideBySide })}
4747
title={title}
4848
isOverflowVisible={false}
4949
>
5050
<ModalDialog.Header>
5151
<ModalDialog.Title>
52-
<Stack direction='horizontal' gap={2}>
52+
<Stack direction="horizontal" gap={2}>
5353
<FormattedMessage
5454
{...messages.previewChangesTitle}
5555
values={{
5656
title: (
5757
<>
58-
<Icon size='lg' src={getItemIcon(blockType)} className="mr-1" />
58+
<Icon size="lg" src={getItemIcon(blockType)} className="mr-1" />
5959
{oldTitle}
6060
</>
6161
),

src/library-authoring/generic/history-log/HistoryLog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export const HistoryContainerLog = ({ containerId }: { containerId: string; }) =
151151
<div className="history-log">
152152
{draftHistory && draftHistory.length !== 0 && (
153153
<HistoryDraftLogGroup
154+
itemId={containerId}
154155
displayName={container?.displayName ?? ''}
155156
entries={draftHistory}
156157
/>

0 commit comments

Comments
 (0)