From 1bba8ba4bb8e0c2679f34a1f200743edf78f70b1 Mon Sep 17 00:00:00 2001 From: Adam Matthiesen Date: Sat, 9 Nov 2024 03:06:58 -0800 Subject: [PATCH] lint --- biome.json | 1 + package.json | 4 ++-- packages/twoslash/src/annotation.ts | 6 ++--- packages/twoslash/src/helpers.ts | 36 ++++++++++++++--------------- packages/twoslash/src/index.ts | 8 +++---- packages/twoslash/src/styles.ts | 2 +- packages/twoslash/src/types.ts | 4 ++-- 7 files changed, 31 insertions(+), 30 deletions(-) diff --git a/biome.json b/biome.json index 606cd74..52c7f43 100644 --- a/biome.json +++ b/biome.json @@ -13,6 +13,7 @@ } }, "files": { + "include": ["packages/**/*"], "ignore": ["dist", ".astro"] } } diff --git a/package.json b/package.json index c2e8885..deaf3f7 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "scripts": { "playground:dev": "pnpm --filter playground dev", "twoslash:build": "pnpm --filter expressive-code-twoslash build", - "docs:dev": "pnpm --filter docs dev", + "docs:dev": "pnpm --filter docs-twoslash dev", "changeset": "changeset", "lint": "biome check .", - "lint:fix": "biome check --apply .", + "lint:fix": "biome check --write .", "ci:install": "pnpm install --frozen-lockfile", "ci:version": "changeset version", "ci:publish": "changeset publish", diff --git a/packages/twoslash/src/annotation.ts b/packages/twoslash/src/annotation.ts index cb38da3..4ef04f0 100644 --- a/packages/twoslash/src/annotation.ts +++ b/packages/twoslash/src/annotation.ts @@ -1,9 +1,9 @@ import { + type AnnotationRenderOptions, ExpressiveCodeAnnotation, type ExpressiveCodeLine, - type AnnotationRenderOptions, } from "@expressive-code/core"; -import { h, type Root, type Element } from "@expressive-code/core/hast"; +import { type Element, type Root, h } from "@expressive-code/core/hast"; import type { NodeCompletion, NodeError, @@ -12,7 +12,6 @@ import type { NodeQuery, NodeTag, } from "twoslash"; -import type { CompletionItem, CustomTagsIcon, TwoslashTag } from "./types"; import { customTagsIcons } from "./customTagsIcons"; import { defaultHoverInfoProcessor, @@ -25,6 +24,7 @@ import { renderMarkdown, renderMarkdownInline, } from "./helpers"; +import type { CompletionItem, CustomTagsIcon, TwoslashTag } from "./types"; export class TwoslashErrorUnderlineAnnotation extends ExpressiveCodeAnnotation { constructor(readonly error: NodeError) { diff --git a/packages/twoslash/src/helpers.ts b/packages/twoslash/src/helpers.ts index 19e90f4..a422b5f 100644 --- a/packages/twoslash/src/helpers.ts +++ b/packages/twoslash/src/helpers.ts @@ -2,17 +2,10 @@ import type { ExpressiveCodeBlock, ExpressiveCodeLine, } from "@expressive-code/core"; -import { - reFunctionCleanup, - reImportStatement, - reInterfaceOrNamespace, - reJsDocLink, - reJsDocTagFilter, - reLeadingPropertyMethod, - reTrigger, - reTypeCleanup, - twoslashDefaultTags, -} from "./regex"; +import type { Element, ElementContent } from "@expressive-code/core/hast"; +import { fromMarkdown } from "mdast-util-from-markdown"; +import { gfmFromMarkdown } from "mdast-util-gfm"; +import { toHast } from "mdast-util-to-hast"; import type { NodeCompletion, NodeError, @@ -20,7 +13,7 @@ import type { TwoslashOptions, TwoslashReturn, } from "twoslash"; -import { completionIcons } from "./completionIcons"; +import ts, { type CompilerOptions } from "typescript"; import { TwoslashCompletionAnnotation, TwoslashCustomTagsAnnotation, @@ -30,12 +23,19 @@ import { TwoslashHoverAnnotation, TwoslashStaticAnnotation, } from "./annotation"; -import ts, { type CompilerOptions } from "typescript"; -import type { CompletionItem, CompletionIcon, TwoslashTag } from "./types"; -import type { Element, ElementContent } from "@expressive-code/core/hast"; -import { fromMarkdown } from "mdast-util-from-markdown"; -import { gfmFromMarkdown } from "mdast-util-gfm"; -import { toHast } from "mdast-util-to-hast"; +import { completionIcons } from "./completionIcons"; +import { + reFunctionCleanup, + reImportStatement, + reInterfaceOrNamespace, + reJsDocLink, + reJsDocTagFilter, + reLeadingPropertyMethod, + reTrigger, + reTypeCleanup, + twoslashDefaultTags, +} from "./regex"; +import type { CompletionIcon, CompletionItem, TwoslashTag } from "./types"; /** * Converts a markdown string into an array of ElementContent objects. diff --git a/packages/twoslash/src/index.ts b/packages/twoslash/src/index.ts index 0441887..668498a 100644 --- a/packages/twoslash/src/index.ts +++ b/packages/twoslash/src/index.ts @@ -1,7 +1,5 @@ -import { definePlugin, type ExpressiveCodePlugin } from "@expressive-code/core"; +import { type ExpressiveCodePlugin, definePlugin } from "@expressive-code/core"; import { createTwoslasher } from "twoslash"; -import popupModule from "./module-code/popup.min"; -import { getTwoSlashBaseStyles, twoSlashStyleSettings } from "./styles"; import { addCompletionAnnotations, addCustomTagAnnotations, @@ -10,9 +8,11 @@ import { addHoverOrStaticAnnotations, buildMetaChecker, checkForCustomTagsAndMerge, - replaceECBlockWithTwoslashBlock, ecTwoslasher, + replaceECBlockWithTwoslashBlock, } from "./helpers"; +import popupModule from "./module-code/popup.min"; +import { getTwoSlashBaseStyles, twoSlashStyleSettings } from "./styles"; import type { PluginTwoslashOptions } from "./types"; /** diff --git a/packages/twoslash/src/styles.ts b/packages/twoslash/src/styles.ts index 4647cd6..2893af2 100644 --- a/packages/twoslash/src/styles.ts +++ b/packages/twoslash/src/styles.ts @@ -1,8 +1,8 @@ import { PluginStyleSettings, + type ResolverContext, type StyleResolverFn, toHexColor, - type ResolverContext, } from "@expressive-code/core"; import type { TwoSlashStyleSettings } from "./types"; diff --git a/packages/twoslash/src/types.ts b/packages/twoslash/src/types.ts index c298518..542b664 100644 --- a/packages/twoslash/src/types.ts +++ b/packages/twoslash/src/types.ts @@ -1,7 +1,7 @@ -import type { TwoslashOptions } from "twoslash"; import type { Element } from "@expressive-code/core/hast"; -import type { customTagsIcons } from "./customTagsIcons"; +import type { TwoslashOptions } from "twoslash"; import type { completionIcons } from "./completionIcons"; +import type { customTagsIcons } from "./customTagsIcons"; /** * Interface representing the options for the PluginTwoslash.