Skip to content

Commit 1866027

Browse files
committed
lint fix
1 parent 4069cda commit 1866027

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

eslint.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { defineConfig, globalIgnores } from "eslint/config";
2-
import nextVitals from "eslint-config-next/core-web-vitals";
3-
import nextTypeScript from "eslint-config-next/typescript";
42
import unusedImports from "eslint-plugin-unused-imports";
53
import tseslint from "typescript-eslint";
64

src/app/(marketing)/solutions/components/SolutionsTableOfContents.tsx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,32 @@ export default function SolutionsTableOfContents({
3939

4040
if (intersectingEntries.length === 0) {
4141
// If nothing is intersecting, find the closest section above the viewport
42-
const allElements = solutions.map((solution) => {
43-
const solutionId = getSolutionId(
44-
solution.slug?.current || solution.title,
45-
);
46-
return document.getElementById(solutionId);
47-
}).filter(Boolean) as HTMLElement[];
42+
const allElements = solutions
43+
.map((solution) => {
44+
const solutionId = getSolutionId(
45+
solution.slug?.current || solution.title,
46+
);
47+
return document.getElementById(solutionId);
48+
})
49+
.filter((el): el is HTMLElement => el !== null);
4850

4951
const viewportTop = window.scrollY + 200; // Account for sticky header + TOC
5052
let closestElement: HTMLElement | null = null;
5153
let closestDistance = Infinity;
5254

53-
allElements.forEach((element) => {
55+
for (const element of allElements) {
5456
const elementTop = element.getBoundingClientRect().top + window.scrollY;
5557
const distance = Math.abs(elementTop - viewportTop);
5658

5759
if (elementTop <= viewportTop && distance < closestDistance) {
5860
closestDistance = distance;
5961
closestElement = element;
6062
}
61-
});
63+
}
6264

6365
if (closestElement) {
64-
setActiveId(closestElement.id);
66+
const elementId = closestElement.id;
67+
setActiveId(elementId);
6568
}
6669
return;
6770
}
@@ -99,18 +102,20 @@ export default function SolutionsTableOfContents({
99102

100103
// Also handle scroll events to update active state when clicking links
101104
const handleScroll = () => {
102-
const allElements = solutions.map((solution) => {
103-
const solutionId = getSolutionId(
104-
solution.slug?.current || solution.title,
105-
);
106-
return document.getElementById(solutionId);
107-
}).filter(Boolean) as HTMLElement[];
105+
const allElements = solutions
106+
.map((solution) => {
107+
const solutionId = getSolutionId(
108+
solution.slug?.current || solution.title,
109+
);
110+
return document.getElementById(solutionId);
111+
})
112+
.filter((el): el is HTMLElement => el !== null);
108113

109114
const viewportTop = window.scrollY + 200;
110115
let activeElement: HTMLElement | null = null;
111116
let minDistance = Infinity;
112117

113-
allElements.forEach((element) => {
118+
for (const element of allElements) {
114119
const rect = element.getBoundingClientRect();
115120
const elementTop = rect.top + window.scrollY;
116121
const distance = Math.abs(elementTop - viewportTop);
@@ -120,10 +125,11 @@ export default function SolutionsTableOfContents({
120125
minDistance = distance;
121126
activeElement = element;
122127
}
123-
});
128+
}
124129

125130
if (activeElement) {
126-
setActiveId(activeElement.id);
131+
const elementId = activeElement.id;
132+
setActiveId(elementId);
127133
}
128134
};
129135

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"moduleResolution": "bundler",
1616
"resolveJsonModule": true,
1717
"isolatedModules": true,
18-
"jsx": "preserve",
18+
"jsx": "react-jsx",
1919
"incremental": true,
2020
"plugins": [
2121
{

0 commit comments

Comments
 (0)