Skip to content

Commit a6056b7

Browse files
committed
chore: Enable 'no-external-import' lint
1 parent edddb29 commit a6056b7

File tree

24 files changed

+85
-66
lines changed

24 files changed

+85
-66
lines changed

typescript/packages/common-cli/deno.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
"memorydemo": "deno run --allow-read --allow-env --allow-net memory_demo.ts",
66
"test": "deno test",
77
"charmdemo": "deno run --allow-read --allow-env --allow-net charm_demo.ts"
8+
},
9+
"imports": {
10+
"open": "https://deno.land/x/open@v0.0.6/index.ts"
811
}
912
}

typescript/packages/common-cli/gcal.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { OAuth2Client } from "jsr:@cmd-johnson/oauth2-client@^2.0.0";
2-
import { serve } from "https://deno.land/std@0.216.0/http/server.ts";
3-
import { open } from "https://deno.land/x/open@v0.0.6/index.ts";
1+
import { OAuth2Client } from "@cmd-johnson/oauth2-client";
2+
import { load } from "@std/dotenv";
43
import { getAccessToken } from "./google.ts";
54

6-
import { load } from "https://deno.land/std@0.216.0/dotenv/mod.ts";
75
const env = await load({
86
envPath: "./.env",
97
// you can also specify multiple possible paths:

typescript/packages/common-cli/google-importer.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Load .env file
2-
import { parseArgs } from "jsr:@std/cli/parse-args";
2+
import { parseArgs } from "@std/cli/parse-args";
33
import { CharmManager, setBobbyServerUrl, storage } from "@commontools/charm";
44
import { Cell, getEntityId, isStream } from "@commontools/runner";
55
import { Charm } from "@commontools/charm";
@@ -11,9 +11,13 @@ function showHelp() {
1111
console.log("Usage: deno run main.ts [options]");
1212
console.log("");
1313
console.log("Options:");
14-
console.log(" --space=<space> Space to watch (default: common-knowledge)");
14+
console.log(
15+
" --space=<space> Space to watch (default: common-knowledge)",
16+
);
1517
console.log(" --charmId=<id> Specific charm ID to watch");
16-
console.log(" --interval=<seconds> Update interval in seconds (default: 30)");
18+
console.log(
19+
" --interval=<seconds> Update interval in seconds (default: 30)",
20+
);
1721
console.log(" --help Show this help message");
1822
console.log(" --version Show version information");
1923
Deno.exit(0);
@@ -31,7 +35,8 @@ const { space, charmId, interval } = flags;
3135

3236
// Configuration
3337
const CHECK_INTERVAL = parseInt(interval as string) * 1000;
34-
const toolshedUrl = Deno.env.get("TOOLSHED_API_URL") ?? "https://toolshed.saga-castor.ts.net/";
38+
const toolshedUrl = Deno.env.get("TOOLSHED_API_URL") ??
39+
"https://toolshed.saga-castor.ts.net/";
3540

3641
// Initialize storage and Bobby server
3742
storage.setRemoteStorage(new URL(toolshedUrl));
@@ -90,7 +95,10 @@ async function refreshAuthToken(auth: Cell<any>, charm: Cell<Charm>) {
9095
authCellId.space = space as string;
9196
log(charm, `token expired, refreshing: ${authCellId}`);
9297

93-
const refresh_url = new URL("/api/integrations/google-oauth/refresh", toolshedUrl);
98+
const refresh_url = new URL(
99+
"/api/integrations/google-oauth/refresh",
100+
toolshedUrl,
101+
);
94102
const refresh_response = await fetch(refresh_url, {
95103
method: "POST",
96104
body: JSON.stringify({ authCellId }),
@@ -149,7 +157,9 @@ async function watchCharm(charmId: string | undefined) {
149157
}
150158

151159
function getId(charmId: string | Cell<Charm> | undefined): string | undefined {
152-
const realCharmId = typeof charmId === "string" ? charmId : getEntityId(charmId)?.["/"];
160+
const realCharmId = typeof charmId === "string"
161+
? charmId
162+
: getEntityId(charmId)?.["/"];
153163
if (!realCharmId) {
154164
log(undefined, "charmId not found", JSON.stringify(charmId));
155165
return undefined;

typescript/packages/common-cli/google.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { serve } from "https://deno.land/std@0.216.0/http/server.ts";
2-
import { open } from "https://deno.land/x/open@v0.0.6/index.ts";
3-
import { OAuth2Client } from "jsr:@cmd-johnson/oauth2-client@^2.0.0";
1+
import { open } from "open";
2+
import { OAuth2Client } from "@cmd-johnson/oauth2-client";
43

54
export async function getAccessToken(client: OAuth2Client) {
65
let authCode: string | null = null;
76
const controller = new AbortController();
8-
const server = serve(
7+
const server = Deno.serve(
8+
{ port: 8080, signal: controller.signal },
99
(req) => {
1010
const url = new URL(req.url);
1111
if (url.searchParams.has("code")) {
@@ -17,7 +17,6 @@ export async function getAccessToken(client: OAuth2Client) {
1717
}
1818
return new Response("Waiting for authentication...");
1919
},
20-
{ port: 8080, signal: controller.signal },
2120
);
2221

2322
const { uri, codeVerifier } = await client.code.getAuthorizationUri();

typescript/packages/common-cli/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Load .env file
2-
import { parseArgs } from "https://deno.land/std@0.224.0/cli/parse_args.ts";
2+
import { parseArgs } from "@std/cli/parse-args";
33
import {
44
CharmManager,
55
compileRecipe,

typescript/packages/common-cli/notes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { walk } from "https://deno.land/std@0.216.0/fs/walk.ts";
2-
import { debounce } from "https://deno.land/std@0.216.0/async/debounce.ts";
1+
import { walk } from "@std/fs";
2+
import { debounce } from "@std/async/debounce";
33

44
export interface NoteChange {
55
path: string;

typescript/packages/common-cli/write-to-authcell.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
import { CharmManager, compileRecipe, createStorage } from "@commontools/charm";
33
import { getEntityId, idle } from "@commontools/runner";
44
import { fetchInboxEmails } from "./gmail.ts";
5-
import { parse } from "https://deno.land/std/flags/mod.ts";
5+
import { parseArgs } from "@std/cli/parse-args";
66

77
import { getCellFromDocLink } from "@commontools/runner";
88

9-
const TOOLSHED_API_URL = Deno.env.get("TOOLSHED_API_URL") || "https://toolshed.saga-castor.ts.net";
9+
const TOOLSHED_API_URL = Deno.env.get("TOOLSHED_API_URL") ||
10+
"https://toolshed.saga-castor.ts.net";
1011

1112
async function main(
1213
recipeSrc: string,
@@ -20,7 +21,9 @@ async function main(
2021
url: new URL(TOOLSHED_API_URL),
2122
});
2223

23-
const cellId = { "/": "baedreiajxdvqjxmgpfzjix4h6vd4pl77unvet2k3acfvhb6ottafl7gpua" };
24+
const cellId = {
25+
"/": "baedreiajxdvqjxmgpfzjix4h6vd4pl77unvet2k3acfvhb6ottafl7gpua",
26+
};
2427

2528
await storage.syncCell(cellId, true);
2629
const authCellEntity = {
@@ -74,7 +77,7 @@ async function main(
7477
// console.log({ emails });
7578
}
7679

77-
const flags = parse(Deno.args, {
80+
const flags = parseArgs(Deno.args, {
7881
string: ["replica", "cause", "data"],
7982
default: {
8083
replica: "common-knowledge",
@@ -90,7 +93,9 @@ let jsonData: unknown;
9093

9194
if (!filename) {
9295
console.error("No typescript recipe file provided");
93-
console.error("Usage: deno run -A main.ts <recipe-file> [--replica=name] [--cause=id]");
96+
console.error(
97+
"Usage: deno run -A main.ts <recipe-file> [--replica=name] [--cause=id]",
98+
);
9499
Deno.exit(1);
95100
}
96101

typescript/packages/common-memory/deno.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Provider from "./provider.ts";
22
import * as Socket from "./socket.ts";
3-
import * as Path from "jsr:@std/path";
3+
import * as Path from "@std/path";
44
import * as UCAN from "./ucan.ts";
55
import * as Receipt from "./receipt.ts";
66

typescript/packages/common-memory/memory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Space from "./space.ts";
22
import * as Error from "./error.ts";
3-
import * as FS from "jsr:@std/fs";
3+
import * as FS from "@std/fs";
44
import {
55
AsyncResult,
66
ConnectionError,

typescript/packages/common-memory/migrate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Database,
33
SqliteError,
44
Transaction as DBTransaction,
5-
} from "jsr:@db/sqlite";
5+
} from "@db/sqlite";
66

77
const MIGRATIONS = new URL("./migrations/", import.meta.url);
88

0 commit comments

Comments
 (0)