Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jun 1, 2024
1 parent 8d9239e commit ff65a58
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/lib/converter/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "./discovery";
import { lexLineComments } from "./lineLexer";
import { parseComment } from "./parser";
import { MediaRegistry } from "../../models/MediaRegistry";
import type { MediaRegistry } from "../../models/MediaRegistry";

export interface CommentParserConfig {
blockTags: Set<string>;
Expand Down
9 changes: 6 additions & 3 deletions src/lib/converter/comments/textParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
* them into references.
* @module
*/
import { TranslationProxy, TranslatedString } from "../../internationalization";
import type {
TranslationProxy,
TranslatedString,
} from "../../internationalization";
import type { CommentDisplayPart } from "../../models";
import { MediaRegistry } from "../../models/MediaRegistry";
import { Token, TokenSyntaxKind } from "./lexer";
import type { MediaRegistry } from "../../models/MediaRegistry";
import { type Token, TokenSyntaxKind } from "./lexer";

import MarkdownIt from "markdown-it";
const MdHelpers = new MarkdownIt().helpers;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
type DeclarationReference,
} from "./comments/declarationReference";
import { basename, dirname, resolve } from "path";
import { MediaRegistry } from "../models/MediaRegistry";
import type { MediaRegistry } from "../models/MediaRegistry";

/**
* Compiles source files using TypeScript and converts compiler symbols to reflections.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/models/MediaRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { basename, dirname, parse, relative, resolve } from "path";
import { Deserializer, Serializer } from "../serialization";
import { MediaRegistry as JSONMediaRegistry } from "../serialization/schema";
import type { Deserializer, Serializer } from "../serialization";
import type { MediaRegistry as JSONMediaRegistry } from "../serialization/schema";
import { normalizePath } from "../utils";
import { existsSync } from "fs";
import { Reflection } from "./reflections";
import type { Reflection } from "./reflections";

export class MediaRegistry {
protected nextId = 1;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/models/comments/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export class Comment {
} else {
assertNever(part.target);
}
break;
}
case "relative-link": {
if (part.target) {
Expand Down Expand Up @@ -274,7 +275,7 @@ export class Comment {
if (links.length || media.length) {
de.defer((project) => {
for (const [oldMedia, part] of media) {
part.target = de.oldMediaToNewMedia[oldMedia]!; // GERRIT: Need to get rid of this assert, figure out how to handle null media
part.target = de.oldMediaToNewMedia[oldMedia];
}
for (const [oldId, part] of links) {
part.target = project.getReflectionById(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/models/reflections/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { Serializer } from "../../serialization/serializer";
import type { Deserializer, JSONOutput } from "../../serialization/index";
import { DefaultMap, StableKeyMap } from "../../utils/map";
import type { DocumentReflection } from "./document";
import { MediaRegistry } from "../MediaRegistry";
import type { MediaRegistry } from "../MediaRegistry";

/**
* A reflection that represents the root of the project.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/output/plugins/AssetsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class AssetsPlugin extends RendererComponent {
const media = join(event.outputDirectory, "media");
const toCopy = event.project.media.getNameToAbsoluteMap();
for (const [mediaName, absolute] of toCopy.entries()) {
copySync(absolute, join(media, mediaName!));
copySync(absolute, join(media, mediaName));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/output/themes/MarkedPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
break;
case "relative-link":
switch (typeof part.target) {
case "number":
case "number": {
const refl = page.project.media.resolve(part.target);
if (typeof refl === "object") {
result.push(context.urlTo(refl));
Expand All @@ -180,6 +180,7 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
result.push(context.relativeURL(`media/${mediaName}`));
break;
}
}
// fall through
case "undefined":
result.push(part.text);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/serialization/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
import { insertPrioritySorted } from "../utils/array";
import type { Logger } from "../utils/loggers";
import type { JSONOutput } from "./index";
import { MediaRegistry } from "../models/MediaRegistry";
import type { MediaRegistry } from "../models/MediaRegistry";

export interface DeserializerComponent {
priority: number;
Expand Down
2 changes: 1 addition & 1 deletion src/test/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { lexLineComments } from "../lib/converter/comments/lineLexer";
import { type Token, TokenSyntaxKind } from "../lib/converter/comments/lexer";
import { parseComment } from "../lib/converter/comments/parser";
import { lexCommentString } from "../lib/converter/comments/rawLexer";
import { Comment, CommentDisplayPart, CommentTag } from "../lib/models";
import { Comment, type CommentDisplayPart, CommentTag } from "../lib/models";
import { MinimalSourceFile } from "../lib/utils/minimalSourceFile";
import { TestLogger } from "./TestLogger";
import { extractTagName } from "../lib/converter/comments/tagName";
Expand Down

0 comments on commit ff65a58

Please sign in to comment.