style: fix up lint

This commit is contained in:
iCrawl
2023-12-19 14:45:28 +01:00
parent 171cb182ed
commit d869d9b3fe
18 changed files with 44 additions and 44 deletions

View File

@@ -28,7 +28,7 @@ import { OVERLOAD_SEPARATOR } from '~/util/constants';
import { fetchMember } from '~/util/fetchMember';
import { findMember } from '~/util/model';
export const revalidate = 3_600;
export const revalidate = 86_400;
export interface ItemRouteParams {
item: string;

View File

@@ -12,7 +12,7 @@ import { resolveItemURI } from '~/components/documentation/util';
import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants';
import { Providers } from './providers';
export const revalidate = 3_600;
export const revalidate = 0;
const Header = dynamic(async () => import('~/components/Header'));
const Footer = dynamic(async () => import('~/components/Footer'));

View File

@@ -7,7 +7,7 @@ import { fetchVersions } from '~/app/docAPI';
import { buttonVariants } from '~/styles/Button';
import { PACKAGES } from '~/util/constants';
export const revalidate = 3_600;
export const revalidate = 86_400;
export default async function Page({ params }: { params: { package: string } }) {
if (!PACKAGES.includes(params.package)) {

View File

@@ -87,7 +87,7 @@ export function TSDoc({ item, tsdoc }: { readonly item: ApiItem; readonly tsdoc:
version={
resolved?.package
? // eslint-disable-next-line unicorn/better-regex
item.getAssociatedPackage()?.dependencies?.[resolved.package]?.replace(/[~^]/, '')
item.getAssociatedPackage()?.dependencies?.[resolved.package]?.replace(/[~^]/, '')
: undefined
}
>

View File

@@ -84,7 +84,7 @@ export class ApiCallSignature extends ApiTypeParameterListMixin(
const parent: DeclarationReference = this.parent
? this.parent.canonicalReference
: // .withMeaning() requires some kind of component
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
return parent.withMeaning(Meaning.CallSignature as any).withOverloadIndex(this.overloadIndex);
}
}

View File

@@ -97,7 +97,7 @@ export class ApiConstructSignature extends ApiTypeParameterListMixin(
const parent: DeclarationReference = this.parent
? this.parent.canonicalReference
: // .withMeaning() requires some kind of component
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
return parent.withMeaning(Meaning.ConstructSignature as any).withOverloadIndex(this.overloadIndex);
}
}

View File

@@ -75,7 +75,7 @@ export class ApiConstructor extends ApiParameterListMixin(ApiProtectedMixin(ApiR
const parent: DeclarationReference = this.parent
? this.parent.canonicalReference
: // .withMeaning() requires some kind of component
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
return parent.withMeaning(Meaning.Constructor as any).withOverloadIndex(this.overloadIndex);
}
}

View File

@@ -74,7 +74,7 @@ export class ApiIndexSignature extends ApiParameterListMixin(
const parent: DeclarationReference = this.parent
? this.parent.canonicalReference
: // .withMeaning() requires some kind of component
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
DeclarationReference.empty().addNavigationStep(Navigation.Members as any, '(parent)');
return parent.withMeaning(Meaning.IndexSignature as any).withOverloadIndex(this.overloadIndex);
}
}

View File

@@ -252,7 +252,7 @@ export class ApiNodeJSONEncoder {
parentKey: item.parent.containerKey,
parentName: item.parent.displayName,
path: generatePath(item.parent.getHierarchy(), version),
}
}
: null,
};
}

View File

