Don't break build on unused import (#1046)

* Fix lint warnings

* Let vercel build when unused import
This commit is contained in:
Sinclair Chen 2022-10-13 18:16:22 -07:00 committed by GitHub
parent 7a6725ee77
commit c044460a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 4 deletions

View File

@ -26,7 +26,7 @@ module.exports = {
caughtErrorsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_',
}, },
], ],
'unused-imports/no-unused-imports': 'error', 'unused-imports/no-unused-imports': 'warn',
}, },
}, },
], ],

View File

@ -26,7 +26,7 @@ module.exports = {
caughtErrorsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_',
}, },
], ],
'unused-imports/no-unused-imports': 'error', 'unused-imports/no-unused-imports': 'warn',
}, },
}, },
], ],

View File

@ -22,8 +22,9 @@ module.exports = {
'@next/next/no-typos': 'off', '@next/next/no-typos': 'off',
'linebreak-style': ['error', 'unix'], 'linebreak-style': ['error', 'unix'],
'lodash/import-scope': [2, 'member'], 'lodash/import-scope': [2, 'member'],
'unused-imports/no-unused-imports': 'error', 'unused-imports/no-unused-imports': 'warn',
}, },
ignorePatterns: ['/public/mtg/*'],
env: { env: {
browser: true, browser: true,
node: true, node: true,

View File

@ -114,6 +114,7 @@ export const usePersistentState = <T>(
if (key != null && store != null) { if (key != null && store != null) {
store.set(key, state) store.set(key, state)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [key, state]) }, [key, state])
if (store?.readsUrl) { if (store?.readsUrl) {
@ -127,6 +128,7 @@ export const usePersistentState = <T>(
const savedValue = key != null ? store.get(key) : undefined const savedValue = key != null ? store.get(key) : undefined
setState(savedValue ?? initial) setState(savedValue ?? initial)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [router.isReady]) }, [router.isReady])
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { isEmpty } from 'lodash' import { isEmpty } from 'lodash'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
@ -12,7 +13,7 @@ type PropzProps = {
// This allows us to client-side render the page for authenticated users. // This allows us to client-side render the page for authenticated users.
// TODO: Could cache the result using stale-while-revalidate: https://swr.vercel.app/ // TODO: Could cache the result using stale-while-revalidate: https://swr.vercel.app/
export function usePropz( export function usePropz(
initialProps: Object, initialProps: Record<string, unknown>,
getStaticPropz: (props: PropzProps) => Promise<any> getStaticPropz: (props: PropzProps) => Promise<any>
) { ) {
// If props were successfully server-side generated, just use those // If props were successfully server-side generated, just use those
@ -29,6 +30,7 @@ export function usePropz(
if (router.isReady) { if (router.isReady) {
getStaticPropz({ params }).then((result) => setPropz(result.props)) getStaticPropz({ params }).then((result) => setPropz(result.props))
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [params]) }, [params])
return propz return propz
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const defaultTheme = require('tailwindcss/defaultTheme') const defaultTheme = require('tailwindcss/defaultTheme')
const plugin = require('tailwindcss/plugin') const plugin = require('tailwindcss/plugin')