Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
inverted-capital committed Oct 23, 2024
1 parent 76bce5f commit 3fe6753
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 96 deletions.
2 changes: 1 addition & 1 deletion _tools/check_browser_compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Run using: deno run --allow-read --allow-run _tools/check_browser_compat.ts
*/

import { walk } from "../fs/walk.ts";
import { walk } from "@std/fs/walk";
import { COPYRIGHT } from "./check_licence.ts";

const ROOT = new URL("../", import.meta.url);
Expand Down
90 changes: 5 additions & 85 deletions _tools/check_circular_package_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@deno/graph";
import { resolveWorkspaceSpecifiers } from "./utils.ts";
import graphviz from "graphviz";
import { parse } from "../semver/parse.ts";
import { parse } from "@std/semver/parse";

/**
* Checks for circular dependencies in the std packages.
Expand Down Expand Up @@ -35,92 +35,12 @@ type Dep = {
state: DepState;
};
type Mod =
| "archive"
| "assert"
| "async"
| "bytes"
| "cache"
| "cbor"
| "cli"
| "collections"
| "crypto"
| "csv"
| "data_structures"
| "datetime"
| "dotenv"
| "encoding"
| "expect"
| "fmt"
| "front_matter"
| "fs"
| "html"
| "http"
| "ini"
| "internal"
| "io"
| "json"
| "jsonc"
| "log"
| "media_types"
| "msgpack"
| "net"
| "path"
| "random"
| "regexp"
| "semver"
| "streams"
| "tar"
| "testing"
| "text"
| "toml"
| "ulid"
| "uuid"
| "webgpu"
| "yaml";
| "files"
| "openai";

const ENTRYPOINTS: Record<Mod, string[]> = {
archive: ["mod.ts"],
assert: ["mod.ts"],
async: ["mod.ts"],
bytes: ["mod.ts"],
cache: ["mod.ts"],
cbor: ["mod.ts"],
cli: ["mod.ts"],
collections: ["mod.ts"],
crypto: ["mod.ts"],
csv: ["mod.ts"],
"data_structures": ["mod.ts"],
datetime: ["mod.ts"],
dotenv: ["mod.ts"],
encoding: ["mod.ts"],
expect: ["mod.ts"],
fmt: ["bytes.ts", "colors.ts", "duration.ts", "printf.ts"],
"front_matter": ["mod.ts"],
fs: ["mod.ts"],
html: ["mod.ts"],
http: ["mod.ts"],
ini: ["mod.ts"],
internal: ["mod.ts"],
io: ["mod.ts"],
json: ["mod.ts"],
jsonc: ["mod.ts"],
log: ["mod.ts"],
"media_types": ["mod.ts"],
msgpack: ["mod.ts"],
net: ["mod.ts"],
path: ["mod.ts"],
random: ["mod.ts"],
regexp: ["mod.ts"],
semver: ["mod.ts"],
streams: ["mod.ts"],
tar: ["mod.ts"],
testing: ["bdd.ts", "mock.ts", "snapshot.ts", "time.ts", "types.ts"],
text: ["mod.ts"],
toml: ["mod.ts"],
ulid: ["mod.ts"],
uuid: ["mod.ts"],
webgpu: ["mod.ts"],
yaml: ["mod.ts"],
files: ["mod.ts"],
openai: ["mod.ts"],
};

const root = new URL("../", import.meta.url).href;
Expand Down
4 changes: 2 additions & 2 deletions _tools/check_deprecation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

import { doc } from "@deno/doc";
import { walk } from "../fs/walk.ts";
import { toFileUrl } from "../path/to_file_url.ts";
import { walk } from "@std/fs/walk";
import { toFileUrl } from "@std/path/to-file-url";
import { resolveWorkspaceSpecifiers } from "./utils.ts";

const ROOT = new URL("../", import.meta.url);
Expand Down
8 changes: 4 additions & 4 deletions _tools/check_mod_exports.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// deno-lint-ignore-file no-console
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { walk } from "../fs/walk.ts";
import { relative } from "../path/relative.ts";
import { dirname } from "../path/dirname.ts";
import * as colors from "../fmt/colors.ts";
import { walk } from "@std/fs/walk";
import { relative } from "@std/path/relative";
import { dirname } from "@std/path/dirname";
import * as colors from "@std/fmt/colors";
import ts from "npm:typescript";

const ROOT = new URL("../", import.meta.url);
Expand Down
4 changes: 2 additions & 2 deletions _tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for (const workspace of workspaces) {
const { default: config } = await import("../" + workspace + "/deno.json", {
with: { type: "json" },
});
denoConfig[config.name.replace("@std/", "")] = config;
denoConfig[config.name.replace("@artifact/", "")] = config;
}

export function resolveWorkspaceSpecifiers(
Expand All @@ -17,7 +17,7 @@ export function resolveWorkspaceSpecifiers(
) {
if (specifier.startsWith("../") || specifier.startsWith("./")) {
return new URL(specifier, referrer).href;
} else if (specifier.startsWith("@std/")) {
} else if (specifier.startsWith("@artifact/")) {
let [_std, pkg, exp] = specifier.split("/");
if (exp === undefined) {
exp = ".";
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"lint:docs": "deno run -A _tools/check_docs.ts",
"lint:import-map": "deno run -A _tools/check_import_map.ts",
"lint:unstable-deps": "deno run -A _tools/check_unstable_deps.ts",
"lint": "deno lint && deno task lint:circular && deno task lint:deprecations && deno task lint:tools-types && deno task lint:mod-exports && deno task lint:import-map && deno task lint:docs && deno task lint:unstable-deps",
"lint": "deno lint && deno task lint:circular && deno task lint:tools-types && deno task lint:mod-exports && deno task lint:import-map && deno task lint:docs && deno task lint:unstable-deps",
"typos": "typos -c ./.github/workflows/typos.toml",
"build:crypto": "deno task --cwd crypto/_wasm wasmbuild",
"wasmbuild": "deno run -A jsr:@deno/wasmbuild@0.17.1 --js-ext mjs --sync",
"cov": "deno coverage --ignore=\"**/*.generated.mjs,**/_test_utils.ts,.github\"",
"cov:gen": "deno task cov --lcov --output=cov.lcov",
"cov:view": "deno task cov --html",
"ok": "deno task lint && deno fmt --check && deno task test:browser && deno task test"
"ok": "deno task lint && deno fmt --check && deno task test"
},
"exclude": [
".git",
Expand Down
1 change: 1 addition & 0 deletions openai/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

import * as m from "./completions.ts";
import { expect } from "@std/expect";

Deno.test("publish", () => {
expect(m.n).toBe(84);
});

0 comments on commit 3fe6753

Please sign in to comment.