[ESLint] Prefer named exports (#427)
This commit is contained in:
@@ -6,6 +6,6 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
export default function cloneObject<T extends object>(obj: T) {
|
||||
export function cloneObject<T extends object>(obj: T) {
|
||||
return JSON.parse(JSON.stringify(obj)) as T;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function getItem<T>(key: string, defaultValue: T): T {
|
||||
export function getItem<T>(key: string, defaultValue: T): T {
|
||||
const item = window.localStorage.getItem(key);
|
||||
|
||||
if (item !== null) {
|
||||
@@ -17,8 +17,6 @@ function getItem<T>(key: string, defaultValue: T): T {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
function setItem<T>(key: string, value: T): void {
|
||||
export function setItem<T>(key: string, value: T): void {
|
||||
window.localStorage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
export default { getItem, setItem };
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
TChapter,
|
||||
TManga,
|
||||
} from '@/typings';
|
||||
import requestManager from '@/lib/requests/RequestManager.ts';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
|
||||
const APP_METADATA_KEY_PREFIX = 'webUI_';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { Metadata, IReaderSettings, MetadataKeyValuePair, GqlMetaHolder, TManga } from '@/typings';
|
||||
import requestManager from '@/lib/requests/RequestManager.ts';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import {
|
||||
convertFromGqlMeta,
|
||||
getMetadataFrom,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { Metadata, ISearchSettings } from '@/typings';
|
||||
import requestManager from '@/lib/requests/RequestManager.ts';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { convertFromGqlMeta, getMetadataFrom } from '@/util/metadata';
|
||||
|
||||
export const getDefaultSettings = (): ISearchSettings => ({
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { NavigationType, useLocation, useNavigationType } from 'react-router-dom';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const useHistory = () => {
|
||||
const location = useLocation();
|
||||
const navigationType = useNavigationType();
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
|
||||
import { useState, Dispatch, SetStateAction, useReducer, Reducer, useCallback } from 'react';
|
||||
import storage from '@/util/localStorage';
|
||||
import * as storage from '@/util/localStorage';
|
||||
|
||||
export default function useLocalStorage<T>(key: string, defaultValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>] {
|
||||
export function useLocalStorage<T>(key: string, defaultValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>] {
|
||||
const initialState = defaultValue instanceof Function ? defaultValue() : defaultValue;
|
||||
const [storedValue, setStoredValue] = useState<T>(storage.getItem(key, initialState));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user