@@ -64,7 +64,7 @@ export function generatePath(items: readonly ApiItem[], version: string) {
return path.includes('@discordjs/')
? path.replace(/@discordjs\/(?<package>.*)\/(?<member>.*)?/, `$<package>/${version}/$<member>`)
: path.replace(/(?<oackage>.*)\/(?<member>.*)?/, `$<package>/${version}/$<member>`);
: path.replace(/(?<package>.*)\/(?<member>.*)?/, `$<package>/${version}/$<member>`);
}
export function resolveDocComment(item: ApiDeclaredItem) {

View File

@@ -853,7 +853,7 @@ export class ExportAnalyzer {
? TypeScriptInternals.getModeForUsageLocation(
importOrExportDeclaration.getSourceFile(),
importOrExportDeclaration.moduleSpecifier,
)
)
: undefined;
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
importOrExportDeclaration.getSourceFile(),

View File

@@ -563,7 +563,7 @@ export class ApiModelGenerator {
?.map((param) => ` * @param ${param.name} - ${this._fixLinkTags(param.description) ?? ''}\n`)
.join('') ?? ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const isProtected: boolean = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
@@ -650,10 +650,10 @@ export class ApiModelGenerator {
jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const isAbstract: boolean = (ts.getCombinedModifierFlags(classDeclaration) & ts.ModifierFlags.Abstract) !== 0;
@@ -723,7 +723,7 @@ export class ApiModelGenerator {
?.map((param) => ` * @param ${param.name} - ${this._fixLinkTags(param.description) ?? ''}\n`)
.join('') ?? ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const sourceLocation: ISourceLocation = this._getSourceLocation(constructSignature);
@@ -861,10 +861,10 @@ export class ApiModelGenerator {
jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const sourceLocation: ISourceLocation = this._getSourceLocation(functionDeclaration);
@@ -983,10 +983,10 @@ export class ApiModelGenerator {
jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const sourceLocation: ISourceLocation = this._getSourceLocation(interfaceDeclaration);
@@ -1063,10 +1063,10 @@ export class ApiModelGenerator {
jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
if (releaseTag === ReleaseTag.Internal || releaseTag === ReleaseTag.Alpha) {
@@ -1155,10 +1155,10 @@ export class ApiModelGenerator {
jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const isOptional: boolean = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
@@ -1225,8 +1225,8 @@ export class ApiModelGenerator {
const isStatic: boolean = astDeclaration
? (astDeclaration.modifierFlags & ts.ModifierFlags.Static) !== 0
: parentApiItem.kind === ApiItemKind.Class || parentApiItem.kind === ApiItemKind.Interface
? (jsDoc as DocgenPropertyJson).scope === 'static'
: false;
? (jsDoc as DocgenPropertyJson).scope === 'static'
: false;
const containerKey: string = ApiProperty.getContainerKey(name, isStatic);
let apiProperty: ApiProperty | undefined = parentApiItem.tryGetMemberByKey(containerKey) as ApiProperty;
@@ -1266,10 +1266,10 @@ export class ApiModelGenerator {
'deprecated' in jsDoc && jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const isOptional: boolean = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
@@ -1341,10 +1341,10 @@ export class ApiModelGenerator {
'deprecated' in jsDoc && jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const isOptional: boolean = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
@@ -1420,7 +1420,7 @@ export class ApiModelGenerator {
.join('')
: ''
} */`,
).docComment
).docComment
: apiItemMetadata.tsdocComment;
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
const sourceLocation: ISourceLocation = this._getSourceLocation(typeAliasDeclaration);
@@ -1554,7 +1554,7 @@ export class ApiModelGenerator {
'deprecated' in jsDoc && jsDoc.deprecated
? ` * @deprecated ${
typeof jsDoc.deprecated === 'string' ? this._fixLinkTags(jsDoc.deprecated) : jsDoc.deprecated
}\n`
}\n`
: ''
} */`,
).docComment;

View File

@@ -164,7 +164,7 @@ export class Documentation {
file: member.sources?.[0]?.fileName,
line: member.sources?.[0]?.line,
path: dirname(member.sources?.[0]?.fileName ?? ''),
};
};
if (prop!.name) {
info.push(`member of "${prop!.name}"`);

View File

@@ -29,7 +29,7 @@ export class DocumentedConstructor extends DocumentedItem<Constructor | Declarat
params: signature.parameters
? (signature as SignatureReflection).parameters?.map((param) =>
new DocumentedParam(param, this.config).serialize(),
)
)
: undefined,
};
}

View File

@@ -71,7 +71,7 @@ export class DocumentedEvent extends DocumentedItem<DeclarationReflection | Even
},
this.config,
).serialize(),
]
]
: undefined,
returnsDescription:
signature.comment?.blockTags

View File

@@ -57,7 +57,7 @@ export class DocumentedMethod extends DocumentedItem<DeclarationReflection | Met
params: signature.parameters
? (signature as SignatureReflection).parameters?.map((param) =>
new DocumentedParam(param, this.config).serialize(),
)
)
: undefined,
returns: signature.type
? [
@@ -74,7 +74,7 @@ export class DocumentedMethod extends DocumentedItem<DeclarationReflection | Met
},
this.config,
).serialize(),
]
]
: undefined,
returnsDescription:
signature.comment?.blockTags
@@ -113,7 +113,7 @@ export class DocumentedMethod extends DocumentedItem<DeclarationReflection | Met
{ names: param.type.names, description: param.description, nullable: param.nullable },
this.config,
).serialize(),
)
)
: undefined,
meta: new DocumentedItemMeta(data.meta, this.config).serialize(),
};

View File

@@ -66,7 +66,7 @@ export class DocumentedTypeDef extends DocumentedItem<DeclarationReflection | Ty
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
.trim() || undefined,
type: [[[(child.type as LiteralType | undefined)?.value]]],
}))
}))
: undefined,
};
}
@@ -99,7 +99,7 @@ export class DocumentedTypeDef extends DocumentedItem<DeclarationReflection | Ty
type: child.type
? new DocumentedVarType({ names: [parseType(child.type)] }, this.config).serialize()
: child.kindString === 'Method'
? new DocumentedVarType(
? new DocumentedVarType(
{
names: [
parseType({
@@ -114,8 +114,8 @@ export class DocumentedTypeDef extends DocumentedItem<DeclarationReflection | Ty
.trim(),
},
this.config,
).serialize()
: undefined,
).serialize()
: undefined,
}));
return {
@@ -185,7 +185,7 @@ export class DocumentedTypeDef extends DocumentedItem<DeclarationReflection | Ty
},
this.config,
).serialize(),
]
]
: undefined,
returnsDescription:
sig?.comment?.blockTags

View File

@@ -93,10 +93,10 @@ export class DiscordAPIError extends Error {
const nextKey = otherKey.startsWith('_')
? key
: key
? Number.isNaN(Number(otherKey))
? Number.isNaN(Number(otherKey))
? `${key}.${otherKey}`
: `${key}[${otherKey}]`
: otherKey;
: otherKey;
if (typeof val === 'string') {
yield val;