Skip to content

chore(website): use Docusaurus Link component, fix broken link #6448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/website/src/components/ErrorsViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from '@docusaurus/Link';
import IconExternalLink from '@theme/Icon/ExternalLink';
import clsx from 'clsx';
import type Monaco from 'monaco-editor';
Expand Down Expand Up @@ -134,9 +135,9 @@ export default function ErrorsViewer({
{uri && (
<>
{' - '}
<a href={uri} target="_blank">
<Link href={uri} target="_blank">
docs <IconExternalLink width={13.5} height={13.5} />
</a>
</Link>
</>
)}
</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from '@docusaurus/Link';
import React from 'react';

import styles from './styles.module.css';
Expand All @@ -21,14 +22,13 @@ export function Sponsor({ includeName, sponsor }: SponsorProps): JSX.Element {
}

return (
<a
<Link
className={styles.sponsorLink}
href={sponsor.website ?? undefined}
title={sponsor.name}
target="_blank"
rel="noopener sponsored"
>
{children}
</a>
</Link>
);
}
13 changes: 7 additions & 6 deletions packages/website/src/components/ast/PropertyName.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from '@docusaurus/Link';
import type { MouseEvent } from 'react';
import React, { useCallback } from 'react';

Expand Down Expand Up @@ -32,27 +33,27 @@ export default function PropertyName(props: PropertyNameProps): JSX.Element {
return props.onClick || props.onHover ? (
<>
{props.propName && (
<a
href={`#${props.propName}`}
<Link
to={`#${props.propName}`}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onClick={onClick}
className={styles.propName}
>
{props.propName}
</a>
</Link>
)}
{props.propName && <span>: </span>}
{props.typeName && (
<a
href={`#${props.typeName}`}
<Link
to={`#${props.typeName}`}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onClick={onClick}
className={styles.tokenName}
>
{props.typeName}
</a>
</Link>
)}
{props.typeName && <span> </span>}
</>
Expand Down
30 changes: 11 additions & 19 deletions packages/website/src/theme/MDXComponents/RuleAttributes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from '@docusaurus/Link';
import type { RuleMetaDataDocs } from '@site/../utils/dist/ts-eslint/Rule';
import { useRulesMeta } from '@site/src/hooks/useRulesMeta';
import React from 'react';
Expand Down Expand Up @@ -29,18 +30,15 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode {
children: (
<>
Extending{' '}
<a href={`/docs/linting/configs#${recommendation}`} target="_blank">
<Link to={`/linting/configs#${recommendation}`} target="_blank">
<code className={styles.code}>
"plugin:@typescript-eslint/{recommendation}"
</code>
</a>{' '}
</Link>{' '}
in an{' '}
<a
href="https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files"
target="_blank"
>
<Link href="https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files">
ESLint configuration
</a>{' '}
</Link>{' '}
enables this rule.
</>
),
Expand All @@ -53,12 +51,9 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode {
children: (
<>
Some problems reported by this rule are automatically fixable by the{' '}
<a
href="https://eslint.org/docs/latest/user-guide/command-line-interface#--fix"
target="_blank"
>
<Link href="https://eslint.org/docs/latest/user-guide/command-line-interface#--fix">
<code>--fix</code> ESLint command line option
</a>
</Link>
.
</>
),
Expand All @@ -71,12 +66,9 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode {
children: (
<>
Some problems reported by this rule are manually fixable by editor{' '}
<a
href="https://eslint.org/docs/latest/developer-guide/working-with-rules#providing-suggestions"
target="_blank"
>
<Link href="https://eslint.org/docs/latest/developer-guide/working-with-rules#providing-suggestions">
suggestions
</a>
</Link>
.
</>
),
Expand All @@ -89,9 +81,9 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode {
children: (
<>
This rule requires{' '}
<a href="/linting/typed-linting" target="_blank">
<Link href="/linting/typed-linting" target="_blank">
type information
</a>{' '}
</Link>{' '}
to run.
</>
),
Expand Down
7 changes: 4 additions & 3 deletions packages/website/src/theme/MDXComponents/TryInPlayground.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from '@docusaurus/Link';
import React from 'react';

import styles from './TryInPlayground.module.css';
Expand All @@ -8,12 +9,12 @@ export function TryInPlayground({
eslintrcHash: string;
}): React.ReactNode {
return (
<a
<Link
className={styles.tryInPlaygroundLink}
href={`/play#eslintrc=${eslintrcHash}`}
to={`/play#eslintrc=${eslintrcHash}`}
target="_blank"
>
Try this rule in the playground ↗
</a>
</Link>
);
}