summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-11-10 13:40:39 -0500
committerGitHub <noreply@github.com>2023-11-10 18:40:39 +0000
commitb78c7130e9986ce41284f33a0803ecdf6dd6affd (patch)
tree5d20148c1e7f449f9d6baa05fe6604aafc2a14b3
parent882c54d5c407affb26012d81fea67cccfc214bb7 (diff)
fix: improve `deno doc --lint` error messages (#21156)
This also updates deno_graph, which has the JSR change to use "exports". It's not yet useful atm, so I've made this PR a fix about the deno doc --lint error message improvements. I'll do a follow-up PR that adds exports to the deno.json
-rw-r--r--Cargo.lock16
-rw-r--r--cli/Cargo.toml8
-rw-r--r--cli/errors.rs2
-rw-r--r--cli/tests/integration/jsr_tests.rs2
-rw-r--r--cli/tests/testdata/doc/referenced_private_types_lint.out8
-rw-r--r--cli/tests/testdata/jsr/deps/main.ts2
-rw-r--r--cli/tests/testdata/jsr/module_graph/main.ts2
-rw-r--r--cli/tests/testdata/jsr/no_module_graph/main.ts2
-rw-r--r--cli/tests/testdata/jsr/no_module_graph/multiple.ts4
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0/mod.ts4
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0_meta.json15
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/module_graph/1.4.0_meta.json4
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json6
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json6
-rw-r--r--cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.2.0_meta.json6
-rw-r--r--cli/tools/doc.rs4
-rw-r--r--cli/tools/info.rs6
17 files changed, 62 insertions, 35 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b9f3e4c2e..cc4ea4361 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1155,9 +1155,9 @@ dependencies = [
[[package]]
name = "deno_doc"
-version = "0.72.2"
+version = "0.73.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48c00aff446bb7a0b9ef34418420650ee803e41251c034b9a944538dc80f1b65"
+checksum = "588c797bd98677e0174ccc3baba8fc2a177f4f91833d74bfdc1ef5d568053618"
dependencies = [
"anyhow",
"cfg-if",
@@ -1178,9 +1178,9 @@ dependencies = [
[[package]]
name = "deno_emit"
-version = "0.31.1"
+version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bad504e08884056bc559364364db9bc7308bd8cfda3679819656821eb7a5ce8"
+checksum = "b74248b5f2f1df9d657896f47baded6b93c904c71532eab1435e9f3f0d7bd4b7"
dependencies = [
"anyhow",
"base64 0.13.1",
@@ -1245,9 +1245,9 @@ dependencies = [
[[package]]
name = "deno_graph"
-version = "0.59.2"
+version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "000084f91f8d5d7de1b8fe3caa9fd098618d60d202237da1e20ee84bd8180f12"
+checksum = "64069da5890ef2d9133199a62d712500529f079dc1bd3a3fe488e64e433ac8ea"
dependencies = [
"anyhow",
"async-trait",
@@ -2201,9 +2201,9 @@ dependencies = [
[[package]]
name = "eszip"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1039ee8563878c6578b7595b6020590e66fecc69c66150535f83dede4ce96d5e"
+checksum = "0bb98b2524f3d81760c4c86bca8ac2481a8093ef48578446a178544cdabd161f"
dependencies = [
"anyhow",
"base64 0.21.4",
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 9356af0ac..b7aed6b12 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -49,16 +49,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra
deno_cache_dir = "=0.6.1"
deno_config = "=0.5.0"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
-deno_doc = { version = "=0.72.2", features = ["html"] }
-deno_emit = "=0.31.1"
-deno_graph = "=0.59.2"
+deno_doc = { version = "=0.73.0", features = ["html"] }
+deno_emit = "=0.31.2"
+deno_graph = "=0.60.0"
deno_lint = { version = "=0.52.2", features = ["docs"] }
deno_lockfile.workspace = true
deno_npm = "0.15.2"
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] }
deno_semver = "0.5.1"
deno_task_shell = "=0.14.0"
-eszip = "=0.55.2"
+eszip = "=0.55.3"
napi_sym.workspace = true
async-trait.workspace = true
diff --git a/cli/errors.rs b/cli/errors.rs
index 0e3ff4f30..8a6062d8f 100644
--- a/cli/errors.rs
+++ b/cli/errors.rs
@@ -36,6 +36,8 @@ fn get_module_graph_error_class(err: &ModuleGraphError) -> &'static str {
| ModuleError::UnsupportedImportAttributeType { .. } => "TypeError",
ModuleError::Missing(_, _)
| ModuleError::MissingDynamic(_, _)
+ | ModuleError::MissingWorkspaceMemberExports { .. }
+ | ModuleError::UnknownExport { .. }
| ModuleError::UnknownPackage { .. }
| ModuleError::UnknownPackageReq { .. } => "NotFound",
},
diff --git a/cli/tests/integration/jsr_tests.rs b/cli/tests/integration/jsr_tests.rs
index d1706d84b..11bb585a6 100644
--- a/cli/tests/integration/jsr_tests.rs
+++ b/cli/tests/integration/jsr_tests.rs
@@ -69,7 +69,7 @@ fn specifiers_in_lockfile() {
temp_dir.write(
"main.ts",
- r#"import version from "jsr:@denotest/no_module_graph@0.1/mod.ts";
+ r#"import version from "jsr:@denotest/no_module_graph@0.1";
console.log(version);"#,
);
diff --git a/cli/tests/testdata/doc/referenced_private_types_lint.out b/cli/tests/testdata/doc/referenced_private_types_lint.out
index 3b1273e22..54f225059 100644
--- a/cli/tests/testdata/doc/referenced_private_types_lint.out
+++ b/cli/tests/testdata/doc/referenced_private_types_lint.out
@@ -1,8 +1,8 @@
-Type 'MyClass' references type 'MyInterface' which is not exported from a root module.
-Missing JS documentation comment.
+Missing JSDoc comment.
at file:///[WILDCARD]/referenced_private_types.ts:5:1
-Missing JS documentation comment.
+Type 'MyClass.prototype.prop' references type 'MyInterface' which is not exported from a root module.
+Missing JSDoc comment.
at file:///[WILDCARD]/referenced_private_types.ts:6:3
-error: Found 3 documentation diagnostics.
+error: Found 3 documentation lint errors.
diff --git a/cli/tests/testdata/jsr/deps/main.ts b/cli/tests/testdata/jsr/deps/main.ts
index 25b13a681..f48255299 100644
--- a/cli/tests/testdata/jsr/deps/main.ts
+++ b/cli/tests/testdata/jsr/deps/main.ts
@@ -1,3 +1,3 @@
-import value from "jsr:@denotest/deps/mod.ts";
+import value from "jsr:@denotest/deps";
console.log(value);
diff --git a/cli/tests/testdata/jsr/module_graph/main.ts b/cli/tests/testdata/jsr/module_graph/main.ts
index 02052595c..c92823cc2 100644
--- a/cli/tests/testdata/jsr/module_graph/main.ts
+++ b/cli/tests/testdata/jsr/module_graph/main.ts
@@ -1,3 +1,3 @@
-import { Test } from "jsr:@denotest/module_graph/mod.ts";
+import { Test } from "jsr:@denotest/module_graph";
console.log(new Test());
diff --git a/cli/tests/testdata/jsr/no_module_graph/main.ts b/cli/tests/testdata/jsr/no_module_graph/main.ts
index ab1e781dc..6ea030c59 100644
--- a/cli/tests/testdata/jsr/no_module_graph/main.ts
+++ b/cli/tests/testdata/jsr/no_module_graph/main.ts
@@ -1,4 +1,4 @@
-import version, { TestClass } from "jsr:@denotest/no_module_graph@0.1.0/mod.ts";
+import version, { TestClass } from "jsr:@denotest/no_module_graph@0.1.0";
console.log(version);
console.log(new TestClass());
diff --git a/cli/tests/testdata/jsr/no_module_graph/multiple.ts b/cli/tests/testdata/jsr/no_module_graph/multiple.ts
index 0df32b780..660ed8be6 100644
--- a/cli/tests/testdata/jsr/no_module_graph/multiple.ts
+++ b/cli/tests/testdata/jsr/no_module_graph/multiple.ts
@@ -1,5 +1,5 @@
-import version1 from "jsr:@denotest/no_module_graph@0.1.0/mod.ts";
-import version2 from "jsr:@denotest/no_module_graph@^0.2/mod.ts";
+import version1 from "jsr:@denotest/no_module_graph@0.1.0";
+import version2 from "jsr:@denotest/no_module_graph@^0.2";
console.log(version1);
console.log(version2);
diff --git a/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0/mod.ts b/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0/mod.ts
index 5b860b603..4ba0d8aaf 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0/mod.ts
+++ b/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0/mod.ts
@@ -1,5 +1,5 @@
-import { Other } from "jsr:@denotest/module_graph@1/other.ts";
-import version from "jsr:@denotest/no_module_graph@^0.1/mod.ts";
+import { Other } from "jsr:@denotest/module_graph@1/other";
+import version from "jsr:@denotest/no_module_graph@^0.1";
export default {
version,
diff --git a/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0_meta.json b/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0_meta.json
index c6236b7df..f60c65026 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0_meta.json
+++ b/cli/tests/testdata/jsr/registry/@denotest/deps/1.0.0_meta.json
@@ -1,16 +1,19 @@
{
+ "exports": {
+ ".": "./mod.ts"
+ },
"moduleGraph1": {
"/mod.ts": {
"dependencies": [{
"kind": "import",
- "range": [[0, 0], [0, 62]],
- "specifier": "jsr:@denotest/module_graph@1/other.ts",
- "specifierRange": [[0, 22], [0, 61]]
+ "range": [[0, 0], [0, 59]],
+ "specifier": "jsr:@denotest/module_graph@1/other",
+ "specifierRange": [[0, 22], [0, 58]]
}, {
"kind": "import",
- "range": [[1, 0], [1, 64]],
- "specifier": "jsr:@denotest/no_module_graph@^0.1/mod.ts",
- "specifierRange": [[1, 20], [1, 63]]
+ "range": [[1, 0], [1, 57]],
+ "specifier": "jsr:@denotest/no_module_graph@^0.1",
+ "specifierRange": [[1, 20], [1, 56]]
}]
}
}
diff --git a/cli/tests/testdata/jsr/registry/@denotest/module_graph/1.4.0_meta.json b/cli/tests/testdata/jsr/registry/@denotest/module_graph/1.4.0_meta.json
index d1e9a96b9..8745d72b9 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/module_graph/1.4.0_meta.json
+++ b/cli/tests/testdata/jsr/registry/@denotest/module_graph/1.4.0_meta.json
@@ -1,4 +1,8 @@
{
+ "exports": {
+ ".": "./mod.ts",
+ "./other": "./other.ts"
+ },
"moduleGraph1": {
"/mod.ts": {
"dependencies": [{
diff --git a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json
index 0967ef424..631a18d0e 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json
+++ b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json
@@ -1 +1,5 @@
-{}
+{
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json
index 0967ef424..631a18d0e 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json
+++ b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json
@@ -1 +1,5 @@
-{}
+{
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.2.0_meta.json b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.2.0_meta.json
index 0967ef424..631a18d0e 100644
--- a/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.2.0_meta.json
+++ b/cli/tests/testdata/jsr/registry/@denotest/no_module_graph/0.2.0_meta.json
@@ -1 +1,5 @@
-{}
+{
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs
index 75a559af1..ff8b8d62e 100644
--- a/cli/tools/doc.rs
+++ b/cli/tools/doc.rs
@@ -264,7 +264,7 @@ fn check_diagnostics(diagnostics: &[DocDiagnostic]) -> Result<(), AnyError> {
for (line, diagnostics_by_col) in diagnostics_by_lc {
for (col, diagnostics) in diagnostics_by_col {
for diagnostic in diagnostics {
- log::warn!("{}", diagnostic.kind);
+ log::warn!("{}", diagnostic.message());
}
log::warn!(
" at {}:{}:{}\n",
@@ -276,7 +276,7 @@ fn check_diagnostics(diagnostics: &[DocDiagnostic]) -> Result<(), AnyError> {
}
}
bail!(
- "Found {} documentation diagnostic{}.",
+ "Found {} documentation lint error{}.",
colors::bold(diagnostics.len().to_string()),
if diagnostics.len() == 1 { "" } else { "s" }
);
diff --git a/cli/tools/info.rs b/cli/tools/info.rs
index 9321eccb7..60c2fde95 100644
--- a/cli/tools/info.rs
+++ b/cli/tools/info.rs
@@ -669,6 +669,12 @@ impl<'a> GraphDisplayContext<'a> {
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
self.build_error_msg(specifier, "(missing)")
}
+ ModuleError::MissingWorkspaceMemberExports { .. } => {
+ self.build_error_msg(specifier, "(missing exports)")
+ }
+ ModuleError::UnknownExport { .. } => {
+ self.build_error_msg(specifier, "(unknown export)")
+ }
ModuleError::UnknownPackage { .. } => {
self.build_error_msg(specifier, "(unknown package)")
}