diff --git a/.lintstagedrc.json b/.lintstagedrc.json index 2e53407bd..4134de919 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,5 +1,5 @@ { "*": "prettier --ignore-unknown --write", - "{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx,astro}": "eslint --ext .mjs,.js,.cjs,.ts,.tsx --fix", + "{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --ext .mjs,.js,.cjs,.ts,.tsx --fix", "src/**.ts": "vitest related --run --config ../../vitest.config.ts" } diff --git a/.vscode/settings.json b/.vscode/settings.json index 53daf1e1a..3eeabcc7c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "eslint.workingDirectories": [{ "pattern": "./apps/*" }, { "pattern": "./packages/*" }], - "eslint.validate": ["javascript", "javascriptreact", "astro", "typescript", "typescriptreact"], + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { diff --git a/apps/guide/src/components/Outline.tsx b/apps/guide/src/components/Outline.tsx index f6034a082..ab5889d7f 100644 --- a/apps/guide/src/components/Outline.tsx +++ b/apps/guide/src/components/Outline.tsx @@ -1,16 +1,13 @@ -import type { MarkdownHeading } from 'astro'; -import { useEffect, useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { Scrollbars } from 'react-custom-scrollbars-2'; -import { VscListSelection } from 'react-icons/vsc'; -import { useLocation } from 'react-use'; const LINK_HEIGHT = 30; const INDICATOR_SIZE = 10; const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2; -export function Outline({ headings }: { headings: MarkdownHeading[] }) { - const state = useLocation(); - const [active, setActive] = useState(0); +export function Outline({ headings }: { headings: any[] }) { + // eslint-disable-next-line react/hook-use-state + const [active /* setActive */] = useState(0); const headingItems = useMemo( () => @@ -32,12 +29,12 @@ export function Outline({ headings }: { headings: MarkdownHeading[] }) { [headings, active], ); - useEffect(() => { - const idx = headings.findIndex((heading) => heading.slug === state.hash?.slice(1)); - if (idx >= 0) { - setActive(idx); - } - }, [state, headings]); + // useEffect(() => { + // const idx = headings.findIndex((heading) => heading.slug === state.hash?.slice(1)); + // if (idx >= 0) { + // setActive(idx); + // } + // }, [state, headings]); return (
- + {/* */} Contents