Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
mbifulco committed Jan 4, 2025
1 parent 4a98df8 commit dafba59
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/hooks/useLocalStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const getLocalStorageServerSnapshot = () => {

export function useLocalStorage<T>(key: string, initialValue: T) {
const getSnapshot = () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const stored = JSON.parse(getLocalStorageItem(key) ?? '');
return JSON.stringify({
...initialValue,
Expand All @@ -51,11 +50,8 @@ export function useLocalStorage<T>(key: string, initialValue: T) {
const setState = useCallback(
(v: unknown) => {
try {
/* eslint-disable @typescript-eslint/no-unsafe-call */
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const nextState =
typeof v === 'function' ? v(JSON.parse(store || '{}')) : v;
/* eslint-enable @typescript-eslint/no-unsafe-call */

if (nextState === undefined || nextState === null) {
removeLocalStorageItem(key);
Expand Down

0 comments on commit dafba59

Please sign in to comment.