diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..f0c307f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + extends: ['react-app'], + rules: { + 'react/react-in-jsx-scope': 0, + 'react/jsx-pascal-case': [ + 'warn', + { + allowAllCaps: true, + ignore: [], + }, + ], + }, +}; diff --git a/eslintrc.json b/eslintrc.json deleted file mode 100644 index 4bed466..0000000 --- a/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "react-app" -} \ No newline at end of file diff --git a/package.json b/package.json index 58b235a..8843a0f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "postbuild": "next-sitemap", "start": "next start", "start:production": "NODE_ENV=production yarn run start", - "codegen": "graphql-codegen" + "codegen": "graphql-codegen", + "lint": "eslint . --ext ts --ext tsx --ext js" }, "dependencies": { "@kichiyaki/roboto": "^1.0.0", diff --git a/src/common/Section/Section.tsx b/src/common/Section/Section.tsx index 1d54d57..7038d76 100644 --- a/src/common/Section/Section.tsx +++ b/src/common/Section/Section.tsx @@ -32,12 +32,12 @@ const Section = ({ return (
diff --git a/src/features/IndexPage/components/Header/QualificationSelector.tsx b/src/features/IndexPage/components/Header/QualificationSelector.tsx index 0f30e20..4c35e3c 100644 --- a/src/features/IndexPage/components/Header/QualificationSelector.tsx +++ b/src/features/IndexPage/components/Header/QualificationSelector.tsx @@ -1,4 +1,4 @@ -import { MouseEventHandler, useState } from 'react'; +import { useState } from 'react'; import { Maybe, Qualification } from 'libs/graphql'; import { SECTION_ID as PROFESSIONS_SECTION_ID } from '../Professions/Professions'; diff --git a/src/features/IndexPage/components/Timer/Timer.tsx b/src/features/IndexPage/components/Timer/Timer.tsx index 33b6ef7..3d6d19e 100644 --- a/src/features/IndexPage/components/Timer/Timer.tsx +++ b/src/features/IndexPage/components/Timer/Timer.tsx @@ -3,7 +3,7 @@ import { useCountdown } from 'libs/hooks'; import { makeStyles } from '@material-ui/core/styles'; import { Container, Grid, Typography } from '@material-ui/core'; -import Section, { BgColor, Size } from 'common/Section/Section'; +import Section, { BgColor } from 'common/Section/Section'; export interface TimerProps { dateOfTheExam: Date | string; diff --git a/src/libs/hooks/usePrompt.ts b/src/libs/hooks/usePrompt.ts index b84ca15..6761c1c 100644 --- a/src/libs/hooks/usePrompt.ts +++ b/src/libs/hooks/usePrompt.ts @@ -3,6 +3,13 @@ import { useEffect, useRef, useCallback } from 'react'; export const usePrompt = (when: boolean) => { const whenRef = useRef(when); + const handleUnload = useCallback((event: BeforeUnloadEvent) => { + if (whenRef.current) { + event.preventDefault(); + event.returnValue = ''; + } + }, []); + useEffect(() => { whenRef.current = when; }, [when]); @@ -12,12 +19,5 @@ export const usePrompt = (when: boolean) => { return () => { window.removeEventListener('beforeunload', handleUnload); }; - }, []); - - const handleUnload = useCallback((event: BeforeUnloadEvent) => { - if (whenRef.current) { - event.preventDefault(); - event.returnValue = ''; - } - }, []); + }, [handleUnload]); };