M: Minor dev fixes

This commit is contained in:
Ivan 2025-11-06 16:19:48 +03:00
parent 6cfc695bbe
commit c15edd2d84
4 changed files with 18 additions and 15 deletions

View File

@ -72,7 +72,6 @@ export default [
settings: { react: { version: 'detect' } }, settings: { react: { version: 'detect' } },
rules: { rules: {
...basicRules, ...basicRules,
'react-refresh/only-export-components': ['off', { allowConstantExport: true }],
'simple-import-sort/imports': [ 'simple-import-sort/imports': [
'warn', 'warn',
{ {

View File

@ -10,7 +10,7 @@ export function GlobalProviders({ children }: React.PropsWithChildren) {
<IntlProvider locale='ru' defaultLocale='ru'> <IntlProvider locale='ru' defaultLocale='ru'>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<ReactQueryDevtools initialIsOpen={false} /> {import.meta.env.DEV ? <ReactQueryDevtools initialIsOpen={false} /> : null}
{children} {children}
</QueryClientProvider> </QueryClientProvider>

View File

@ -70,7 +70,9 @@ export function DescribeError({ error }: { error: ErrorData }) {
let sanitizedHtml: string | null = null; let sanitizedHtml: string | null = null;
if (isHtml) { if (isHtml) {
sanitizedHtml = DOMPurify.sanitize(error.response.data as string, { sanitizedHtml = DOMPurify.sanitize(error.response.data as string, {
USE_PROFILES: { html: true } USE_PROFILES: { html: true },
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'ul', 'li', 'br'],
ALLOWED_ATTR: []
}); });
} }
return ( return (

View File

@ -5,7 +5,7 @@ import { App } from './app';
import './index.css'; import './index.css';
if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_ENV === 'development') { if (typeof window !== 'undefined' && import.meta.env.DEV) {
void import('react-scan').then(module => void import('react-scan').then(module =>
module.scan({ module.scan({
enabled: true enabled: true
@ -13,7 +13,8 @@ if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_
); );
} }
window.addEventListener('error', (event: ErrorEvent) => { if (typeof window !== 'undefined') {
window.addEventListener('error', (event: ErrorEvent) => {
const error = event.error as Error; const error = event.error as Error;
if ( if (
error instanceof Error && error instanceof Error &&
@ -23,7 +24,8 @@ window.addEventListener('error', (event: ErrorEvent) => {
console.warn('Detected stale bundle — reloading...'); console.warn('Detected stale bundle — reloading...');
window.location.reload(); window.location.reload();
} }
}); });
}
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<GlobalProviders> <GlobalProviders>