Skip to content

Commit 84311ae

Browse files
committed
chore: fix lint issues
1 parent 2b0c3a4 commit 84311ae

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

src/library-authoring/import-course/stepper/ReviewImportDetails.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ReviewImportDetails = ({ courseId, markAnalysisComplete }: Props) =
128128
if (!blockTypes) {
129129
return undefined;
130130
}
131-
return Object.entries(blockTypes).filter(([blockType, ]) => (
131+
return Object.entries(blockTypes).filter(([blockType]) => (
132132
getConfig().LIBRARY_UNSUPPORTED_BLOCKS.includes(blockType)
133133
));
134134
}, [blockTypes]);
@@ -137,16 +137,14 @@ export const ReviewImportDetails = ({ courseId, markAnalysisComplete }: Props) =
137137
if (!unsupportedBlockTypes) {
138138
return 0;
139139
}
140-
const unsupportedBlocks = unsupportedBlockTypes.reduce((total, [, count]) => {
141-
return total + count;
142-
}, 0);
140+
const unsupportedBlocks = unsupportedBlockTypes.reduce((total, [, count]) => total + count, 0);
143141
return unsupportedBlocks;
144142
}, [unsupportedBlockTypes]);
145143

146144
const { data: unsupportedBlocksData } = useGetContentHits([
147145
`context_key = "${courseId}"`,
148146
`block_type IN [${unsupportedBlockTypes?.flatMap(([value]) => `"${value}"`).join(',')}]`,
149-
], totalUnsupportedBlocks > 0, totalUnsupportedBlocks, 'always')
147+
], totalUnsupportedBlocks > 0, totalUnsupportedBlocks, 'always');
150148

151149
const { data: unsupportedBlocksChildren } = useGetBlockTypes([
152150
`context_key = "${courseId}"`,
@@ -157,15 +155,14 @@ export const ReviewImportDetails = ({ courseId, markAnalysisComplete }: Props) =
157155
if (!unsupportedBlocksChildren) {
158156
return 0;
159157
}
160-
const unsupportedBlocks = Object.values(unsupportedBlocksChildren).reduce((total, count) => {
161-
return total + count;
162-
}, 0);
158+
const unsupportedBlocks = Object.values(unsupportedBlocksChildren).reduce((total, count) => total + count, 0);
163159
return unsupportedBlocks;
164160
}, [unsupportedBlocksChildren]);
165161

166-
const finalUnssupportedBlocks = useMemo(() => {
167-
return totalUnsupportedBlocks + totalUnsupportedBlockChildren;
168-
}, [totalUnsupportedBlocks, totalUnsupportedBlockChildren]);
162+
const finalUnssupportedBlocks = useMemo(
163+
() => totalUnsupportedBlocks + totalUnsupportedBlockChildren,
164+
[totalUnsupportedBlocks, totalUnsupportedBlockChildren],
165+
);
169166

170167
const totalBlocks = useMemo(() => {
171168
if (!blockTypes) {

src/search-manager/data/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export const fetchContentHits = async (
565565
// Convert 'extraFilter' into an array
566566
const extraFilterFormatted = forceArray(extraFilter);
567567

568-
const results = await client.index(indexName).search("", {
568+
const results = await client.index(indexName).search('', {
569569
filter: extraFilterFormatted,
570570
limit,
571571
});

src/search-manager/data/apiHooks.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
2-
import { keepPreviousData, skipToken, useInfiniteQuery, useQuery } from '@tanstack/react-query';
2+
import {
3+
keepPreviousData, skipToken, useInfiniteQuery, useQuery,
4+
} from '@tanstack/react-query';
35
import { type Filter, MeiliSearch } from 'meilisearch';
46

57
import {
@@ -299,12 +301,17 @@ export const useGetBlockTypes = (extraFilters: Filter, enabled: boolean = true)
299301
extraFilters,
300302
'block_types',
301303
],
302-
queryFn: enabled ? () => fetchBlockTypes(client!, indexName!, extraFilters): skipToken,
304+
queryFn: enabled ? () => fetchBlockTypes(client!, indexName!, extraFilters) : skipToken,
303305
refetchOnMount: 'always',
304306
});
305307
};
306308

307-
export const useGetContentHits = (extraFilters: Filter, enabled: boolean = true, limit?: number, refetchOnMount?: boolean | 'always') => {
309+
export const useGetContentHits = (
310+
extraFilters: Filter,
311+
enabled: boolean = true,
312+
limit?: number,
313+
refetchOnMount?: boolean | 'always',
314+
) => {
308315
const { client, indexName } = useContentSearchConnection();
309316
return useQuery({
310317
enabled: client !== undefined && indexName !== undefined,
@@ -315,7 +322,7 @@ export const useGetContentHits = (extraFilters: Filter, enabled: boolean = true,
315322
indexName,
316323
extraFilters,
317324
],
318-
queryFn: enabled ? () => fetchContentHits(client!, indexName!, extraFilters, limit): skipToken,
325+
queryFn: enabled ? () => fetchContentHits(client!, indexName!, extraFilters, limit) : skipToken,
319326
refetchOnMount,
320327
});
321328
};

0 commit comments

Comments
 (0)