From 4f2dcefb3af11af022f1d0faddc89afa8ea49791 Mon Sep 17 00:00:00 2001 From: Lee Date: Wed, 18 Oct 2023 09:43:27 +0200 Subject: [PATCH] refactor(linting) Co-authored-by: Sebastian Palmqvist --- .../components/childListItem.component.tsx | 5 +++-- .../components/contactMenu.component.tsx | 1 - .../components/daySummary.component.tsx | 2 +- apps/skolplattformen-app-new/components/login.component.tsx | 2 +- .../components/newsItem.component.tsx | 1 + .../libs/api-hjarntorget/lib/apiHjarntorget.ts | 5 ++--- .../libs/api-hjarntorget/lib/fake/fakeFetcher.ts | 4 ++-- .../libs/api-hjarntorget/lib/fake/lessons.ts | 2 -- .../libs/api-skolplattformen/lib/frejaLoginStatusChecker.ts | 2 +- apps/skolplattformen-app-new/libs/api-skolplattformen/run.js | 1 + apps/skolplattformen-app-new/libs/api/lib/parseHtml.test.ts | 1 + apps/skolplattformen-app-new/libs/hooks/src/hooks.ts | 3 +++ 12 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/skolplattformen-app-new/components/childListItem.component.tsx b/apps/skolplattformen-app-new/components/childListItem.component.tsx index 974ab9f03..401d8a771 100644 --- a/apps/skolplattformen-app-new/components/childListItem.component.tsx +++ b/apps/skolplattformen-app-new/components/childListItem.component.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react-native-a11y/has-accessibility-hint */ import { useNavigation } from '@react-navigation/native' import { StackNavigationProp } from '@react-navigation/stack' import { Child } from '../libs/api/lib' @@ -51,10 +50,12 @@ export const ChildListItem = ({ }, [child.id]) const navigation = useNavigation() + const { t } = useTranslation() - // const t = (key: string) => key; + const { data: notifications, reload: notificationsReload } = useNotifications(child) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { data: news, status: newsStatus, reload: newsReload } = useNews(child) const { data: classmates, reload: classmatesReload } = useClassmates(child) const { data: calendar, reload: calendarReload } = useCalendar(child) diff --git a/apps/skolplattformen-app-new/components/contactMenu.component.tsx b/apps/skolplattformen-app-new/components/contactMenu.component.tsx index c576e0780..c7af52c1b 100644 --- a/apps/skolplattformen-app-new/components/contactMenu.component.tsx +++ b/apps/skolplattformen-app-new/components/contactMenu.component.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react-native-a11y/has-accessibility-hint */ import { Classmate } from '../libs/api/lib' import { Button, diff --git a/apps/skolplattformen-app-new/components/daySummary.component.tsx b/apps/skolplattformen-app-new/components/daySummary.component.tsx index 2b942c5e7..1ad278a41 100644 --- a/apps/skolplattformen-app-new/components/daySummary.component.tsx +++ b/apps/skolplattformen-app-new/components/daySummary.component.tsx @@ -2,7 +2,7 @@ import { Child } from '../libs/api/lib' import { useTimetable } from '../libs/hooks/src' import { StyleService, Text, useStyleSheet } from '@ui-kitten/components' import moment, { Moment } from 'moment' -import React, { useCallback, useEffect, useState } from 'react' +import React from 'react' import { View } from 'react-native' import { LanguageService } from '../services/languageService' import { translate } from '../utils/translation' diff --git a/apps/skolplattformen-app-new/components/login.component.tsx b/apps/skolplattformen-app-new/components/login.component.tsx index a32c14710..e17ee9116 100644 --- a/apps/skolplattformen-app-new/components/login.component.tsx +++ b/apps/skolplattformen-app-new/components/login.component.tsx @@ -311,7 +311,7 @@ export const Login = () => { : loginMethods.filter((f) => f.id !== 'freja') } ItemSeparatorComponent={Divider} - renderItem={({ item, index }) => ( + renderItem={({ item }) => ( }): NativeStackNavigationOptions => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars const newsItem = route.params.newsItem const { child } = route.params return { diff --git a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/apiHjarntorget.ts b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/apiHjarntorget.ts index 914709a37..c661ea15f 100644 --- a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/apiHjarntorget.ts +++ b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/apiHjarntorget.ts @@ -38,7 +38,6 @@ import { fullImageUrl, hjarntorgetEventsUrl, hjarntorgetUrl, - infoSetReadUrl, infoUrl, initBankIdUrl, lessonsUrl, @@ -255,7 +254,7 @@ export class ApiHjarntorget extends EventEmitter implements Api { return Promise.resolve([]) } - public async getTeachers(child: EtjanstChild): Promise { + public async getTeachers(_child: EtjanstChild): Promise { if (!this.isLoggedIn) { throw new Error('Not logged in...') } @@ -263,7 +262,7 @@ export class ApiHjarntorget extends EventEmitter implements Api { } public async getSchoolContacts( - child: EtjanstChild + _child: EtjanstChild ): Promise { if (!this.isLoggedIn) { throw new Error('Not logged in...') diff --git a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/fakeFetcher.ts b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/fakeFetcher.ts index 27d141e5c..65a58eec9 100644 --- a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/fakeFetcher.ts +++ b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/fakeFetcher.ts @@ -41,8 +41,8 @@ const fetchMappings: { [name: string]: () => Response } = { export const fakeFetcher: Fetcher = ( name: string, - url: string, - init?: any + _url: string, + _init?: any ): Promise => { const responder = fetchMappings[name] ?? diff --git a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/lessons.ts b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/lessons.ts index 37a294d88..76c514ab8 100644 --- a/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/lessons.ts +++ b/apps/skolplattformen-app-new/libs/api-hjarntorget/lib/fake/lessons.ts @@ -1,5 +1,3 @@ -import { toNamespacedPath } from 'path' - // TODO: fix the startDate/endDate of all lessons export const lessons_133700_goteborgsstad = () => { const baseTime = 1636357800000 diff --git a/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/frejaLoginStatusChecker.ts b/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/frejaLoginStatusChecker.ts index 10f2fb02c..d43a47d0b 100644 --- a/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/frejaLoginStatusChecker.ts +++ b/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/frejaLoginStatusChecker.ts @@ -55,5 +55,5 @@ export class FrejaChecker export const checkStatus = ( fetch: Fetcher, token: string, - session: RequestInit + _session: RequestInit ): FrejaLoginStatusChecker => new FrejaChecker(fetch, token) diff --git a/apps/skolplattformen-app-new/libs/api-skolplattformen/run.js b/apps/skolplattformen-app-new/libs/api-skolplattformen/run.js index ee82e0f60..230ffe338 100644 --- a/apps/skolplattformen-app-new/libs/api-skolplattformen/run.js +++ b/apps/skolplattformen-app-new/libs/api-skolplattformen/run.js @@ -64,6 +64,7 @@ const record = async (info, data) => { break case 'blob': { const buffer = await data.arrayBuffer() + // eslint-disable-next-line no-undef content.blob = Buffer.from(buffer).toString('base64') break } diff --git a/apps/skolplattformen-app-new/libs/api/lib/parseHtml.test.ts b/apps/skolplattformen-app-new/libs/api/lib/parseHtml.test.ts index dad4ce910..19af43626 100644 --- a/apps/skolplattformen-app-new/libs/api/lib/parseHtml.test.ts +++ b/apps/skolplattformen-app-new/libs/api/lib/parseHtml.test.ts @@ -80,6 +80,7 @@ describe('parseHtml', () => { it('handles real data', () => { const html = '\u003cdiv data-sp-rte=""\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eHej,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eNu är det dags för vattenballongkrig \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e12/2-21 till om med tisdag 16/2-21.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eAlla knep är tillåtna. \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cb\u003eDet blir kul.\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eKolla in Reddit\u0026#58; \u003ca href="https\u0026#58;//reddit.com/water-balloons/where-to-buy/" data-cke-saved-href="https\u0026#58;//reddit.com/water-balloons/where-to-buy/"\u003ehttps\u0026#58;//reddit.com/water-balloons/where-to-buy/\u003c/a\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e...och här\u0026#58; \u003ca href="https\u0026#58;//reddit.com/splash-wars/" data-cke-saved-href="https\u0026#58;//reddit.com/splash-wars/"\u003ehttps\u0026#58;//reddit.com/splash-wars/\u003c/a\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003ch2\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eOm att vara hemma vid symtom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eÄven HackerNews är bra.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ca href="https\u0026#58;//wnews.ycombinator.com/" data-cke-saved-href="https\u0026#58;//wnews.ycombinator.com/"\u003ehttps\u0026#58;//wnews.ycombinator.com/\u003c/a\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eVi fortsätter också att\u0026#58;\u003c/span\u003e\u003c/span\u003e\u0026#160;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cul\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003ehålla avstånd.\u003c/span\u003e\u003c/span\u003e\u0026#160;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eha flera digitala möten.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003etvätta händerna.\u003c/span\u003e\u003c/span\u003e\u0026#160;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eundvika kollektivtrafik om det är möjligt.\u003c/span\u003e\u003c/span\u003e\u0026#160;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cul\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003estanna hemma även när man bara känner sig lite sjuk.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style="margin-left\u0026#58;32px;"\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003evädra ofta\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eTa hand om er!\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cb\u003eHa kul tillsammans, på avstånd.\u003c/b\u003e\u0026#160; \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eStort tack för ert samarbete! \u0026#160;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eVänligen, \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003erektorfnamn rektorenamn, rektor\u0026#160; \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cb\u003eVid frågor, kontakta oss gärna\u0026#58; \u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cb\u003e\u003cspan\u003eSkolledning\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003erektorfnamn rektorenamn rektor\u0026#58; \u003c/span\u003e\u003ca href="mailto\u0026#58;rektorfnamn.rektorenamn@edu.stockholm.se" data-cke-saved-href="mailto\u0026#58;rektorfnamn.rektorenamn@edu.stockholm.se"\u003e\u003cspan\u003erektorfnamn.rektorenamn@edu.stockholm.se\u003c/span\u003e\u003c/a\u003e \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003ebrektorfnamn brektorenamn, bitr. rektor\u0026#58; \u003c/span\u003e\u003ca href="mailto\u0026#58;brektorfnamn.u.brektorenamn@edu.stockholm.se" data-cke-saved-href="mailto\u0026#58;brektorfnamn.u.brektorenamn@edu.stockholm.se"\u003e\u003cspan\u003ebrektorfnamn.u.brektorenamn@edu.stockholm.se\u003c/span\u003e\u003c/a\u003e \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eb2rektorfnamn b2rektorenamn bitr. rektor\u0026#58; \u003c/span\u003e\u003ca href="mailto\u0026#58;b2rektorfnamn.b2rektorenamn@edu.stockholm.se" data-cke-saved-href="mailto\u0026#58;b2rektorfnamn.b2rektorenamn@edu.stockholm.se"\u003e\u003cspan\u003eb2rektorfnamn.b2rektorenamn@edu.stockholm.se\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cb\u003e\u003cspan\u003eSkolhälsan\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eb2rektorfnamn skolskstenamn skolsköterska\u0026#58; \u003c/span\u003e\u003ca href="mailto\u0026#58;b2rektorfnamn.skolskstenamn@edu.stockholm.se" data-cke-saved-href="mailto\u0026#58;b2rektorfnamn.skolskstenamn@edu.stockholm.se"\u003e\u003cspan\u003eb2rektorfnamn.skolskstenamn@edu.stockholm.se\u003c/span\u003e\u003c/a\u003e \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003cp\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003eStort tack för ert samarbete!\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/div\u003e\u003cdiv data-sp-rte=""\u003e\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\u003c/div\u003e' + // eslint-disable-next-line @typescript-eslint/no-unused-vars const nbsp = String.fromCharCode(160) const expected = `Hej, diff --git a/apps/skolplattformen-app-new/libs/hooks/src/hooks.ts b/apps/skolplattformen-app-new/libs/hooks/src/hooks.ts index c1f0b67cb..583d809e8 100644 --- a/apps/skolplattformen-app-new/libs/hooks/src/hooks.ts +++ b/apps/skolplattformen-app-new/libs/hooks/src/hooks.ts @@ -86,10 +86,12 @@ const hook = ( } useEffect(() => { load() + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoggedIn]) let mounted: boolean useEffect(() => { + // eslint-disable-next-line react-hooks/exhaustive-deps mounted = true return () => { mounted = false @@ -115,6 +117,7 @@ const hook = ( } } } + // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => store.subscribe(listener), []) return {