ESLint --fix: auto-fix brace-style, indent, semi, no-trailing-spaces

Run eslint --fix across src/ to clear ~1900 mechanical lint errors
surfaced by the @typescript-eslint v8 + react-hooks v7 + react-compiler
upgrade in the React 19 modernization PR.

Issues fixed automatically:
- brace-style (Allman): try/catch one-liners reformatted to multi-line
- indent: tab-vs-space and depth corrections
- semi: missing trailing semicolons
- no-trailing-spaces

No semantic changes. Remaining 701 errors are real-code issues
(set-state-in-effect, rules-of-hooks, no-unsafe-* type checks) that
need manual per-file review.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
This commit is contained in:
simoleo89
2026-05-11 16:31:50 +00:00
parent 1b1e0c18bf
commit 535fa71020
115 changed files with 2217 additions and 1524 deletions
+43 -20
View File
@@ -9,8 +9,10 @@ interface AdsenseConfig {
fullWidthResponsive?: boolean;
}
const parsePublisherIdFromAdsTxt = (text: string): string | null => {
for (const rawLine of text.split(/\r?\n/)) {
const parsePublisherIdFromAdsTxt = (text: string): string | null =>
{
for (const rawLine of text.split(/\r?\n/))
{
const line = rawLine.split('#')[0].trim();
if (!line) continue;
const parts = line.split(',').map(part => part.trim());
@@ -22,7 +24,8 @@ const parsePublisherIdFromAdsTxt = (text: string): string | null => {
return null;
};
export const GoogleAdsView: FC<{}> = () => {
export const GoogleAdsView: FC<{}> = () =>
{
const adsEnabled = GetConfigurationValue<boolean>('show.google.ads', false);
const [ isOpen, setIsOpen ] = useState(false);
const [ publisherId, setPublisherId ] = useState<string | null>(null);
@@ -32,7 +35,8 @@ export const GoogleAdsView: FC<{}> = () => {
const pushedRef = useRef(false);
const autoOpenedRef = useRef(false);
useEffect(() => {
useEffect(() =>
{
if (!adsEnabled) return;
const handler = () => setIsOpen(prev => !prev);
window.addEventListener('ads:toggle', handler);
@@ -42,7 +46,8 @@ export const GoogleAdsView: FC<{}> = () => {
// Auto-open once on initial mount (the login / landing stage).
// Subsequent toggles are driven by the "ads:toggle" window event
// (e.g. the Show Ad button in NitroSystemAlertView).
useEffect(() => {
useEffect(() =>
{
if (!adsEnabled) return;
if (autoOpenedRef.current) return;
autoOpenedRef.current = true;
@@ -50,11 +55,14 @@ export const GoogleAdsView: FC<{}> = () => {
return () => clearTimeout(t);
}, [ adsEnabled ]);
useEffect(() => {
useEffect(() =>
{
let cancelled = false;
(async () => {
try {
(async () =>
{
try
{
const [ adsTxtRes, configRes ] = await Promise.all([
fetch('/ads.txt', { cache: 'no-cache' }),
fetch(configFileUrl('adsense.json', true), { cache: 'no-cache' })
@@ -73,39 +81,54 @@ export const GoogleAdsView: FC<{}> = () => {
if (cancelled) return;
setPublisherId(pubId);
setConfig(cfg);
} catch (err) {
}
catch (err)
{
if (!cancelled) setLoadError((err as Error).message);
}
})();
return () => { cancelled = true; };
return () =>
{
cancelled = true;
};
}, []);
useEffect(() => {
if (!isOpen) {
useEffect(() =>
{
if (!isOpen)
{
pushedRef.current = false;
return;
}
if (!insRef.current || pushedRef.current) return;
if (!publisherId || !config?.slot) return;
const tryPush = () => {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const tryPush = () =>
{
try
{
const w = window as any;
w.adsbygoogle = w.adsbygoogle || [];
w.adsbygoogle.push({});
pushedRef.current = true;
} catch {
}
catch
{
// AdSense script may not be ready yet; retry once
setTimeout(() => {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setTimeout(() =>
{
try
{
const w = window as any;
w.adsbygoogle = w.adsbygoogle || [];
w.adsbygoogle.push({});
pushedRef.current = true;
} catch { /* give up */ }
}
catch
{ /* give up */ }
}, 500);
}
};