Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Jul 31, 2023
1 parent 488aa58 commit 447652e
Show file tree
Hide file tree
Showing 69 changed files with 158 additions and 138 deletions.
2 changes: 1 addition & 1 deletion apps/guide/src/app/_global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Providers } from './providers';
import { inter } from '~/util/fonts';

export default function GlobalError({ error }: { error: Error }) {
export default function GlobalError({ error }: { readonly error: Error }) {
console.error(error);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/guide/src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

export default function Error({ error }: { error: Error }) {
export default function Error({ error }: { readonly error: Error }) {
console.error(error);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/guide/src/app/guide/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function generateStaticParams() {
return allContents.map((content) => ({ slug: [content.slug] }));
}

export default function Page({ params }: { params: { slug: string[] } }) {
export default function Page({ params }: { readonly params: { slug: string[] } }) {
const content = allContents.find((content) => content.slug === params.slug?.join('/'));

if (!content) {
Expand Down
8 changes: 4 additions & 4 deletions apps/guide/src/components/DiscordAPITypesLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ interface DiscordAPITypesLinkOptions {
*
* @example `'RESTJSONErrorCodes'`
*/
parent?: string;
readonly parent?: string;
/**
* The scope of where this link lives.
*
* @remarks API does not have a scope.
*/
scope?: 'gateway' | 'globals' | 'payloads' | 'rest' | 'rpc' | 'utils' | 'voice';
readonly scope?: 'gateway' | 'globals' | 'payloads' | 'rest' | 'rpc' | 'utils' | 'voice';
/**
* The symbol belonging to the parent.
*
* @example '`MaximumNumberOfGuildsReached'`
*/
symbol?: string;
readonly symbol?: string;
/**
* The type of the {@link DiscordAPITypesLinkOptions.parent}.
*
* @example `'enum'`
* @example `'interface'`
*/
type?: string;
readonly type?: string;
}

export function DiscordAPITypesLink({
Expand Down
12 changes: 6 additions & 6 deletions apps/guide/src/components/DocsLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ interface DocsLinkOptions {
*
* @remarks Functions automatically infer this.
*/
brackets?: boolean;
readonly brackets?: boolean;
/**
* The package.
*
* @defaultValue `'discord.js'`
*/
package?: (typeof PACKAGES)[number];
readonly package?: (typeof PACKAGES)[number];
/**
* The initial documentation class, function, interface etc.
*
* @example `'Client'`
*/
parent?: string;
readonly parent?: string;
/**
* Whether to reference a static property.
*
* @remarks
* This should only be used for the https://discord.js.org domain
* as static properties are not identified in the URL.
*/
static?: boolean;
readonly static?: boolean;
/**
* The symbol belonging to the parent.
*
* @example '`login'`
*/
symbol?: string;
readonly symbol?: string;
/**
* The type of the {@link DocsLinkOptions.parent}.
*
* @example `'class'`
* @example `'Function'`
*/
type?: string;
readonly type?: string;
}

export function DocsLink({
Expand Down
2 changes: 1 addition & 1 deletion apps/guide/src/components/Mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { H4 } from './H4';
import { DocsLink } from '~/components/DocsLink';
import { ResultingCode } from '~/components/ResultingCode';

export function Mdx({ code }: { code: string }) {
export function Mdx({ code }: { readonly code: string }) {
const Component = useMDXComponent(code);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/guide/src/components/Outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const LINK_HEIGHT = 30;
const INDICATOR_SIZE = 10;
const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2;

export function Outline({ headings }: { headings: any[] }) {
export function Outline({ headings }: { readonly headings: any[] }) {
// eslint-disable-next-line react/hook-use-state
const [active /* setActive */] = useState(0);

Expand Down
10 changes: 9 additions & 1 deletion apps/guide/src/components/PageButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export function PageButton({ url, title, direction }: { direction: 'next' | 'prev'; title: string; url: string }) {
export function PageButton({
url,
title,
direction,
}: {
readonly direction: 'next' | 'prev';
readonly title: string;
readonly url: string;
}) {
return (
<a
className="flex flex-row flex-col transform-gpu cursor-pointer select-none appearance-none place-items-center gap-2 rounded bg-light-600 px-4 py-3 leading-none no-underline outline-none active:translate-y-px active:bg-light-800 dark:bg-dark-600 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-400 dark:hover:bg-dark-500"
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/_global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const metadata: Metadata = {
},
};

export default function GlobalError({ error }: { error: Error }) {
export default function GlobalError({ error }: { readonly error: Error }) {
console.error(error);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function generateStaticParams({ params: { package: packageName, ver
}));
}

function Member({ member }: { member?: ApiItem }) {
function Member({ member }: { readonly member?: ApiItem }) {
switch (member?.kind) {
case 'Class':
return <Class clazz={member as ApiClass} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

export default function Error({ error }: { error: Error }) {
export default function Error({ error }: { readonly error: Error }) {
console.error(error);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

export default function Error({ error }: { error: Error }) {
export default function Error({ error }: { readonly error: Error }) {
console.error(error);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/Anchor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FiLink } from '@react-icons/all-files/fi/FiLink';

export function Anchor({ href }: { href: string }) {
export function Anchor({ href }: { readonly href: string }) {
return (
<a className="mr-1 inline-block rounded outline-none focus:ring focus:ring-width-2 focus:ring-blurple" href={href}>
<FiLink size={20} />
Expand Down
7 changes: 5 additions & 2 deletions apps/website/src/components/Badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export enum BadgeColor {
Warning = 'bg-yellow-500',
}

export function Badge({ children, color = BadgeColor.Primary }: PropsWithChildren<{ color?: BadgeColor | undefined }>) {
export function Badge({
children,
color = BadgeColor.Primary,
}: PropsWithChildren<{ readonly color?: BadgeColor | undefined }>) {
return (
<span
className={`h-5 flex flex-row place-content-center place-items-center rounded-full px-3 text-center text-xs font-semibold uppercase text-white ${color}`}
Expand All @@ -18,7 +21,7 @@ export function Badge({ children, color = BadgeColor.Primary }: PropsWithChildre
);
}

export function Badges({ item }: { item: ApiDocumentedItem }) {
export function Badges({ item }: { readonly item: ApiDocumentedItem }) {
const isStatic = ApiStaticMixin.isBaseClassOf(item) && item.isStatic;
const isProtected = ApiProtectedMixin.isBaseClassOf(item) && item.isProtected;
const isReadonly = ApiReadonlyMixin.isBaseClassOf(item) && item.isReadonly;
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/components/CodeHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export interface CodeListingProps {
/**
* The value of this heading.
*/
children: ReactNode;
readonly children: ReactNode;
/**
* Additional class names to apply to the root element.
*/
className?: string | undefined;
readonly className?: string | undefined;
/**
* The href of this heading.
*/
href?: string | undefined;
readonly href?: string | undefined;
}

export function CodeHeading({ href, className, children }: CodeListingProps) {
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/components/ExcerptText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export interface ExcerptTextProps {
/**
* The tokens to render.
*/
excerpt: Excerpt;
readonly excerpt: Excerpt;
/**
* The model to resolve item references from.
*/
model: ApiModel;
readonly model: ApiModel;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/InheritanceText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ApiDeclaredItem } from '@microsoft/api-extractor-model';
import { ItemLink } from './ItemLink';
import { resolveItemURI } from './documentation/util';

export function InheritanceText({ parent }: { parent: ApiDeclaredItem }) {
export function InheritanceText({ parent }: { readonly parent: ApiDeclaredItem }) {
return (
<span className="font-semibold">
Inherited from{' '}
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/components/ItemLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ export interface ItemLinkProps
extends Omit<LinkProps, 'href'>,
RefAttributes<HTMLAnchorElement>,
Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> {
className?: string;
readonly className?: string;

/**
* The URI of the api item to link to. (e.g. `/RestManager`)
*/
itemURI: string;
readonly itemURI: string;

/**
* The name of the package the item belongs to.
*/
packageName?: string | undefined;
readonly packageName?: string | undefined;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useNav } from '~/contexts/nav';
const PackageSelect = dynamic(async () => import('./PackageSelect'));
const VersionSelect = dynamic(async () => import('./VersionSelect'));

export function Nav({ members }: { members: SidebarSectionItemData[] }) {
export function Nav({ members }: { readonly members: SidebarSectionItemData[] }) {
const { opened } = useNav();

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/Outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Scrollbars } from './Scrollbars';
import type { TableOfContentsSerialized } from './TableOfContentItems';
import { TableOfContentItems } from './TableOfContentItems';

export function Outline({ members }: { members: TableOfContentsSerialized[] }) {
export function Outline({ members }: { readonly members: TableOfContentsSerialized[] }) {
return (
<aside className="fixed bottom-0 right-0 top-[50px] z-20 hidden h-[calc(100vh_-_65px)] w-64 border-l border-light-800 bg-white pr-2 xl:block dark:border-dark-100 dark:bg-dark-600">
<Scrollbars
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/OverloadSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function OverloadSwitcher({
methodName,
overloads,
children,
}: PropsWithChildren<{ methodName: string; overloads: ReactNode[] }>) {
}: PropsWithChildren<{ readonly methodName: string; readonly overloads: ReactNode[] }>) {
const [hash, setHash] = useState(() => (typeof window === 'undefined' ? '' : window.location.hash));
const hashChangeHandler = useCallback(() => {
setHash(window.location.hash);
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/ParameterTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const columnStyles = {
Type: 'font-mono whitespace-pre-wrap break-normal',
};

export function ParameterTable({ item }: { item: ApiDocumentedItem & ApiParameterListMixin }) {
export function ParameterTable({ item }: { readonly item: ApiDocumentedItem & ApiParameterListMixin }) {
const params = resolveParameters(item);

const rows = useMemo(
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/components/Property.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function Property({
children,
inheritedFrom,
}: PropsWithChildren<{
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
item: ApiProperty | ApiPropertySignature;
readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
readonly item: ApiProperty | ApiPropertySignature;
}>) {
const hasSummary = Boolean(item.tsdocComment?.summarySection);

Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/PropertyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function isPropertyLike(item: ApiItem): item is ApiProperty | ApiProperty
return item.kind === ApiItemKind.Property || item.kind === ApiItemKind.PropertySignature;
}

export function PropertyList({ item }: { item: ApiItemContainerMixin }) {
export function PropertyList({ item }: { readonly item: ApiItemContainerMixin }) {
const members = resolveMembers(item, isPropertyLike);

const propertyItems = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function resolveIcon(item: string) {
}
}

export function Sidebar({ members }: { members: SidebarSectionItemData[] }) {
export function Sidebar({ members }: { readonly members: SidebarSectionItemData[] }) {
const segment = useSelectedLayoutSegment();
const { setOpened } = useNav();

Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/SignatureText.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ApiModel, Excerpt } from '@microsoft/api-extractor-model';
import { ExcerptText } from './ExcerptText';

export function SignatureText({ excerpt, model }: { excerpt: Excerpt; model: ApiModel }) {
export function SignatureText({ excerpt, model }: { readonly excerpt: Excerpt; readonly model: ApiModel }) {
return (
<h4 className="break-all text-lg font-bold font-mono">
<ExcerptText excerpt={excerpt} model={model} />
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export function Table({
columns,
columnStyles,
}: {
columnStyles?: Record<string, string>;
columns: string[];
rows: Record<string, ReactNode>[];
readonly columnStyles?: Record<string, string>;
readonly columns: string[];
readonly rows: Record<string, ReactNode>[];
}) {
const cols = useMemo(
() =>
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/components/TableOfContentItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export interface TableOfContentsSerializedProperty {
export type TableOfContentsSerialized = TableOfContentsSerializedMethod | TableOfContentsSerializedProperty;

export interface TableOfContentsItemProps {
serializedMembers: TableOfContentsSerialized[];
readonly serializedMembers: TableOfContentsSerialized[];
}

export function TableOfContentsPropertyItem({ property }: { property: TableOfContentsSerializedProperty }) {
export function TableOfContentsPropertyItem({ property }: { readonly property: TableOfContentsSerializedProperty }) {
return (
<a
className="ml-[10px] border-l border-light-800 p-[5px] pl-6.5 text-sm outline-none focus:border-0 dark:border-dark-100 focus:rounded active:bg-light-800 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-100 dark:hover:bg-dark-200"
Expand All @@ -35,7 +35,7 @@ export function TableOfContentsPropertyItem({ property }: { property: TableOfCon
);
}

export function TableOfContentsMethodItem({ method }: { method: TableOfContentsSerializedMethod }) {
export function TableOfContentsMethodItem({ method }: { readonly method: TableOfContentsSerializedMethod }) {
if (method.overloadIndex && method.overloadIndex > 1) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/TypeParamTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const rowElements = {
Default: 'font-mono whitespace-pre break-normal',
};

export function TypeParamTable({ item }: { item: ApiTypeParameterListMixin }) {
export function TypeParamTable({ item }: { readonly item: ApiTypeParameterListMixin }) {
const model = item.getAssociatedModel()!;
const rows = useMemo(
() =>
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/documentation/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function Header({
kind,
name,
sourceURL,
}: PropsWithChildren<{ kind: ApiItemKind; name: string; sourceURL?: string | undefined }>) {
}: PropsWithChildren<{ readonly kind: ApiItemKind; readonly name: string; readonly sourceURL?: string | undefined }>) {
return (
<div className="flex flex-col">
<h2 className="flex flex-row place-items-center justify-between gap-2 break-all text-2xl font-bold">
Expand Down
Loading

2 comments on commit 447652e

@vercel
Copy link

@vercel vercel bot commented on 447652e Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 447652e Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.