From 713530cae3fb34ed3bac5c1a8ddc131f816269a3 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Tue, 30 Jul 2024 21:53:26 +0800 Subject: [PATCH] disable annoying warnings --- src/renderer/src/main.tsx | 6 +++--- src/renderer/src/utils/init.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/renderer/src/utils/init.ts diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx index 790a28e..d3d4a7e 100644 --- a/src/renderer/src/main.tsx +++ b/src/renderer/src/main.tsx @@ -3,9 +3,9 @@ import ReactDOM from 'react-dom/client' import { BrowserRouter } from 'react-router-dom' import { ThemeProvider as NextThemesProvider } from 'next-themes' import { NextUIProvider } from '@nextui-org/react' - -import App from './App' -import './assets/main.css' +import '@renderer/utils/init' +import '@renderer/assets/main.css' +import App from '@renderer/App' ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( diff --git a/src/renderer/src/utils/init.ts b/src/renderer/src/utils/init.ts new file mode 100644 index 0000000..63ed9d3 --- /dev/null +++ b/src/renderer/src/utils/init.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +const originError = console.error +const originWarn = console.warn +console.error = function (...args: any[]): void { + if (typeof args[0] === 'string' && args[0].includes('validateDOMNesting')) { + return + } + originError.call(console, args) +} +console.warn = function (...args): void { + if (typeof args[0] === 'string' && args[0].includes('aria-label')) { + return + } + originWarn.call(console, args) +}