diff --git a/.eslintrc.json b/.eslintrc.json index b426668..484a7fe 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,11 @@ { - "extends": ["standard-with-typescript", "eslint-config-prettier"], - "plugins": ["eslint-plugin-prettier"], + "extends": [ + "standard-with-typescript", + "next", + "next/core-web-vitals", + "prettier" + ], + "plugins": ["prettier"], "parserOptions": { "project": "./tsconfig.json" }, diff --git a/.github/workflows/Divlo.yml b/.github/workflows/Divlo.yml index 2281fad..cf111fa 100644 --- a/.github/workflows/Divlo.yml +++ b/.github/workflows/Divlo.yml @@ -75,6 +75,8 @@ jobs: - name: 'Lighthouse' run: 'npm run lighthouse' + env: + LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} test: runs-on: 'ubuntu-latest' diff --git a/.lighthouserc.json b/.lighthouserc.json index a99c8d9..25f6515 100644 --- a/.lighthouserc.json +++ b/.lighthouserc.json @@ -10,16 +10,9 @@ "assert": { "preset": "lighthouse:recommended", "assertions": { - "legacy-javascript": "off", - "unused-javascript": "off", - "uses-rel-preload": "off", - "csp-xss": "off", - "canonical": "off", - "unsized-images": "off", - "uses-responsive-images": "off", - "bypass": "warning", - "color-contrast": "warning", - "preload-lcp-image": "warning" + "csp-xss": "warning", + "non-composited-animations": "warning", + "uses-responsive-images": "warning" } }, "upload": { diff --git a/components/Header/Language/index.tsx b/components/Header/Language/index.tsx index ea1ffe8..7c30882 100644 --- a/components/Header/Language/index.tsx +++ b/components/Header/Language/index.tsx @@ -1,15 +1,19 @@ -import { useEffect, useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import useTranslation from 'next-translate/useTranslation' import setLanguage from 'next-translate/setLanguage' import { Arrow } from './Arrow' import { LanguageFlag } from './LanguageFlag' -import { locales } from 'i18n.json' +import i18n from 'i18n.json' export const Language: React.FC = () => { const { lang: currentLanguage } = useTranslation() const [hiddenMenu, setHiddenMenu] = useState(true) + const handleHiddenMenu = useCallback(() => { + setHiddenMenu(!hiddenMenu) + }, [hiddenMenu]) + useEffect(() => { if (!hiddenMenu) { window.document.addEventListener('click', handleHiddenMenu) @@ -20,17 +24,13 @@ export const Language: React.FC = () => { return () => { window.document.removeEventListener('click', handleHiddenMenu) } - }, [hiddenMenu]) + }, [hiddenMenu, handleHiddenMenu]) const handleLanguage = async (language: string): Promise => { await setLanguage(language) handleHiddenMenu() } - const handleHiddenMenu = (): void => { - setHiddenMenu(!hiddenMenu) - } - return (
@@ -39,7 +39,7 @@ export const Language: React.FC = () => {
{!hiddenMenu && (