Skip to content

Commit faf9857

Browse files
committed
fix: use yaml instead of js-yaml, fix config-rocket missing, solve lint warn failure
1 parent 9d02aae commit faf9857

File tree

13 files changed

+24
-737
lines changed

13 files changed

+24
-737
lines changed

pnpm-lock.yaml

Lines changed: 5 additions & 720 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/marketplace/GitFetcher.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from "vscode"
22
import * as path from "path"
33
import * as fs from "fs/promises"
4-
import * as yaml from "js-yaml"
4+
import * as yaml from "yaml"
55
import simpleGit, { SimpleGit } from "simple-git"
66
import { MetadataScanner } from "./MetadataScanner"
77
import { validateAnyMetadata } from "./schemas"
@@ -256,6 +256,7 @@ export class GitFetcher {
256256

257257
// Get current branch using existing git instance
258258
// const branch =
259+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
259260
;(await this.git?.revparse(["--abbrev-ref", "HEAD"])) || "main"
260261
} catch (error) {
261262
throw new Error(
@@ -288,7 +289,7 @@ export class GitFetcher {
288289
const metadataContent = await fs.readFile(metadataPath, "utf-8")
289290

290291
try {
291-
const parsed = yaml.load(metadataContent) as Record<string, any>
292+
const parsed = yaml.parse(metadataContent) as Record<string, any>
292293
return validateAnyMetadata(parsed) as RepositoryMetadata
293294
} catch (error) {
294295
console.error("Failed to parse repository metadata:", error)

src/services/marketplace/InstalledMetadataManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from "vscode"
22
import * as path from "path"
33
import * as fs from "fs/promises"
4-
import * as yaml from "js-yaml"
4+
import * as yaml from "yaml"
55
import { z } from "zod"
66
import { ensureSettingsDirectoryExists } from "../../utils/globalContext"
77

@@ -43,7 +43,7 @@ export class InstalledMetadataManager {
4343
private async loadMetadataFile(filePath: string): Promise<ScopeInstalledMetadata> {
4444
try {
4545
const content = await fs.readFile(filePath, "utf-8")
46-
const data = yaml.load(content)
46+
const data = yaml.parse(content)
4747

4848
const validationResult = ScopeInstalledMetadataSchema.safeParse(data)
4949

@@ -159,7 +159,7 @@ export class InstalledMetadataManager {
159159
await fs.mkdir(path.dirname(filePath), { recursive: true })
160160

161161
// Serialize metadata to YAML
162-
const yamlContent = yaml.dump(metadata)
162+
const yamlContent = yaml.stringify(metadata)
163163

164164
// Write to file
165165
await fs.writeFile(filePath, yamlContent, "utf-8")

src/services/marketplace/MetadataScanner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from "path"
22
import * as fs from "fs/promises"
33
import * as vscode from "vscode"
4-
import * as yaml from "js-yaml"
4+
import * as yaml from "yaml"
55
import { SimpleGit } from "simple-git"
66
import { validateAnyMetadata } from "./schemas"
77
import {
@@ -189,7 +189,7 @@ export class MetadataScanner {
189189

190190
try {
191191
const content = await fs.readFile(metadataPath, "utf-8")
192-
const parsed = yaml.load(content) as Record<string, any>
192+
const parsed = yaml.parse(content) as Record<string, any>
193193

194194
// Add type field if missing but has a parent directory indicating type
195195
if (!parsed.type) {
@@ -318,7 +318,7 @@ export class MetadataScanner {
318318
const metadataPath = path.join(packageDir, "metadata.en.yml")
319319
try {
320320
const content = await fs.readFile(metadataPath, "utf-8")
321-
const parsed = yaml.load(content) as PackageMetadata
321+
const parsed = yaml.parse(content) as PackageMetadata
322322

323323
if (parsed.items) {
324324
for (const item of parsed.items) {

src/services/marketplace/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RocketConfig } from "config-rocket"
1+
import type { RocketConfig } from "config-rocket"
22

33
/**
44
* Information about why an item matched search/filter criteria
@@ -38,6 +38,7 @@ export interface BaseMetadata {
3838
/**
3939
* Repository root metadata
4040
*/
41+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
4142
export interface RepositoryMetadata extends BaseMetadata {}
4243

4344
/**

webview-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"class-variance-authority": "^0.7.1",
3939
"clsx": "^2.1.1",
4040
"cmdk": "^1.0.0",
41+
"config-rocket": "^0.5.8",
4142
"date-fns": "^4.1.0",
4243
"debounce": "^2.1.1",
4344
"fast-deep-equal": "^3.1.3",
@@ -60,7 +61,6 @@
6061
"rehype-highlight": "^7.0.0",
6162
"remark-gfm": "^4.0.1",
6263
"remove-markdown": "^0.6.0",
63-
"rocket-config": "^1.0.7",
6464
"shell-quote": "^1.8.2",
6565
"shiki": "^3.2.1",
6666
"source-map": "^0.7.4",
@@ -69,8 +69,8 @@
6969
"tailwindcss": "^4.0.0",
7070
"tailwindcss-animate": "^1.0.7",
7171
"unist-util-visit": "^5.0.0",
72-
"vscode-material-icons": "^0.1.1",
7372
"use-sound": "^5.0.0",
73+
"vscode-material-icons": "^0.1.1",
7474
"vscrui": "^0.2.2",
7575
"zod": "^3.24.2"
7676
},

webview-ui/src/components/marketplace/InstallSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from "react"
22
import { VSCodeButton, VSCodeTextField, VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
33
import { MarketplaceItem } from "../../../../src/services/marketplace/types"
4-
import { RocketConfig } from "config-rocket"
4+
import type { RocketConfig } from "config-rocket"
55

66
interface MarketplaceInstallSidebarProps {
77
item: MarketplaceItem

webview-ui/src/components/marketplace/MarketplaceSourcesConfigView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function MarketplaceSourcesConfig({ stateManager }: MarketplaceSourcesCon
3434
/[\u2300-\u23FF]/.test(str) || // Miscellaneous Technical
3535
/[\u2700-\u27FF]/.test(str) || // Dingbats
3636
/[\u2B50\u2B55]/.test(str) || // Star, Circle
37+
// eslint-disable-next-line no-misleading-character-class
3738
/[\u203C\u2049\u20E3\u2122\u2139\u2194-\u2199\u21A9\u21AA]/.test(str)
3839
) // Punctuation
3940
}

webview-ui/src/components/marketplace/MarketplaceView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import InstallSidebar from "./InstallSidebar"
99
import { useEvent } from "react-use"
1010
import { ExtensionMessage } from "@roo/shared/ExtensionMessage"
1111
import { vscode } from "@/utils/vscode"
12-
import { RocketConfig } from "config-rocket"
12+
import type { RocketConfig } from "config-rocket"
1313
import { MarketplaceSourcesConfig } from "./MarketplaceSourcesConfigView"
1414
import { MarketplaceListView } from "./MarketplaceListView"
1515
import { cn } from "@/lib/utils"

webview-ui/src/components/marketplace/MarketplaceViewStateManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export class MarketplaceViewStateManager {
103103
private stateChangeHandlers: Set<StateChangeHandler> = new Set()
104104

105105
// Empty constructor is required for test initialization
106-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
107106
constructor() {
108107
// Initialize is now handled by the loadInitialState call in the property initialization
109108
}

0 commit comments

Comments
 (0)