diff --git a/.prettierrc b/.prettierrc
index ec99dd2ec..6d885b9ce 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,11 +1,12 @@
{
+ "plugins": ["@trivago/prettier-plugin-sort-imports"],
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"printWidth": 120,
"bracketSameLine": true,
"jsxSingleQuote": true,
+ "endOfLine": "auto",
"importOrder": ["^(\\.)+(\\/)+"],
- "importOrderSeparation": true,
- "endOfLine": "auto"
+ "importOrderSeparation": true
}
diff --git a/package.json b/package.json
index cd3780c8c..d95962fd8 100644
--- a/package.json
+++ b/package.json
@@ -102,7 +102,7 @@
"jest-transform-stub": "^2.0.0",
"metro-react-native-babel-preset": "^0.77.0",
"patch-package": "^8.0.0",
- "prettier": "^2.7.1",
+ "prettier": "^3.2.5",
"react-dom": "18.2.0",
"react-test-renderer": "18.2.0",
"ts-jest": "^29.1.2",
diff --git a/src/components/ImageCarousel.tsx b/src/components/ImageCarousel.tsx
index 935d99e18..ee93cc72f 100644
--- a/src/components/ImageCarousel.tsx
+++ b/src/components/ImageCarousel.tsx
@@ -80,7 +80,7 @@ const ImageCarousel = ({ images, minimized = false }: ImageCarouselProps): React
!!currentIndex &&
allSize > 1 &&
imagesUrls.map((item, index) =>
- index + 1 === currentIndex ? :
+ index + 1 === currentIndex ? : ,
)}
)
diff --git a/src/components/ListItem.tsx b/src/components/ListItem.tsx
index 97795865f..0b849f907 100644
--- a/src/components/ListItem.tsx
+++ b/src/components/ListItem.tsx
@@ -159,7 +159,7 @@ const ListItem = ({
}
setPressInY(null)
},
- [pressInY, updatePressed, onPress]
+ [pressInY, updatePressed, onPress],
)
const titleToRender =
diff --git a/src/components/__tests__/CameraOverlay.spec.tsx b/src/components/__tests__/CameraOverlay.spec.tsx
index 47defd67b..f2f2585b3 100644
--- a/src/components/__tests__/CameraOverlay.spec.tsx
+++ b/src/components/__tests__/CameraOverlay.spec.tsx
@@ -14,7 +14,7 @@ describe('CameraOverlay', () => {
const { getByTestId, queryByTestId, findByTestId } = render(
Children
-
+ ,
)
const closeIcon = await findByTestId('close-circle-icon-white')
expect(closeIcon).toBeDefined()
@@ -27,7 +27,7 @@ describe('CameraOverlay', () => {
const { findByTestId } = render(
Children
-
+ ,
)
const closeIcon = await findByTestId('close-circle-icon-white')
expect(closeIcon).toBeDefined()
diff --git a/src/components/__tests__/CustomTextInput.spec.tsx b/src/components/__tests__/CustomTextInput.spec.tsx
index 1cca7ef77..9ad827b39 100644
--- a/src/components/__tests__/CustomTextInput.spec.tsx
+++ b/src/components/__tests__/CustomTextInput.spec.tsx
@@ -8,21 +8,21 @@ describe('CustomTextInput', () => {
it('should show placeholder text', () => {
const { getByPlaceholderText } = render(
-
+ ,
)
expect(getByPlaceholderText('Test')).toBeTruthy()
})
it('should not show clear indicator with empty input', () => {
const { queryByTestId } = render(
-
+ ,
)
expect(queryByTestId('clearInput')).toBeNull()
})
it('should show indicator when input was set', () => {
const { getByTestId } = render(
-
+ ,
)
expect(getByTestId('clearInput')).toBeTruthy()
})
diff --git a/src/components/__tests__/ExerciseHeader.spec.tsx b/src/components/__tests__/ExerciseHeader.spec.tsx
index 5887328de..4d811b92e 100644
--- a/src/components/__tests__/ExerciseHeader.spec.tsx
+++ b/src/components/__tests__/ExerciseHeader.spec.tsx
@@ -29,7 +29,7 @@ describe('ExerciseHeader', () => {
feedbackType={FeedbackType.vocabularyItem}
feedbackForId={1}
exerciseKey={ExerciseKeys.vocabularyList}
- />
+ />,
)
expect(getByTestId('customModal')).toBeTruthy()
expect(getByTestId('customModal').props.visible).toBe(false)
diff --git a/src/components/__tests__/FavoriteButton.spec.tsx b/src/components/__tests__/FavoriteButton.spec.tsx
index 5817a8d40..600582c43 100644
--- a/src/components/__tests__/FavoriteButton.spec.tsx
+++ b/src/components/__tests__/FavoriteButton.spec.tsx
@@ -16,7 +16,7 @@ describe('FavoriteButton', () => {
render(
-
+ ,
)
it('should add favorite on click', async () => {
diff --git a/src/components/__tests__/FeedbackModal.spec.tsx b/src/components/__tests__/FeedbackModal.spec.tsx
index e1d892578..606ed2f16 100644
--- a/src/components/__tests__/FeedbackModal.spec.tsx
+++ b/src/components/__tests__/FeedbackModal.spec.tsx
@@ -16,7 +16,7 @@ describe('FeedbackModal', () => {
it('should have a disabled send button when message is empty', () => {
const { getByText, getByPlaceholderText } = render(
-
+ ,
)
expect(getByText(getLabels().feedback.sendFeedback)).toBeDisabled()
const feedbackInputField = getByPlaceholderText(getLabels().feedback.feedbackPlaceholder)
@@ -26,7 +26,7 @@ describe('FeedbackModal', () => {
it('should get a cleared feedback text when clear button was clicked', () => {
const { getByPlaceholderText, getByTestId } = render(
-
+ ,
)
const feedbackInputField = getByPlaceholderText(getLabels().feedback.feedbackPlaceholder)
fireEvent.changeText(feedbackInputField, 'Mein Feedback')
@@ -36,7 +36,7 @@ describe('FeedbackModal', () => {
it('should send feedback', () => {
const { getByText, getByPlaceholderText } = render(
-
+ ,
)
const feedbackInputField = getByPlaceholderText(getLabels().feedback.feedbackPlaceholder)
const emailInputField = getByPlaceholderText(getLabels().feedback.mailPlaceholder)
diff --git a/src/components/__tests__/ListItem.spec.tsx b/src/components/__tests__/ListItem.spec.tsx
index cb8504d9f..1021a81e7 100644
--- a/src/components/__tests__/ListItem.spec.tsx
+++ b/src/components/__tests__/ListItem.spec.tsx
@@ -23,7 +23,7 @@ describe('ListItem', () => {
badgeLabel={badge}
arrowDisabled={arrowDisabled}
disabled={disabled}
- />
+ />,
)
it('should render texts', () => {
diff --git a/src/components/__tests__/Loading.spec.tsx b/src/components/__tests__/Loading.spec.tsx
index 020e658ad..a5590f6d9 100644
--- a/src/components/__tests__/Loading.spec.tsx
+++ b/src/components/__tests__/Loading.spec.tsx
@@ -12,7 +12,7 @@ describe('Loading', () => {
render(
{childText}
-
+ ,
)
it('should not render children when isLoading is true', () => {
diff --git a/src/components/__tests__/NotAuthorisedView.spec.tsx b/src/components/__tests__/NotAuthorisedView.spec.tsx
index e9b82e6a5..6e736a2fa 100644
--- a/src/components/__tests__/NotAuthorisedView.spec.tsx
+++ b/src/components/__tests__/NotAuthorisedView.spec.tsx
@@ -16,7 +16,10 @@ describe('NotAuthorisedView', () => {
it('should render description', () => {
const { getByText } = render(
-
+ ,
)
const isNoAuthDescription = getByText(getLabels().general.camera.noAuthorization.description)
expect(isNoAuthDescription).toBeTruthy()
@@ -24,7 +27,10 @@ describe('NotAuthorisedView', () => {
it('should successfully go back', () => {
const { getByText } = render(
-
+ ,
)
const buttonVisible = getByText(getLabels().general.back)
fireEvent.press(buttonVisible)
@@ -34,7 +40,10 @@ describe('NotAuthorisedView', () => {
it('should open settings successfully', () => {
mocked(Linking.openSettings).mockImplementationOnce(Promise.resolve)
const { getByText } = render(
-
+ ,
)
const message = getByText(getLabels().settings.settings)
fireEvent.press(message)
diff --git a/src/components/__tests__/RouteWrapper.spec.tsx b/src/components/__tests__/RouteWrapper.spec.tsx
index 4db024c4f..e31065be4 100644
--- a/src/components/__tests__/RouteWrapper.spec.tsx
+++ b/src/components/__tests__/RouteWrapper.spec.tsx
@@ -14,7 +14,7 @@ describe('RouteWrapper', () => {
const { queryByTestId } = render(
-
+ ,
)
expect(queryByTestId('hiddenContainer')).toBeDefined()
Platform.OS = platform
@@ -26,7 +26,7 @@ describe('RouteWrapper', () => {
const { queryByTestId } = render(
-
+ ,
)
expect(queryByTestId('hiddenContainer')).toBeNull()
Platform.OS = platform
diff --git a/src/components/__tests__/ServerResponseHandler.spec.tsx b/src/components/__tests__/ServerResponseHandler.spec.tsx
index 62596e43b..edc763b9e 100644
--- a/src/components/__tests__/ServerResponseHandler.spec.tsx
+++ b/src/components/__tests__/ServerResponseHandler.spec.tsx
@@ -14,7 +14,7 @@ describe('ServerResponseHandler', () => {
const { getByText } = render(
TestContent
-
+ ,
)
expect(getByText(error.message)).toBeTruthy()
@@ -26,7 +26,7 @@ describe('ServerResponseHandler', () => {
const { getByTestId } = render(
TestContent
-
+ ,
)
expect(getByTestId('loading')).toBeTruthy()
@@ -36,7 +36,7 @@ describe('ServerResponseHandler', () => {
const { getByText } = render(
TestContent
-
+ ,
)
expect(getByText('TestContent')).toBeTruthy()
diff --git a/src/components/__tests__/VocabularyList.spec.tsx b/src/components/__tests__/VocabularyList.spec.tsx
index ac1e42f02..d05edc1bb 100644
--- a/src/components/__tests__/VocabularyList.spec.tsx
+++ b/src/components/__tests__/VocabularyList.spec.tsx
@@ -28,7 +28,7 @@ describe('VocabularyList', () => {
mockUseLoadAsyncWithData(vocabularyItems)
const { getByText, getAllByText, getAllByTestId } = render(
-
+ ,
)
expect(getByText('Title')).toBeTruthy()
@@ -43,7 +43,7 @@ describe('VocabularyList', () => {
it('should call onItemPress with correct index', () => {
const { getByText } = render(
-
+ ,
)
expect(onItemPress).toHaveBeenCalledTimes(0)
diff --git a/src/constants/theme/colors.ts b/src/constants/theme/colors.ts
index f308e38c3..bdba3d00d 100644
--- a/src/constants/theme/colors.ts
+++ b/src/constants/theme/colors.ts
@@ -30,4 +30,4 @@ export const COLORS = {
chartColor4: '#D9D9D9',
}
-export type Color = typeof COLORS[keyof typeof COLORS]
+export type Color = (typeof COLORS)[keyof typeof COLORS]
diff --git a/src/hooks/helpers.ts b/src/hooks/helpers.ts
index 84b283809..39a2c627a 100644
--- a/src/hooks/helpers.ts
+++ b/src/hooks/helpers.ts
@@ -22,7 +22,7 @@ export type ServerResponseDiscipline = {
export const formatDiscipline = (
item: ServerResponseDiscipline,
- loadingInfo: DisciplinesRequestParams
+ loadingInfo: DisciplinesRequestParams,
): Discipline => ({
...item,
numberOfChildren: item.total_discipline_children || item.total_training_sets || item.total_documents,
diff --git a/src/hooks/useLoadAsync.ts b/src/hooks/useLoadAsync.ts
index a401c67ac..815a68609 100644
--- a/src/hooks/useLoadAsync.ts
+++ b/src/hooks/useLoadAsync.ts
@@ -5,7 +5,7 @@ export const loadAsync = async (
params: P,
setData: (data: T | null) => void,
setError: (error: Error | null) => void,
- setLoading: (loading: boolean) => void
+ setLoading: (loading: boolean) => void,
): Promise => {
setLoading(true)
diff --git a/src/hooks/useLoadVocabularyItems.ts b/src/hooks/useLoadVocabularyItems.ts
index 4291b78c0..b4f900581 100644
--- a/src/hooks/useLoadVocabularyItems.ts
+++ b/src/hooks/useLoadVocabularyItems.ts
@@ -19,7 +19,7 @@ export type VocabularyItemFromServer = {
export const formatVocabularyItemFromServer = (
vocabularyItemFromServer: VocabularyItemFromServer,
- apiKey?: string
+ apiKey?: string,
): VocabularyItem => ({
id: vocabularyItemFromServer.id,
word: vocabularyItemFromServer.word,
@@ -36,7 +36,7 @@ export const formatVocabularyItemFromServer = (
export const formatVocabularyItemsFromServer = (
vocabularyItemFromServers: VocabularyItemFromServer[],
- apiKey?: string
+ apiKey?: string,
): VocabularyItem[] => vocabularyItemFromServers.map(item => formatVocabularyItemFromServer(item, apiKey))
export const loadVocabularyItems = async ({
diff --git a/src/navigation/BottomTabNavigator.tsx b/src/navigation/BottomTabNavigator.tsx
index 2d26ac8eb..2851e4b39 100644
--- a/src/navigation/BottomTabNavigator.tsx
+++ b/src/navigation/BottomTabNavigator.tsx
@@ -41,7 +41,7 @@ const BottomTabNavigator = (): JSX.Element | null => {
const { data: isDevMode } = useLoadAsync(getDevMode, null)
const { data: numberOfWordsNeedingRepetition, refresh: refreshRepetitionBadge } = useLoadAsync(
RepetitionService.getNumberOfWordsNeedingRepetitionWithUpperBound,
- undefined
+ undefined,
)
useFocusEffect(refreshRepetitionBadge)
diff --git a/src/routes/__tests__/OverlayMenuScreen.spec.tsx b/src/routes/__tests__/OverlayMenuScreen.spec.tsx
index 4369fd543..8ab8b3a77 100644
--- a/src/routes/__tests__/OverlayMenuScreen.spec.tsx
+++ b/src/routes/__tests__/OverlayMenuScreen.spec.tsx
@@ -14,7 +14,7 @@ describe('OverlayMenu', () => {
const { getByTestId } = renderWithTheme(
-
+ ,
)
const close = getByTestId('close-icon-white')
expect(close).toBeTruthy()
@@ -31,7 +31,7 @@ describe('OverlayMenu', () => {
const { getByText } = renderWithTheme(
-
+ ,
)
const item = getByText(menuItem)
diff --git a/src/routes/__tests__/ProfessionSelectionScreen.spec.tsx b/src/routes/__tests__/ProfessionSelectionScreen.spec.tsx
index 998a2e52a..c8327567e 100644
--- a/src/routes/__tests__/ProfessionSelectionScreen.spec.tsx
+++ b/src/routes/__tests__/ProfessionSelectionScreen.spec.tsx
@@ -36,7 +36,7 @@ describe('ProfessionSelectionScreen', () => {
mocked(useReadSelectedProfessions).mockReturnValueOnce(getReturnOf(null))
const { findByText, queryAllByTestId } = render(
-
+ ,
)
expect(await findByText(getLabels().scopeSelection.skipSelection)).toBeDefined()
const profession = await findByText(mockDisciplines()[0].title)
@@ -56,7 +56,7 @@ describe('ProfessionSelectionScreen', () => {
mocked(useReadSelectedProfessions).mockReturnValueOnce(getReturnOf([mockDisciplines()[0].id]))
const { findByText, queryAllByTestId } = render(
-
+ ,
)
expect(await findByText(getLabels().scopeSelection.confirmSelection)).toBeDefined()
const profession = await findByText(mockDisciplines()[0].title)
diff --git a/src/routes/__tests__/VocabularyListScreen.spec.tsx b/src/routes/__tests__/VocabularyListScreen.spec.tsx
index 3637563eb..4fc621468 100644
--- a/src/routes/__tests__/VocabularyListScreen.spec.tsx
+++ b/src/routes/__tests__/VocabularyListScreen.spec.tsx
@@ -51,7 +51,7 @@ describe('VocabularyListScreen', () => {
mockUseLoadAsyncWithData(vocabularyItems)
const { getByText, getAllByText, getAllByTestId } = render(
-
+ ,
)
expect(getByText(getLabels().exercises.vocabularyList.title)).toBeTruthy()
diff --git a/src/routes/add-custom-discipline/AddCustomDisciplineScreen.tsx b/src/routes/add-custom-discipline/AddCustomDisciplineScreen.tsx
index f437c3167..09dbc91b6 100644
--- a/src/routes/add-custom-discipline/AddCustomDisciplineScreen.tsx
+++ b/src/routes/add-custom-discipline/AddCustomDisciplineScreen.tsx
@@ -74,7 +74,7 @@ const AddCustomDiscipline = ({ navigation }: AddCustomDisciplineScreenProps): JS
setErrorMessage(
error.response?.status === HTTP_STATUS_CODE_FORBIDDEN
? getLabels().addCustomDiscipline.error.wrongCode
- : getLabels().addCustomDiscipline.error.technical
+ : getLabels().addCustomDiscipline.error.technical,
)
})
.finally(() => setLoading(false))
diff --git a/src/routes/add-custom-discipline/__tests__/AddCustomDisciplineScreen.spec.tsx b/src/routes/add-custom-discipline/__tests__/AddCustomDisciplineScreen.spec.tsx
index d32af9c6d..005ae6599 100644
--- a/src/routes/add-custom-discipline/__tests__/AddCustomDisciplineScreen.spec.tsx
+++ b/src/routes/add-custom-discipline/__tests__/AddCustomDisciplineScreen.spec.tsx
@@ -45,7 +45,7 @@ describe('AddCustomDisciplineScreen', () => {
const submitButton = await findByText(getLabels().addCustomDiscipline.submitLabel)
fireEvent.press(submitButton)
await waitFor(() =>
- expect(RNAsyncStorage.setItem).toHaveBeenCalledWith('customDisciplines', '["test","another_test_discipline"]')
+ expect(RNAsyncStorage.setItem).toHaveBeenCalledWith('customDisciplines', '["test","another_test_discipline"]'),
)
await waitFor(() => expect(navigation.goBack).toHaveBeenCalled())
})
@@ -63,7 +63,7 @@ describe('AddCustomDisciplineScreen', () => {
it('should show wrong-code-error', async () => {
const { findByText, getByText, findByPlaceholderText } = render(
-
+ ,
)
mocked(loadDiscipline).mockRejectedValueOnce({ response: { status: 403 } })
const textField = await findByPlaceholderText(getLabels().addCustomDiscipline.placeholder)
diff --git a/src/routes/choice-exercises/ArticleChoiceExerciseScreen.tsx b/src/routes/choice-exercises/ArticleChoiceExerciseScreen.tsx
index a51f13988..cf114db61 100644
--- a/src/routes/choice-exercises/ArticleChoiceExerciseScreen.tsx
+++ b/src/routes/choice-exercises/ArticleChoiceExerciseScreen.tsx
@@ -21,7 +21,7 @@ const ArticleChoiceExerciseScreen = ({ navigation, route }: ArticleChoiceExercis
const answerOptions = ARTICLES.filter(it => it.id !== 0 && it.id !== 4)
const singularVocabularyItems = vocabularyItems.filter(it =>
- answerOptions.some(answerOption => JSON.stringify(it.article) === JSON.stringify(answerOption))
+ answerOptions.some(answerOption => JSON.stringify(it.article) === JSON.stringify(answerOption)),
)
const vocabularyItemToAnswers = (vocabularyItem: VocabularyItem): Answer[] =>
diff --git a/src/routes/choice-exercises/__tests__/ArticleChoiceExerciseScreen.spec.tsx b/src/routes/choice-exercises/__tests__/ArticleChoiceExerciseScreen.spec.tsx
index a3ddb2eb9..46eb94ee4 100644
--- a/src/routes/choice-exercises/__tests__/ArticleChoiceExerciseScreen.spec.tsx
+++ b/src/routes/choice-exercises/__tests__/ArticleChoiceExerciseScreen.spec.tsx
@@ -74,7 +74,7 @@ describe('ArticleChoiceExerciseScreen', () => {
it('should not allow to skip last vocabularyItem', () => {
const { queryByText, getByText, getAllByText } = render(
-
+ ,
)
expect(getAllByText(/Spachtel/)).toHaveLength(3)
diff --git a/src/routes/choice-exercises/components/SingleChoiceExercise.tsx b/src/routes/choice-exercises/components/SingleChoiceExercise.tsx
index c78d67991..d2f46dfa1 100644
--- a/src/routes/choice-exercises/components/SingleChoiceExercise.tsx
+++ b/src/routes/choice-exercises/components/SingleChoiceExercise.tsx
@@ -54,7 +54,7 @@ const ChoiceExerciseScreen = ({
const [currentWord, setCurrentWord] = useState(0)
const [selectedAnswer, setSelectedAnswer] = useState(null)
const [results, setResults] = useState(
- shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 })))
+ shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 }))),
)
const { vocabularyItem, numberOfTries, result } = results[currentWord]
const [answers, setAnswers] = useState(vocabularyItemToAnswer(vocabularyItem))
@@ -70,11 +70,11 @@ const ChoiceExerciseScreen = ({
if (vocabularyItems.length !== results.length || force) {
setCurrentWord(0)
setResults(
- shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 })))
+ shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 }))),
)
}
},
- [vocabularyItems, results]
+ [vocabularyItems, results],
)
useEffect(initializeExercise, [initializeExercise])
@@ -100,7 +100,7 @@ const ChoiceExerciseScreen = ({
const onExerciseCheated = async (result: SimpleResult): Promise => {
await onExerciseFinished(
- results.map(it => ({ ...it, numberOfTries: result === SIMPLE_RESULTS.correct ? 1 : numberOfMaxRetries, result }))
+ results.map(it => ({ ...it, numberOfTries: result === SIMPLE_RESULTS.correct ? 1 : numberOfMaxRetries, result })),
)
}
diff --git a/src/routes/exercise-finished/__tests__/ExerciseFinishedScreen.spec.tsx b/src/routes/exercise-finished/__tests__/ExerciseFinishedScreen.spec.tsx
index e0009a321..e203cd7f4 100644
--- a/src/routes/exercise-finished/__tests__/ExerciseFinishedScreen.spec.tsx
+++ b/src/routes/exercise-finished/__tests__/ExerciseFinishedScreen.spec.tsx
@@ -17,7 +17,7 @@ describe('ExerciseFinishedScreen', () => {
const getRoute = (
exerciseKey: ExerciseKey,
correct: boolean,
- unlockedNextExercise: boolean
+ unlockedNextExercise: boolean,
): RouteProp => ({
key: '',
name: 'ExerciseFinished',
@@ -64,11 +64,11 @@ describe('ExerciseFinishedScreen', () => {
const { getByText } = render()
expect(
getByText(
- `${getLabels().results.unlockExercise.part1}, ${EXERCISES[2].title} ${getLabels().results.unlockExercise.part2}`
- )
+ `${getLabels().results.unlockExercise.part1}, ${EXERCISES[2].title} ${getLabels().results.unlockExercise.part2}`,
+ ),
).toBeDefined()
expect(
- getByText(`4 ${getLabels().results.of} 4 ${getLabels().general.words} ${getLabels().results.correct}`)
+ getByText(`4 ${getLabels().results.of} 4 ${getLabels().general.words} ${getLabels().results.correct}`),
).toBeDefined()
const button = getByText(getLabels().results.action.nextExercise)
fireEvent.press(button)
diff --git a/src/routes/exercises/StandardExercisesScreen.tsx b/src/routes/exercises/StandardExercisesScreen.tsx
index 62086ce4b..16b187ebf 100644
--- a/src/routes/exercises/StandardExercisesScreen.tsx
+++ b/src/routes/exercises/StandardExercisesScreen.tsx
@@ -78,7 +78,7 @@ const StandardExercisesScreen = ({ route, navigation }: ExercisesScreenProps): J
getNumberOfUnlockedExercises(disciplineId)
.then(value => setNextExercise(value < EXERCISES.length ? EXERCISES[value] : null))
.catch(reportError)
- }, [disciplineId])
+ }, [disciplineId]),
)
useEffect(() => {
diff --git a/src/routes/home/components/__tests__/Card.spec.tsx b/src/routes/home/components/__tests__/Card.spec.tsx
index e211e4192..2f4ee0fe3 100644
--- a/src/routes/home/components/__tests__/Card.spec.tsx
+++ b/src/routes/home/components/__tests__/Card.spec.tsx
@@ -11,7 +11,7 @@ describe('Card', () => {
const { getByText } = render(
children-text
-
+ ,
)
const heading = getByText('heading')
expect(heading).toBeDefined()
diff --git a/src/routes/home/components/__tests__/CustomDisciplineDetails.spec.tsx b/src/routes/home/components/__tests__/CustomDisciplineDetails.spec.tsx
index 0f1a3e11f..2e4e306d8 100644
--- a/src/routes/home/components/__tests__/CustomDisciplineDetails.spec.tsx
+++ b/src/routes/home/components/__tests__/CustomDisciplineDetails.spec.tsx
@@ -12,7 +12,7 @@ describe('CustomDisciplineDetails', () => {
it('should handle button click', () => {
const discipline = mockDisciplines(false)[0]
const { getByText } = render(
-
+ ,
)
const button = getByText(getLabels().home.start)
fireEvent.press(button)
diff --git a/src/routes/home/components/__tests__/HomeScreenHeader.spec.tsx b/src/routes/home/components/__tests__/HomeScreenHeader.spec.tsx
index 85800a693..b656571f0 100644
--- a/src/routes/home/components/__tests__/HomeScreenHeader.spec.tsx
+++ b/src/routes/home/components/__tests__/HomeScreenHeader.spec.tsx
@@ -13,7 +13,7 @@ describe('HomeScreenHeader', () => {
const { getByTestId } = render(
-
+ ,
)
const menu = getByTestId('menu-icon-white')
diff --git a/src/routes/home/components/__tests__/NextExerciseCard.spec.tsx b/src/routes/home/components/__tests__/NextExerciseCard.spec.tsx
index 95b88b5ea..4e19b56a7 100644
--- a/src/routes/home/components/__tests__/NextExerciseCard.spec.tsx
+++ b/src/routes/home/components/__tests__/NextExerciseCard.spec.tsx
@@ -14,7 +14,7 @@ describe('NextExerciseCard', () => {
subheading='subheading'
buttonLabel='button'
onPress={onPress}
- />
+ />,
)
expect(getByText('heading')).toBeDefined()
expect(getByText('subheading')).toBeDefined()
diff --git a/src/routes/home/components/__tests__/ProfessionDetails.spec.tsx b/src/routes/home/components/__tests__/ProfessionDetails.spec.tsx
index 977b7ecf4..9d1b552c4 100644
--- a/src/routes/home/components/__tests__/ProfessionDetails.spec.tsx
+++ b/src/routes/home/components/__tests__/ProfessionDetails.spec.tsx
@@ -43,7 +43,7 @@ describe('ProfessionDetails', () => {
discipline={mockDisciplines()[0]}
navigateToDiscipline={navigateToDiscipline}
navigateToNextExercise={navigateToExercise}
- />
+ />,
)
it('should show next exercise details on the card', () => {
diff --git a/src/routes/process-user-vocabulary/UserVocabularyProcessScreen.tsx b/src/routes/process-user-vocabulary/UserVocabularyProcessScreen.tsx
index f184cb843..954731ef7 100644
--- a/src/routes/process-user-vocabulary/UserVocabularyProcessScreen.tsx
+++ b/src/routes/process-user-vocabulary/UserVocabularyProcessScreen.tsx
@@ -144,7 +144,7 @@ const UserVocabularyProcessScreen = ({ navigation, route }: UserVocabularyProces
await moveFile(image, path)
}
return { id: index, image: path }
- })
+ }),
)
const audioPath = `file:///${DocumentDirectoryPath}/audio-${id}`
diff --git a/src/routes/process-user-vocabulary/__tests__/UserVocabularyProcessScreen.spec.tsx b/src/routes/process-user-vocabulary/__tests__/UserVocabularyProcessScreen.spec.tsx
index a5b6b16f1..b2991dc1f 100644
--- a/src/routes/process-user-vocabulary/__tests__/UserVocabularyProcessScreen.spec.tsx
+++ b/src/routes/process-user-vocabulary/__tests__/UserVocabularyProcessScreen.spec.tsx
@@ -63,7 +63,7 @@ describe('UserVocabularyProcessScreen', () => {
+ />,
)
const deleteThumbnail = getByTestId('delete-on-thumbnail')
expect(getByText(getLabels().userVocabulary.creation.addImage)).not.toBeDisabled()
@@ -76,7 +76,7 @@ describe('UserVocabularyProcessScreen', () => {
jest.spyOn(React, 'useState').mockImplementationOnce(() => [['image-1', 'image-2', 'image-3'], setState])
const { getAllByTestId, getByText } = render(
-
+ ,
)
const a = getAllByTestId('delete-on-thumbnail')
expect(a).toHaveLength(3)
@@ -97,7 +97,7 @@ describe('UserVocabularyProcessScreen', () => {
it('should fill all fields correctly', async () => {
const { getByPlaceholderText, getByTestId, getAllByTestId } = render(
-
+ ,
)
const textField = getByPlaceholderText(getLabels().userVocabulary.creation.wordPlaceholder)
expect(textField.props.value).toEqual(itemToEdit.word)
@@ -109,7 +109,7 @@ describe('UserVocabularyProcessScreen', () => {
it('should keep all fields except word if only word is updated', async () => {
const { getByPlaceholderText, getByText } = render(
-
+ ,
)
const textField = getByPlaceholderText(getLabels().userVocabulary.creation.wordPlaceholder)
fireEvent.changeText(textField, 'new-word')
@@ -127,7 +127,7 @@ describe('UserVocabularyProcessScreen', () => {
jest.spyOn(ReactNativeFS, 'unlink')
const { getByText, getAllByTestId } = render(
-
+ ,
)
expect(getAllByTestId('delete-on-thumbnail')).toHaveLength(2)
const deleteThumbnail = getAllByTestId('delete-on-thumbnail')[0]
diff --git a/src/routes/process-user-vocabulary/components/AudioRecordOverlay.tsx b/src/routes/process-user-vocabulary/components/AudioRecordOverlay.tsx
index b97293fbe..f4b02c46f 100644
--- a/src/routes/process-user-vocabulary/components/AudioRecordOverlay.tsx
+++ b/src/routes/process-user-vocabulary/components/AudioRecordOverlay.tsx
@@ -110,7 +110,7 @@ const AudioRecordOverlay = ({
const [recordingTime, setRecordingTime] = useState(recordingTimeInit)
const [isPressed, setIsPressed] = useState(false)
const { permissionGranted, permissionRequested } = useGrantPermissions(
- Platform.OS === 'ios' ? PERMISSIONS.IOS.MICROPHONE : PERMISSIONS.ANDROID.RECORD_AUDIO
+ Platform.OS === 'ios' ? PERMISSIONS.IOS.MICROPHONE : PERMISSIONS.ANDROID.RECORD_AUDIO,
)
const { hold, talk } = getLabels().general.audio
const { description } = getLabels().general.audio.noAuthorization
diff --git a/src/routes/repetition/RepetitionScreen.tsx b/src/routes/repetition/RepetitionScreen.tsx
index 216d8874f..ce4b3d2d2 100644
--- a/src/routes/repetition/RepetitionScreen.tsx
+++ b/src/routes/repetition/RepetitionScreen.tsx
@@ -56,7 +56,7 @@ const HeaderWrapper = styled.View`
const IconWrapper = styled.View`
position: absolute;
left: ${hp('18%')}px;
- top: ${hp('0.2%')}px; ;
+ top: ${hp('0.2%')}px;
`
const ModalContainer = styled.View`
display: flex;
@@ -73,7 +73,7 @@ const RepetitionScreen = ({ navigation }: RepetitionScreenProps): ReactElement =
const { repeatWords, repeatNow, wordsToRepeat, yourLearningProgress } = getLabels().repetition
const { data: numberOfWordsNeedingRepetition, refresh: refreshNumberOfWordsNeedingRepetition } = useLoadAsync(
RepetitionService.getNumberOfWordsNeedingRepetitionWithUpperBound,
- undefined
+ undefined,
)
useFocusEffect(refreshNumberOfWordsNeedingRepetition)
diff --git a/src/routes/repetition/__tests__/RepetitionScreen.spec.tsx b/src/routes/repetition/__tests__/RepetitionScreen.spec.tsx
index 2485b4efa..f0ee1ac8a 100644
--- a/src/routes/repetition/__tests__/RepetitionScreen.spec.tsx
+++ b/src/routes/repetition/__tests__/RepetitionScreen.spec.tsx
@@ -17,7 +17,7 @@ describe('RepetitionScreen', () => {
it('should render screen correctly', async () => {
mocked(RepetitionService.getNumberOfWordsNeedingRepetitionWithUpperBound).mockImplementation(() =>
- Promise.resolve(2)
+ Promise.resolve(2),
)
const { getByText, getByTestId } = render()
await waitFor(() => expect(getByText(`2 ${getLabels().repetition.wordsToRepeat}`)).toBeDefined())
diff --git a/src/routes/repetition/components/RepetitionProgressChart.tsx b/src/routes/repetition/components/RepetitionProgressChart.tsx
index 420b1d1cf..3cf48afe8 100644
--- a/src/routes/repetition/components/RepetitionProgressChart.tsx
+++ b/src/routes/repetition/components/RepetitionProgressChart.tsx
@@ -31,7 +31,7 @@ const RepetitionProgressChart: () => ReactElement = () => {
useFocusEffect(
useCallback(() => {
refresh()
- }, [refresh])
+ }, [refresh]),
)
return (
diff --git a/src/routes/vocabulary-detail-exercise/components/__tests__/AlternativeWords.spec.tsx b/src/routes/vocabulary-detail-exercise/components/__tests__/AlternativeWords.spec.tsx
index 7072d7ae7..660ebd7a2 100644
--- a/src/routes/vocabulary-detail-exercise/components/__tests__/AlternativeWords.spec.tsx
+++ b/src/routes/vocabulary-detail-exercise/components/__tests__/AlternativeWords.spec.tsx
@@ -13,8 +13,8 @@ describe('AlternativeWords', () => {
expect(getByText(getLabels().exercises.vocabularyList.alternativeWords)).toBeDefined()
expect(
getByText(
- `${vocabularyItems[0].alternatives[0].article.value} ${vocabularyItems[0].alternatives[0].word}, ${vocabularyItems[0].alternatives[1].article.value} ${vocabularyItems[0].alternatives[1].word}`
- )
+ `${vocabularyItems[0].alternatives[0].article.value} ${vocabularyItems[0].alternatives[0].word}, ${vocabularyItems[0].alternatives[1].article.value} ${vocabularyItems[0].alternatives[1].word}`,
+ ),
).toBeDefined()
expect(getByText(getLabels().exercises.vocabularyList.suggestAlternative)).toBeDefined()
})
diff --git a/src/routes/write-exercise/WriteExerciseScreen.tsx b/src/routes/write-exercise/WriteExerciseScreen.tsx
index 8dd7fe80e..233716e3e 100644
--- a/src/routes/write-exercise/WriteExerciseScreen.tsx
+++ b/src/routes/write-exercise/WriteExerciseScreen.tsx
@@ -38,7 +38,7 @@ const WriteExerciseScreen = ({ route, navigation }: WriteExerciseScreenProps): R
const [currentIndex, setCurrentIndex] = useState(0)
const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false)
const [vocabularyItemWithResults, setVocabularyItemWithResults] = useState(
- shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 })))
+ shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 }))),
)
const { isKeyboardVisible } = useKeyboard()
@@ -53,21 +53,21 @@ const WriteExerciseScreen = ({ route, navigation }: WriteExerciseScreenProps): R
navigation,
setCurrentIndex,
setIsAnswerSubmitted,
- setVocabularyItemWithResults
+ setVocabularyItemWithResults,
)
: new StandardWriteExerciseService(
route,
navigation,
setCurrentIndex,
setIsAnswerSubmitted,
- setVocabularyItemWithResults
+ setVocabularyItemWithResults,
),
- [contentType, route, navigation]
+ [contentType, route, navigation],
)
const initializeExercise = useCallback(
() => writeExerciseService.initializeExercise(vocabularyItems, vocabularyItemWithResults),
- [vocabularyItems, vocabularyItemWithResults, writeExerciseService]
+ [vocabularyItems, vocabularyItemWithResults, writeExerciseService],
)
useEffect(initializeExercise, [initializeExercise])
@@ -117,7 +117,7 @@ const WriteExerciseScreen = ({ route, navigation }: WriteExerciseScreenProps): R
needsToBeRepeated,
vocabularyItemWithResults,
vocabularyItems,
- isKeyboardVisible
+ isKeyboardVisible,
)
}
buttonTheme={BUTTONS_THEME.contained}
diff --git a/src/routes/write-exercise/__tests__/WriteExerciseScreen.spec.tsx b/src/routes/write-exercise/__tests__/WriteExerciseScreen.spec.tsx
index 44eb6ebfe..22262979f 100644
--- a/src/routes/write-exercise/__tests__/WriteExerciseScreen.spec.tsx
+++ b/src/routes/write-exercise/__tests__/WriteExerciseScreen.spec.tsx
@@ -125,8 +125,8 @@ describe('WriteExerciseScreen', () => {
getByText(
`${getLabels().exercises.write.feedback.wrong} ${getLabels().exercises.write.feedback.solution} „${
vocabularyItems[1].article.value
- } ${vocabularyItems[1].word}“`
- )
+ } ${vocabularyItems[1].word}“`,
+ ),
).toBeDefined()
expect(getByText(getLabels().exercises.showResults)).toBeDefined()
})
@@ -143,8 +143,8 @@ describe('WriteExerciseScreen', () => {
getByText(
`${getLabels().exercises.write.feedback.almostCorrect1} „${submission}“ ${
getLabels().exercises.write.feedback.almostCorrect2
- }`
- )
+ }`,
+ ),
).toBeDefined()
fireEvent.press(getByText(getLabels().exercises.write.checkInput))
@@ -153,8 +153,8 @@ describe('WriteExerciseScreen', () => {
getByText(
`${getLabels().exercises.write.feedback.wrong} ${getLabels().exercises.write.feedback.solution} „${
vocabularyItems[0].article.value
- } ${vocabularyItems[0].word}“`
- )
+ } ${vocabularyItems[0].word}“`,
+ ),
).toBeDefined()
expect(getByText(getLabels().exercises.next)).toBeDefined()
})
@@ -205,7 +205,7 @@ describe('WriteExerciseScreen', () => {
input,
`${getLabels().exercises.write.feedback.almostCorrect1} „${input}“ ${
getLabels().exercises.write.feedback.almostCorrect2
- }`
+ }`,
)
})
@@ -214,7 +214,7 @@ describe('WriteExerciseScreen', () => {
'das Falsche',
`${getLabels().exercises.write.feedback.wrong} ${getLabels().exercises.write.feedback.solution} „${
vocabularyItems[0].article.value
- } ${vocabularyItems[0].word}“`
+ } ${vocabularyItems[0].word}“`,
)
})
diff --git a/src/routes/write-exercise/components/__tests__/AnswerReview.spec.tsx b/src/routes/write-exercise/components/__tests__/AnswerReview.spec.tsx
index 06be6a486..1724abd39 100644
--- a/src/routes/write-exercise/components/__tests__/AnswerReview.spec.tsx
+++ b/src/routes/write-exercise/components/__tests__/AnswerReview.spec.tsx
@@ -30,8 +30,8 @@ describe('AnswerReview', () => {
queryByText(
`${getLabels().exercises.write.feedback.almostCorrect1} „${submission}“ ${
getLabels().exercises.write.feedback.almostCorrect2
- }`
- )
+ }`,
+ ),
).toBeTruthy()
})
@@ -42,8 +42,8 @@ describe('AnswerReview', () => {
queryByText(
`${getLabels().exercises.write.feedback.wrong} ${getLabels().exercises.write.feedback.solution} „${
vocabularyItem.article.value
- } ${vocabularyItem.word}“`
- )
+ } ${vocabularyItem.word}“`,
+ ),
).toBeTruthy()
})
it('should render incorrect answer review with retries not exceeded', () => {
@@ -53,8 +53,8 @@ describe('AnswerReview', () => {
queryByText(
`${getLabels().exercises.write.feedback.wrong} ${getLabels().exercises.write.feedback.solution} „${
vocabularyItem.article.value
- } ${vocabularyItem.word}“`
- )
+ } ${vocabularyItem.word}“`,
+ ),
).toBeTruthy()
})
})
diff --git a/src/routes/write-exercise/components/__tests__/InteractionSection.spec.tsx b/src/routes/write-exercise/components/__tests__/InteractionSection.spec.tsx
index d98658e03..6b334d4ed 100644
--- a/src/routes/write-exercise/components/__tests__/InteractionSection.spec.tsx
+++ b/src/routes/write-exercise/components/__tests__/InteractionSection.spec.tsx
@@ -46,20 +46,20 @@ describe('InteractionSection', () => {
const renderInteractionSection = (
vocabularyItemWithResult: VocabularyItemResult,
- isAnswerSubmitted: boolean
+ isAnswerSubmitted: boolean,
): RenderAPI =>
render(
+ />,
)
it('should render correctly if not submitted answer yet', () => {
const { getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
expect(getByText(getLabels().exercises.write.checkInput)).toBeDisabled()
expect(getByPlaceholderText(getLabels().exercises.write.insertAnswer)).toBeDefined()
@@ -73,7 +73,7 @@ describe('InteractionSection', () => {
it('should show popup if article missing', async () => {
const { getByText, getByPlaceholderText, getByTestId } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'Spachtel')
@@ -85,7 +85,7 @@ describe('InteractionSection', () => {
it('should show incorrect if word is not correct', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'die WrongAnswer')
@@ -99,7 +99,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText(getLabels().exercises.write.feedback.wrong, { exact: false })).toBeTruthy()
})
@@ -107,7 +107,7 @@ describe('InteractionSection', () => {
it('should show similar if word is similar', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'die Wachtel')
@@ -121,7 +121,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText(getLabels().exercises.write.feedback.almostCorrect2, { exact: false })).toBeTruthy()
})
@@ -129,7 +129,7 @@ describe('InteractionSection', () => {
it('should show similar if word is correct and article similar', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'das Spachtel')
@@ -143,7 +143,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText(getLabels().exercises.write.feedback.almostCorrect2, { exact: false })).toBeTruthy()
})
@@ -151,7 +151,7 @@ describe('InteractionSection', () => {
it('should show correct', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'die Spachtel')
@@ -165,7 +165,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText('Toll, weiter so!', { exact: false })).toBeTruthy()
})
@@ -173,7 +173,7 @@ describe('InteractionSection', () => {
it('should show correct for divided words', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem: dividedVocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'der kontaktlose Spannungsprüfer')
@@ -191,7 +191,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText('Toll, weiter so!', { exact: false })).toBeTruthy()
})
@@ -199,7 +199,7 @@ describe('InteractionSection', () => {
it('should show correct for articels starting with an uppercase letter', async () => {
const { rerender, getByText, getByPlaceholderText } = renderInteractionSection(
{ vocabularyItem, result: null, numberOfTries: 0 },
- false
+ false,
)
const inputField = getByPlaceholderText(getLabels().exercises.write.insertAnswer)
fireEvent.changeText(inputField, 'Die Spachtel')
@@ -213,7 +213,7 @@ describe('InteractionSection', () => {
vocabularyItemWithResult={vocabularyItemWithResult}
isAnswerSubmitted
storeResult={storeResult}
- />
+ />,
)
expect(getByText('Toll, weiter so!', { exact: false })).toBeTruthy()
})
diff --git a/src/routes/write-exercise/services/AbstractWriteExerciseService.ts b/src/routes/write-exercise/services/AbstractWriteExerciseService.ts
index e9444bc19..9c81e3c77 100644
--- a/src/routes/write-exercise/services/AbstractWriteExerciseService.ts
+++ b/src/routes/write-exercise/services/AbstractWriteExerciseService.ts
@@ -14,19 +14,19 @@ export default abstract class AbstractWriteExerciseService {
public navigation: StackNavigationProp,
public setCurrentIndex: React.Dispatch>,
public setIsAnswerSubmitted: React.Dispatch>,
- public setVocabularyItemWithResults: React.Dispatch> // eslint-disable-next-line no-empty-function
+ public setVocabularyItemWithResults: React.Dispatch>, // eslint-disable-next-line no-empty-function
) {}
initializeExercise = (
vocabularyItems: VocabularyItem[],
vocabularyItemWithResults: VocabularyItemResult[],
- force = false
+ force = false,
): void => {
if (vocabularyItems.length !== vocabularyItemWithResults.length || force) {
this.setCurrentIndex(0)
this.setIsAnswerSubmitted(false)
this.setVocabularyItemWithResults(
- shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 })))
+ shuffleArray(vocabularyItems.map(vocabularyItem => ({ vocabularyItem, result: null, numberOfTries: 0 }))),
)
}
}
@@ -34,7 +34,7 @@ export default abstract class AbstractWriteExerciseService {
tryLater = (
currentIndex: number,
isKeyboardVisible: boolean,
- vocabularyItemWithResults: VocabularyItemResult[]
+ vocabularyItemWithResults: VocabularyItemResult[],
): void => {
// ImageViewer is not resized correctly if keyboard is not dismissed before going to next vocabularyItem
if (isKeyboardVisible) {
@@ -51,7 +51,7 @@ export default abstract class AbstractWriteExerciseService {
giveUp = async (
vocabularyItemWithResults: VocabularyItemResult[],
current: VocabularyItemResult,
- currentIndex: number
+ currentIndex: number,
): Promise => {
this.setIsAnswerSubmitted(true)
await this.storeResult(
@@ -62,7 +62,7 @@ export default abstract class AbstractWriteExerciseService {
},
vocabularyItemWithResults,
current,
- currentIndex
+ currentIndex,
)
}
@@ -71,7 +71,7 @@ export default abstract class AbstractWriteExerciseService {
needsToBeRepeated: boolean,
vocabularyItemWithResults: VocabularyItemResult[],
vocabularyItems: VocabularyItem[],
- isKeyboardVisible: boolean
+ isKeyboardVisible: boolean,
): Promise => {
this.setIsAnswerSubmitted(false)
if (currentIndex === vocabularyItemWithResults.length - 1 && !needsToBeRepeated) {
@@ -87,12 +87,12 @@ export default abstract class AbstractWriteExerciseService {
result: VocabularyItemResult,
vocabularyItemWithResults: VocabularyItemResult[],
current: VocabularyItemResult,
- currentIndex: number
+ currentIndex: number,
) => Promise | void
abstract cheatExercise: (
result: SimpleResult,
vocabularyItems: VocabularyItem[],
- vocabularyItemWithResults: VocabularyItemResult[]
+ vocabularyItemWithResults: VocabularyItemResult[],
) => void
abstract finishExercise: (results: VocabularyItemResult[], vocabularyItems: VocabularyItem[]) => Promise
}
diff --git a/src/routes/write-exercise/services/RepetitionWriteExerciseService.ts b/src/routes/write-exercise/services/RepetitionWriteExerciseService.ts
index 46a3f278a..5bd8f2ea5 100644
--- a/src/routes/write-exercise/services/RepetitionWriteExerciseService.ts
+++ b/src/routes/write-exercise/services/RepetitionWriteExerciseService.ts
@@ -13,7 +13,7 @@ class RepetitionWriteExerciseService extends AbstractWriteExerciseService {
result: VocabularyItemResult,
vocabularyItemWithResults: VocabularyItemResult[],
current: VocabularyItemResult,
- currentIndex: number
+ currentIndex: number,
): Promise => {
const updatedVocabularyItemsWithResults = Array.from(vocabularyItemWithResults)
if (current.vocabularyItem.id !== result.vocabularyItem.id) {
@@ -28,7 +28,7 @@ class RepetitionWriteExerciseService extends AbstractWriteExerciseService {
cheatExercise = async (
result: SimpleResult,
vocabularyItems: VocabularyItem[],
- vocabularyItemWithResults: VocabularyItemResult[]
+ vocabularyItemWithResults: VocabularyItemResult[],
): Promise => {
const cheatedVocabularyItems = vocabularyItemWithResults.map(it => ({ ...it, numberOfTries: 1, result }))
/* eslint-disable no-restricted-syntax */
diff --git a/src/routes/write-exercise/services/StandardWriteExerciseService.ts b/src/routes/write-exercise/services/StandardWriteExerciseService.ts
index 7cd04426b..7cb07eddf 100644
--- a/src/routes/write-exercise/services/StandardWriteExerciseService.ts
+++ b/src/routes/write-exercise/services/StandardWriteExerciseService.ts
@@ -24,7 +24,7 @@ class StandardWriteExerciseService extends AbstractWriteExerciseService {
needsToBeRepeated: boolean,
vocabularyItemWithResults: VocabularyItemResult[],
vocabularyItems: VocabularyItem[],
- isKeyboardVisible: boolean
+ isKeyboardVisible: boolean,
): Promise => {
this.setIsAnswerSubmitted(false)
@@ -41,7 +41,7 @@ class StandardWriteExerciseService extends AbstractWriteExerciseService {
result: VocabularyItemResult,
vocabularyItemWithResults: VocabularyItemResult[],
current: VocabularyItemResult,
- currentIndex: number
+ currentIndex: number,
): void => {
const updatedVocabularyItemsWithResults = Array.from(vocabularyItemWithResults)
if (current.vocabularyItem.id !== result.vocabularyItem.id) {
@@ -55,7 +55,7 @@ class StandardWriteExerciseService extends AbstractWriteExerciseService {
cheatExercise = async (
result: SimpleResult,
vocabularyItems: VocabularyItem[],
- vocabularyItemWithResults: VocabularyItemResult[]
+ vocabularyItemWithResults: VocabularyItemResult[],
): Promise => {
const cheatedVocabularyItems = vocabularyItemWithResults.map(it => ({ ...it, numberOfTries: 1, result }))
await this.finishExercise(cheatedVocabularyItems, vocabularyItems)
diff --git a/src/routes/write-exercise/services/__tests__/RepetitionWriteExerciseService.spec.ts b/src/routes/write-exercise/services/__tests__/RepetitionWriteExerciseService.spec.ts
index 3a8f481a3..15f43e9fa 100644
--- a/src/routes/write-exercise/services/__tests__/RepetitionWriteExerciseService.spec.ts
+++ b/src/routes/write-exercise/services/__tests__/RepetitionWriteExerciseService.spec.ts
@@ -47,7 +47,7 @@ describe('RepetitionWriteExerciseService', () => {
navigation,
setCurrentIndex,
setIsAnswerSubmitted,
- setVocabularyItemWithResults
+ setVocabularyItemWithResults,
)
}
@@ -117,13 +117,13 @@ describe('RepetitionWriteExerciseService', () => {
vocabularyItemsWithResults[1],
vocabularyItemsWithResults[2],
vocabularyItemsWithResults[3],
- ])
+ ]),
)
await waitFor(() =>
expect(RepetitionService.updateWordNodeCard).toHaveBeenCalledWith({
...vocabularyItemsWithResults[0],
numberOfTries: 1,
- })
+ }),
)
})
})
diff --git a/src/routes/write-exercise/services/__tests__/StandardWriteExerciseService.spec.tsx b/src/routes/write-exercise/services/__tests__/StandardWriteExerciseService.spec.tsx
index 5d318dcb2..32d6831c0 100644
--- a/src/routes/write-exercise/services/__tests__/StandardWriteExerciseService.spec.tsx
+++ b/src/routes/write-exercise/services/__tests__/StandardWriteExerciseService.spec.tsx
@@ -46,7 +46,7 @@ describe('StandardWriteExerciseService', () => {
navigation,
setCurrentIndex,
setIsAnswerSubmitted,
- setVocabularyItemWithResults
+ setVocabularyItemWithResults,
)
}
diff --git a/src/services/AsyncStorage.ts b/src/services/AsyncStorage.ts
index afe832f27..6c6555598 100644
--- a/src/services/AsyncStorage.ts
+++ b/src/services/AsyncStorage.ts
@@ -85,7 +85,7 @@ export const getExerciseProgress = async (): Promise