Skip to content

Commit 6effb4d

Browse files
chore: fix various lint/type issues found by oxlint (#2850)
1 parent b0066e5 commit 6effb4d

36 files changed

Lines changed: 120 additions & 78 deletions

File tree

plugins/course-apps/live/Settings.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// oxlint-disable unicorn/no-thenable
12
import React, { useEffect } from 'react';
23
import { useDispatch, useSelector } from 'react-redux';
34
import { camelCase } from 'lodash';

plugins/course-apps/proctoring/Settings.test.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ const renderComponent = children => (
2828
let axiosMock;
2929

3030
describe('ProctoredExamSettings', () => {
31+
/**
32+
* @param {boolean} isAdmin
33+
* @param {string | undefined} org
34+
*/
3135
function setupApp(isAdmin = true, org = undefined) {
3236
mergeConfig({
3337
EXAMS_BASE_URL: 'http://exams.testing.co',

plugins/course-apps/teams/Settings.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ const TeamSettings = ({
107107
)
108108
.when('enabled', {
109109
is: true,
110+
// oxlint-disable-next-line unicorn/no-thenable
110111
then: Yup.array().min(1),
111112
})
112113
.default([])

src/advanced-settings/data/thunks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function fetchCourseAppSettings(courseId) {
2525
sortedDisplayName.push(displayName);
2626
});
2727
const sortedSettingValues = {};
28-
sortedDisplayName.sort().forEach((displayName => {
28+
sortedDisplayName.sort((a, b) => a.localeCompare(b)).forEach((displayName => {
2929
Object.entries(settingValues).forEach(([key, value]) => {
3030
if (value.displayName === displayName) {
3131
sortedSettingValues[key] = value;

src/certificates/certificate-section/CertificateSection.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const CertificateSection = ({
77
<section {...rest}>
88
<Stack className="justify-content-between mb-2.5" direction="horizontal">
99
<h2 className="lead section-title mb-0">{title}</h2>
10-
{actions && actions}
10+
{actions}
1111
</Stack>
1212
<hr className="mt-0 mb-4" />
1313
<div>

src/container-comparison/ContainerRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
import { FormattedMessage } from '@edx/frontend-platform/i18n';
1010
import { getItemIcon } from '@src/generic/block-type-utils';
1111
import { ContainerType } from '@src/generic/key-utils';
12-
import { COMPONENT_TYPES } from '@src/generic/block-type-utils/constants';
1312
import messages from './messages';
1413
import { ContainerState } from './types';
1514
import { isRowClickable } from './utils';
1615

1716
export interface ContainerRowProps {
1817
title: string;
19-
containerType: ContainerType | keyof typeof COMPONENT_TYPES | string;
18+
/** containerType: can be one of `ContainerType` | `COMPONENT_TYPES` or any other string (3rd party XBlocks) */
19+
containerType: ContainerType | string;
2020
state?: ContainerState;
2121
side: 'Before' | 'After';
2222
originalName?: string;

src/container-comparison/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export function diffPreviewContainerChildren<A extends CourseContainerChildBase,
128128

129129
// Use new mapB for getting new index for added elements
130130
addedA.forEach((addedRow) => {
131+
// oxlint-disable-next-line typescript/no-non-null-asserted-optional-chain FIXME: clean this up.
131132
updatedA.splice(mapB.get(addedRow.id)?.index!, 0, { ...addedRow, state: 'added' });
132133
});
133134

src/content-tags-drawer/TagsTree.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,17 @@ const TagComponent = ({
7575
};
7676

7777
interface TagsTreeProps {
78+
/** Array of taxonomy tags that are applied to the content. */
7879
tags: TagTree;
80+
/** Key of the parent tag. */
7981
parentKey?: string;
82+
/** Depth of the parent tag (root), used to render tabs for the tree. */
8083
rootDepth?: number;
84+
/** Lineage of the tag. */
8185
lineage?: string[];
86+
/** Function that is called when removing tags from the tree. */
8287
removeTagHandler?: (value: string) => void;
88+
/** Optional component to render after the tags components. */
8389
afterTagsComponent?: React.ReactNode;
8490
}
8591

@@ -121,17 +127,12 @@ interface TagsTreeProps {
121127
*
122128
*/
123129
const TagsTree = ({
124-
/** Array of taxonomy tags that are applied to the content. */
125130
tags,
126-
/** Depth of the parent tag (root), used to render tabs for the tree. */
127131
rootDepth = 0,
128-
/** Key of the parent tag. */
129132
parentKey,
130-
/** Lineage of the tag. */
131133
lineage = [],
132-
/** Function that is called when removing tags from the tree. */
133134
removeTagHandler,
134-
/** Optional component to render after the tags components. */
135+
// oxlint-disable-next-line oxc/only-used-in-recursion
135136
afterTagsComponent,
136137
}: TagsTreeProps) => {
137138
const { isEditMode } = useContext(ContentTagsDrawerContext);

src/course-outline/data/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ export interface CourseStructure {
1010
hasChanges: boolean,
1111
}
1212

13-
// TODO: Create interface for all `Object` fields in courseOutline
1413
export interface CourseOutline {
1514
courseReleaseDate: string;
1615
courseStructure: CourseStructure;
17-
deprecatedBlocksInfo: Object;
16+
deprecatedBlocksInfo: Record<string, any>; // TODO: Create interface for this type
1817
discussionsIncontextLearnmoreUrl: string;
19-
initialState: Object;
20-
initialUserClipboard: Object;
18+
initialState: Record<string, any>; // TODO: Create interface for this type
19+
initialUserClipboard: Record<string, any>; // TODO: Create interface for this type
2120
languageCode: string;
2221
lmsLink: string;
2322
mfeProctoredExamSettingsUrl: string;

src/course-outline/outline-sidebar/AddSidebar.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ const searchResult = {
7070
results: [
7171
{
7272
...mockResult.results[0],
73-
hits: [
74-
...mockResult.results[0].hits.slice(16, 19),
75-
],
73+
hits: mockResult.results[0].hits.slice(16, 19),
7674
},
7775
{
7876
...mockResult.results[1],

0 commit comments

Comments
 (0)