Skip to content

Commit 0bcd66f

Browse files
VinciGit00claude
andcommitted
fix(lint): allow noExplicitAny in command files
The SDK's Zod-inferred types have strict required fields (from .default()) that don't match partial CLI arg construction. Allow `as any` in src/commands/ where we bridge string args to the SDK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 770c351 commit 0bcd66f

6 files changed

Lines changed: 11 additions & 16 deletions

File tree

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"overrides": [
1818
{
19-
"include": ["tests/**"],
19+
"include": ["tests/**", "src/commands/**"],
2020
"linter": {
2121
"rules": {
2222
"suspicious": {

src/commands/crawl.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineCommand } from "citty";
2-
import type { ApiCrawlOptions } from "scrapegraph-js";
32
import { createClient } from "../lib/client.js";
43
import * as log from "../lib/log.js";
54

@@ -39,7 +38,7 @@ export default defineCommand({
3938
out.docs("https://docs.scrapegraphai.com/api-reference/crawl");
4039
const sgai = await createClient(!!args.json);
4140

42-
const crawlOptions: ApiCrawlOptions = {};
41+
const crawlOptions: Record<string, unknown> = {};
4342
if (args["max-pages"]) crawlOptions.maxPages = Number(args["max-pages"]);
4443
if (args["max-depth"]) crawlOptions.maxDepth = Number(args["max-depth"]);
4544
if (args["max-links-per-page"])
@@ -54,7 +53,7 @@ export default defineCommand({
5453
out.start("Crawling");
5554
const t0 = performance.now();
5655
try {
57-
const job = await sgai.crawl.start(args.url, crawlOptions);
56+
const job = await sgai.crawl.start(args.url, crawlOptions as any);
5857
const jobId = (job.data as { id: string }).id;
5958

6059
if (!jobId) {

src/commands/extract.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineCommand } from "citty";
2-
import type { ApiExtractOptions } from "scrapegraph-js";
32
import { createClient } from "../lib/client.js";
43
import * as log from "../lib/log.js";
54

@@ -42,14 +41,14 @@ export default defineCommand({
4241
if (args.headers) fetchConfig.headers = JSON.parse(args.headers);
4342
if (args.country) fetchConfig.country = args.country;
4443

45-
const extractOptions: ApiExtractOptions = { prompt: args.prompt };
44+
const extractOptions: Record<string, unknown> = { prompt: args.prompt };
4645
if (args.schema) extractOptions.schema = JSON.parse(args.schema);
4746
if (Object.keys(fetchConfig).length > 0) extractOptions.fetchConfig = fetchConfig;
4847

4948
out.start("Extracting");
5049
const t0 = performance.now();
5150
try {
52-
const result = await sgai.extract(args.url, extractOptions);
51+
const result = await sgai.extract(args.url, extractOptions as any);
5352
out.stop(Math.round(performance.now() - t0));
5453
out.result(result.data);
5554
} catch (err) {

src/commands/markdownify.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineCommand } from "citty";
2-
import type { ApiScrapeOptions } from "scrapegraph-js";
32
import { createClient } from "../lib/client.js";
43
import * as log from "../lib/log.js";
54

@@ -29,13 +28,13 @@ export default defineCommand({
2928
if (args.stealth) fetchConfig.stealth = true;
3029
if (args.headers) fetchConfig.headers = JSON.parse(args.headers);
3130

32-
const scrapeOptions: ApiScrapeOptions = { format: "markdown" };
31+
const scrapeOptions: Record<string, unknown> = { format: "markdown" };
3332
if (Object.keys(fetchConfig).length > 0) scrapeOptions.fetchConfig = fetchConfig;
3433

3534
out.start("Converting to markdown");
3635
const t0 = performance.now();
3736
try {
38-
const result = await sgai.scrape(args.url, scrapeOptions);
37+
const result = await sgai.scrape(args.url, scrapeOptions as any);
3938
out.stop(Math.round(performance.now() - t0));
4039
out.result(result.data);
4140
} catch (err) {

src/commands/scrape.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineCommand } from "citty";
2-
import type { ApiScrapeOptions } from "scrapegraph-js";
32
import { createClient } from "../lib/client.js";
43
import * as log from "../lib/log.js";
54

@@ -106,13 +105,13 @@ export default defineCommand({
106105
}
107106
});
108107

109-
const scrapeOptions: ApiScrapeOptions = { formats };
108+
const scrapeOptions: Record<string, unknown> = { formats };
110109
if (Object.keys(fetchConfig).length > 0) scrapeOptions.fetchConfig = fetchConfig;
111110

112111
out.start("Scraping");
113112
const t0 = performance.now();
114113
try {
115-
const result = await sgai.scrape(args.url, scrapeOptions);
114+
const result = await sgai.scrape(args.url, scrapeOptions as any);
116115
out.stop(Math.round(performance.now() - t0));
117116
out.result(result.data);
118117
} catch (err) {

src/commands/search.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineCommand } from "citty";
2-
import type { ApiSearchOptions } from "scrapegraph-js";
32
import { createClient } from "../lib/client.js";
43
import * as log from "../lib/log.js";
54

@@ -49,7 +48,7 @@ export default defineCommand({
4948
out.docs("https://docs.scrapegraphai.com/api-reference/search");
5049
const sgai = await createClient(!!args.json);
5150

52-
const searchOptions: ApiSearchOptions = {};
51+
const searchOptions: Record<string, unknown> = {};
5352
if (args["num-results"]) searchOptions.numResults = Number(args["num-results"]);
5453
if (args.schema) searchOptions.schema = JSON.parse(args.schema);
5554
if (args.prompt) searchOptions.prompt = args.prompt;
@@ -62,7 +61,7 @@ export default defineCommand({
6261
out.start("Searching");
6362
const t0 = performance.now();
6463
try {
65-
const result = await sgai.search(args.query, searchOptions);
64+
const result = await sgai.search(args.query, searchOptions as any);
6665
out.stop(Math.round(performance.now() - t0));
6766
out.result(result.data);
6867
} catch (err) {

0 commit comments

Comments
 (0)