update eslint configuration
This commit is contained in:
parent
0b0aa7dad9
commit
1753752565
|
@ -0,0 +1,13 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: ['react-app'],
|
||||||
|
rules: {
|
||||||
|
'react/react-in-jsx-scope': 0,
|
||||||
|
'react/jsx-pascal-case': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
allowAllCaps: true,
|
||||||
|
ignore: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "react-app"
|
|
||||||
}
|
|
|
@ -8,7 +8,8 @@
|
||||||
"postbuild": "next-sitemap",
|
"postbuild": "next-sitemap",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"start:production": "NODE_ENV=production yarn run start",
|
"start:production": "NODE_ENV=production yarn run start",
|
||||||
"codegen": "graphql-codegen"
|
"codegen": "graphql-codegen",
|
||||||
|
"lint": "eslint . --ext ts --ext tsx --ext js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kichiyaki/roboto": "^1.0.0",
|
"@kichiyaki/roboto": "^1.0.0",
|
||||||
|
|
|
@ -32,12 +32,12 @@ const Section = ({
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className={clsx(className, classes.section, {
|
className={clsx(className, classes.section, {
|
||||||
['is-medium']: size === Size.Medium,
|
'is-medium': size === Size.Medium,
|
||||||
['is-large']: size === Size.Large,
|
'is-large': size === Size.Large,
|
||||||
['is-primary']: bgColor === BgColor.Primary,
|
'is-primary': bgColor === BgColor.Primary,
|
||||||
['is-primary-dark']: bgColor === BgColor.PrimaryDark,
|
'is-primary-dark': bgColor === BgColor.PrimaryDark,
|
||||||
['is-secondary']: bgColor === BgColor.Secondary,
|
'is-secondary': bgColor === BgColor.Secondary,
|
||||||
['is-secondary-dark']: bgColor === BgColor.SecondaryDark,
|
'is-secondary-dark': bgColor === BgColor.SecondaryDark,
|
||||||
})}
|
})}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { MouseEventHandler, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Maybe, Qualification } from 'libs/graphql';
|
import { Maybe, Qualification } from 'libs/graphql';
|
||||||
import { SECTION_ID as PROFESSIONS_SECTION_ID } from '../Professions/Professions';
|
import { SECTION_ID as PROFESSIONS_SECTION_ID } from '../Professions/Professions';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useCountdown } from 'libs/hooks';
|
||||||
|
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { Container, Grid, Typography } from '@material-ui/core';
|
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 {
|
export interface TimerProps {
|
||||||
dateOfTheExam: Date | string;
|
dateOfTheExam: Date | string;
|
||||||
|
|
|
@ -3,6 +3,13 @@ import { useEffect, useRef, useCallback } from 'react';
|
||||||
export const usePrompt = (when: boolean) => {
|
export const usePrompt = (when: boolean) => {
|
||||||
const whenRef = useRef(when);
|
const whenRef = useRef(when);
|
||||||
|
|
||||||
|
const handleUnload = useCallback((event: BeforeUnloadEvent) => {
|
||||||
|
if (whenRef.current) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.returnValue = '';
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
whenRef.current = when;
|
whenRef.current = when;
|
||||||
}, [when]);
|
}, [when]);
|
||||||
|
@ -12,12 +19,5 @@ export const usePrompt = (when: boolean) => {
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('beforeunload', handleUnload);
|
window.removeEventListener('beforeunload', handleUnload);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [handleUnload]);
|
||||||
|
|
||||||
const handleUnload = useCallback((event: BeforeUnloadEvent) => {
|
|
||||||
if (whenRef.current) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.returnValue = '';
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue