refactor: update a few dev deps and convert to using type imports where possible (#2886)

* build: bump deps and add some new eslint rules

* refactor: run eslint --fix on code to convert to type imports where possible
This commit is contained in:
Ryan Cohen
2022-08-03 12:57:51 +09:00
committed by GitHub
parent 25eb765f9b
commit f5864b49de
245 changed files with 1034 additions and 620 deletions

View File

@@ -1,4 +1,5 @@
import { useState, useEffect, Dispatch, SetStateAction } from 'react';
import type { Dispatch, SetStateAction } from 'react';
import { useState, useEffect } from 'react';
/**
* A hook to help with debouncing state

View File

@@ -1,8 +1,6 @@
import { useContext } from 'react';
import {
LanguageContext,
LanguageContextProps,
} from '../context/LanguageContext';
import type { LanguageContextProps } from '../context/LanguageContext';
import { LanguageContext } from '../context/LanguageContext';
const useLocale = (): Omit<LanguageContextProps, 'children'> => {
const languageContext = useContext(LanguageContext);

View File

@@ -1,6 +1,6 @@
import useSWR from 'swr';
import { MediaRequest } from '../../server/entity/MediaRequest';
import {
import type { MediaRequest } from '../../server/entity/MediaRequest';
import type {
ServiceCommonServer,
ServiceCommonServerWithDetails,
} from '../../server/interfaces/api/serviceInterfaces';

View File

@@ -1,6 +1,7 @@
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { Permission, PermissionCheckOptions, useUser } from './useUser';
import type { Permission, PermissionCheckOptions } from './useUser';
import { useUser } from './useUser';
const useRouteGuard = (
permission: Permission | Permission[],

View File

@@ -1,6 +1,7 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { useRouter } from 'next/router';
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import type { Dispatch, SetStateAction } from 'react';
import { useEffect, useState } from 'react';
import type { UrlObject } from 'url';
import type { Nullable } from '../utils/typeHelpers';
import useDebouncedState from './useDebouncedState';

View File

@@ -1,8 +1,6 @@
import { useContext } from 'react';
import {
SettingsContext,
SettingsContextProps,
} from '../context/SettingsContext';
import type { SettingsContextProps } from '../context/SettingsContext';
import { SettingsContext } from '../context/SettingsContext';
const useSettings = (): SettingsContextProps => {
const settings = useContext(SettingsContext);

View File

@@ -1,5 +1,6 @@
import { NextRouter, useRouter } from 'next/router';
import { ParsedUrlQuery } from 'querystring';
import type { NextRouter } from 'next/router';
import { useRouter } from 'next/router';
import type { ParsedUrlQuery } from 'querystring';
import { useCallback } from 'react';
type UseQueryParamReturnedFunction = (

View File

@@ -1,12 +1,9 @@
import useSWR from 'swr';
import { MutatorCallback } from 'swr/dist/types';
import type { MutatorCallback } from 'swr/dist/types';
import { UserType } from '../../server/constants/user';
import {
hasPermission,
Permission,
PermissionCheckOptions,
} from '../../server/lib/permissions';
import { NotificationAgentKey } from '../../server/lib/settings';
import type { PermissionCheckOptions } from '../../server/lib/permissions';
import { hasPermission, Permission } from '../../server/lib/permissions';
import type { NotificationAgentKey } from '../../server/lib/settings';
export { Permission, UserType };
export type { PermissionCheckOptions };

View File

@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, MutableRefObject } from 'react';
import type { MutableRefObject } from 'react';
import { useState, useEffect, useRef } from 'react';
import { debounce } from 'lodash';
const IS_SCROLLING_CHECK_THROTTLE = 200;