From da1574169a764aadb484aaf15aaa07dc56cdef13 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Wed, 8 Jan 2025 22:44:01 -0600 Subject: [PATCH] lint for stray console.logs --- .eslintrc.cjs | 2 ++ app/api/hooks.ts | 2 +- app/api/window.ts | 2 +- app/forms/image-upload.tsx | 2 +- app/msw-mock-api.ts | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 396b301225..fdea7f935f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -70,6 +70,8 @@ module.exports = { 'import/no-default-export': 'error', 'import/no-unresolved': 'off', // plugin doesn't know anything 'jsx-a11y/label-has-associated-control': [2, { controlComponents: ['button'] }], + // only worry about console.log + 'no-console': ['error', { allow: ['warn', 'error', 'info', 'table'] }], 'no-param-reassign': 'error', 'no-restricted-imports': [ 'error', diff --git a/app/api/hooks.ts b/app/api/hooks.ts index 23a374c54a..66773b0120 100644 --- a/app/api/hooks.ts +++ b/app/api/hooks.ts @@ -346,7 +346,7 @@ export const wrapQueryClient = (api: A, queryClient: QueryC // directly without further processing throw data } - console.log(options.explanation) + console.info(options.explanation) return { type: 'error' as const, data } }), ...options, diff --git a/app/api/window.ts b/app/api/window.ts index 0a983f1896..72e910e41d 100644 --- a/app/api/window.ts +++ b/app/api/window.ts @@ -34,7 +34,7 @@ function handleResult(result: ApiResult): T { } function logHeading(s: string) { - console.log(`%c${s}`, 'font-size: 16px; font-weight: bold;') + console.info(`%c${s}`, 'font-size: 16px; font-weight: bold;') } if (typeof window !== 'undefined') { diff --git a/app/forms/image-upload.tsx b/app/forms/image-upload.tsx index 0b85ba3361..9a77b95dd6 100644 --- a/app/forms/image-upload.tsx +++ b/app/forms/image-upload.tsx @@ -515,7 +515,7 @@ export function Component() { .catch((e) => { // eat a 404 since that's what we want. anything else should still blow up if (e.statusCode === 404) { - console.log( + console.info( '/v1/images 404 is expected. It means the image name is not taken.' ) return null diff --git a/app/msw-mock-api.ts b/app/msw-mock-api.ts index fe8ac25847..2aa6fc5b61 100644 --- a/app/msw-mock-api.ts +++ b/app/msw-mock-api.ts @@ -15,7 +15,7 @@ function getChaos() { const chaos = getChaos() if (process.env.NODE_ENV !== 'production' && chaos) { - console.log(` + console.info(` ▄████████ ▄█ █▄ ▄████████ ▄██████▄ ▄████████ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ █▀ ███ ███ ███ ███ ███ ███ ███ █▀ @@ -34,7 +34,7 @@ if (process.env.NODE_ENV !== 'production' && chaos) { ███ ███ ███ ███ ███ ███ ▄███ ███ ███ ▀█ ███ █▀ ▀██████▀ ████████▀ ██████████ `) - console.log(`Running MSW in CHAOS MODE with ${chaos}% likelihood of random failure`) + console.info(`Running MSW in CHAOS MODE with ${chaos}% likelihood of random failure`) } /** Return true for failure with a given likelihood */