Skip to content

Commit 82428e5

Browse files
committed
fix: lint issues
1 parent b065ec0 commit 82428e5

7 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ SettingsWidget.propTypes = {
195195
blockTitle: PropTypes.string.isRequired,
196196
correctAnswerCount: PropTypes.number.isRequired,
197197
problemType: PropTypes.string.isRequired,
198+
// eslint-disable-next-line react/forbid-prop-types
199+
editorRef: PropTypes.object.isRequired,
198200
setBlockTitle: PropTypes.func.isRequired,
199201
updateAnswer: PropTypes.func.isRequired,
200202
updateField: PropTypes.func.isRequired,

src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { editorRender, type PartialEditorState } from '@src/editors/editorTestRe
66
import { mockWaffleFlags } from '@src/data/apiHooks.mock';
77
import * as hooks from './hooks';
88
import { SettingsWidgetInternal as SettingsWidget } from '.';
9-
import { initialState } from '@src/course-outline/__mocks__/courseOutlineIndex';
109

1110
jest.mock('./settingsComponents/GeneralFeedback', () => 'GeneralFeedback');
1211
jest.mock('./settingsComponents/GroupFeedback', () => 'GroupFeedback');
@@ -30,7 +29,7 @@ describe('SettingsWidget', () => {
3029

3130
const props = {
3231
problemType: ProblemTypeKeys.TEXTINPUT,
33-
editorRef: { current: null},
32+
editorRef: { current: null },
3433
settings: {},
3534
defaultSettings: {
3635
maxAttempts: 2,

src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchEditorCard.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ const SwitchEditorCard = ({
5656
SwitchEditorCard.propTypes = {
5757
problemType: PropTypes.string.isRequired,
5858
editorType: PropTypes.string.isRequired,
59+
// eslint-disable-next-line react/forbid-prop-types
60+
editorRef: PropTypes.object.isRequired,
5961
};
6062

6163
export default SwitchEditorCard;

src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchEditorCard.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,4 @@ describe('SwitchEditorCard - markdown', () => {
5959
const reduxWrapper = (container.firstChild as HTMLElement | null);
6060
expect(reduxWrapper?.innerHTML).toBe('');
6161
});
62-
6362
});

src/editors/data/redux/thunkActions/problem.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('problem thunkActions', () => {
9090
expect(dispatch).toHaveBeenCalledWith(
9191
actions.problem.updateField({
9292
problemType: ProblemTypeKeys.ADVANCED,
93-
rawOLX: `<problem>\n<p>MockMarkdownContent</p>\n</problem>`,
93+
rawOLX: '<problem>\n<p>MockMarkdownContent</p>\n</problem>',
9494
isMarkdownEditorEnabled: false,
9595
}),
9696
);

src/editors/data/redux/thunkActions/problem.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { get, isEmpty } from 'lodash';
2+
import { camelizeKeys, convertMarkdownToXml } from '@src/editors/utils';
23
import { actions as problemActions } from '../problem';
34
import { actions as requestActions } from '../requests';
45
import { selectors as appSelectors } from '../app';
@@ -8,16 +9,13 @@ import { OLXParser } from '../../../containers/ProblemEditor/data/OLXParser';
89
import { parseSettings } from '../../../containers/ProblemEditor/data/SettingsParser';
910
import { ProblemTypeKeys } from '../../constants/problem';
1011
import ReactStateOLXParser from '../../../containers/ProblemEditor/data/ReactStateOLXParser';
11-
import { camelizeKeys } from '../../../utils';
1212
import { fetchEditorContent } from '../../../containers/ProblemEditor/components/EditProblemView/hooks';
1313
import { RequestKeys } from '../../constants/requests';
14-
import { convertMarkdownToXml } from '../../../utils';
1514

1615
// Similar to `import { actions, selectors } from '..';` but avoid circular imports:
1716
const actions = { problem: problemActions, requests: requestActions };
1817
const selectors = { app: appSelectors };
1918

20-
2119
export const switchToAdvancedEditor = (editorRef) => (dispatch, getState) => {
2220
const { problem } = getState();
2321
const editorObject = fetchEditorContent({ format: '' });
@@ -28,8 +26,7 @@ export const switchToAdvancedEditor = (editorRef) => (dispatch, getState) => {
2826
if (editorRef?.current?.state?.doc) {
2927
const markdownContent = editorRef.current.state.doc.toString();
3028
rawOLX = convertMarkdownToXml(markdownContent);
31-
}
32-
else{
29+
} else {
3330
// Fallback to previously saved olx
3431
rawOLX = problem.rawOLX;
3532
}

src/editors/sharedComponents/CodeEditor/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('CodeEditor', () => {
141141
expect(hooks.createCodeMirrorDomNode).toHaveBeenCalled();
142142
fireEvent.click(screen.getByRole('button', { name: 'Unescape HTML Literals' }));
143143
expect(mockEscapeHTMLSpecialChars).toHaveBeenCalled();
144-
// Prevent React.useRef mock leakage into subsequent tests
144+
// Prevent React.useRef mock leakage into subsequent tests
145145
useRefSpy.mockRestore();
146146
});
147147
});

0 commit comments

Comments
 (0)