mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
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
This commit is contained in:
parent
882c54d5c4
commit
b78c7130e9
17 changed files with 62 additions and 35 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -1155,9 +1155,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_doc"
|
name = "deno_doc"
|
||||||
version = "0.72.2"
|
version = "0.73.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "48c00aff446bb7a0b9ef34418420650ee803e41251c034b9a944538dc80f1b65"
|
checksum = "588c797bd98677e0174ccc3baba8fc2a177f4f91833d74bfdc1ef5d568053618"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -1178,9 +1178,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_emit"
|
name = "deno_emit"
|
||||||
version = "0.31.1"
|
version = "0.31.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bad504e08884056bc559364364db9bc7308bd8cfda3679819656821eb7a5ce8"
|
checksum = "b74248b5f2f1df9d657896f47baded6b93c904c71532eab1435e9f3f0d7bd4b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.13.1",
|
"base64 0.13.1",
|
||||||
|
@ -1245,9 +1245,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_graph"
|
name = "deno_graph"
|
||||||
version = "0.59.2"
|
version = "0.60.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "000084f91f8d5d7de1b8fe3caa9fd098618d60d202237da1e20ee84bd8180f12"
|
checksum = "64069da5890ef2d9133199a62d712500529f079dc1bd3a3fe488e64e433ac8ea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -2201,9 +2201,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eszip"
|
name = "eszip"
|
||||||
version = "0.55.2"
|
version = "0.55.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1039ee8563878c6578b7595b6020590e66fecc69c66150535f83dede4ce96d5e"
|
checksum = "0bb98b2524f3d81760c4c86bca8ac2481a8093ef48578446a178544cdabd161f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.21.4",
|
"base64 0.21.4",
|
||||||
|
|
|
@ -49,16 +49,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra
|
||||||
deno_cache_dir = "=0.6.1"
|
deno_cache_dir = "=0.6.1"
|
||||||
deno_config = "=0.5.0"
|
deno_config = "=0.5.0"
|
||||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||||
deno_doc = { version = "=0.72.2", features = ["html"] }
|
deno_doc = { version = "=0.73.0", features = ["html"] }
|
||||||
deno_emit = "=0.31.1"
|
deno_emit = "=0.31.2"
|
||||||
deno_graph = "=0.59.2"
|
deno_graph = "=0.60.0"
|
||||||
deno_lint = { version = "=0.52.2", features = ["docs"] }
|
deno_lint = { version = "=0.52.2", features = ["docs"] }
|
||||||
deno_lockfile.workspace = true
|
deno_lockfile.workspace = true
|
||||||
deno_npm = "0.15.2"
|
deno_npm = "0.15.2"
|
||||||
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] }
|
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] }
|
||||||
deno_semver = "0.5.1"
|
deno_semver = "0.5.1"
|
||||||
deno_task_shell = "=0.14.0"
|
deno_task_shell = "=0.14.0"
|
||||||
eszip = "=0.55.2"
|
eszip = "=0.55.3"
|
||||||
napi_sym.workspace = true
|
napi_sym.workspace = true
|
||||||
|
|
||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
|
|
|
@ -36,6 +36,8 @@ fn get_module_graph_error_class(err: &ModuleGraphError) -> &'static str {
|
||||||
| ModuleError::UnsupportedImportAttributeType { .. } => "TypeError",
|
| ModuleError::UnsupportedImportAttributeType { .. } => "TypeError",
|
||||||
ModuleError::Missing(_, _)
|
ModuleError::Missing(_, _)
|
||||||
| ModuleError::MissingDynamic(_, _)
|
| ModuleError::MissingDynamic(_, _)
|
||||||
|
| ModuleError::MissingWorkspaceMemberExports { .. }
|
||||||
|
| ModuleError::UnknownExport { .. }
|
||||||
| ModuleError::UnknownPackage { .. }
|
| ModuleError::UnknownPackage { .. }
|
||||||
| ModuleError::UnknownPackageReq { .. } => "NotFound",
|
| ModuleError::UnknownPackageReq { .. } => "NotFound",
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn specifiers_in_lockfile() {
|
||||||
|
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"main.ts",
|
"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);"#,
|
console.log(version);"#,
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Type 'MyClass' references type 'MyInterface' which is not exported from a root module.
|
Missing JSDoc comment.
|
||||||
Missing JS documentation comment.
|
|
||||||
at file:///[WILDCARD]/referenced_private_types.ts:5:1
|
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
|
at file:///[WILDCARD]/referenced_private_types.ts:6:3
|
||||||
|
|
||||||
error: Found 3 documentation diagnostics.
|
error: Found 3 documentation lint errors.
|
||||||
|
|
2
cli/tests/testdata/jsr/deps/main.ts
vendored
2
cli/tests/testdata/jsr/deps/main.ts
vendored
|
@ -1,3 +1,3 @@
|
||||||
import value from "jsr:@denotest/deps/mod.ts";
|
import value from "jsr:@denotest/deps";
|
||||||
|
|
||||||
console.log(value);
|
console.log(value);
|
||||||
|
|
2
cli/tests/testdata/jsr/module_graph/main.ts
vendored
2
cli/tests/testdata/jsr/module_graph/main.ts
vendored
|
@ -1,3 +1,3 @@
|
||||||
import { Test } from "jsr:@denotest/module_graph/mod.ts";
|
import { Test } from "jsr:@denotest/module_graph";
|
||||||
|
|
||||||
console.log(new Test());
|
console.log(new Test());
|
||||||
|
|
|
@ -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(version);
|
||||||
console.log(new TestClass());
|
console.log(new TestClass());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import version1 from "jsr:@denotest/no_module_graph@0.1.0/mod.ts";
|
import version1 from "jsr:@denotest/no_module_graph@0.1.0";
|
||||||
import version2 from "jsr:@denotest/no_module_graph@^0.2/mod.ts";
|
import version2 from "jsr:@denotest/no_module_graph@^0.2";
|
||||||
|
|
||||||
console.log(version1);
|
console.log(version1);
|
||||||
console.log(version2);
|
console.log(version2);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Other } from "jsr:@denotest/module_graph@1/other.ts";
|
import { Other } from "jsr:@denotest/module_graph@1/other";
|
||||||
import version from "jsr:@denotest/no_module_graph@^0.1/mod.ts";
|
import version from "jsr:@denotest/no_module_graph@^0.1";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
version,
|
version,
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
{
|
{
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts"
|
||||||
|
},
|
||||||
"moduleGraph1": {
|
"moduleGraph1": {
|
||||||
"/mod.ts": {
|
"/mod.ts": {
|
||||||
"dependencies": [{
|
"dependencies": [{
|
||||||
"kind": "import",
|
"kind": "import",
|
||||||
"range": [[0, 0], [0, 62]],
|
"range": [[0, 0], [0, 59]],
|
||||||
"specifier": "jsr:@denotest/module_graph@1/other.ts",
|
"specifier": "jsr:@denotest/module_graph@1/other",
|
||||||
"specifierRange": [[0, 22], [0, 61]]
|
"specifierRange": [[0, 22], [0, 58]]
|
||||||
}, {
|
}, {
|
||||||
"kind": "import",
|
"kind": "import",
|
||||||
"range": [[1, 0], [1, 64]],
|
"range": [[1, 0], [1, 57]],
|
||||||
"specifier": "jsr:@denotest/no_module_graph@^0.1/mod.ts",
|
"specifier": "jsr:@denotest/no_module_graph@^0.1",
|
||||||
"specifierRange": [[1, 20], [1, 63]]
|
"specifierRange": [[1, 20], [1, 56]]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts",
|
||||||
|
"./other": "./other.ts"
|
||||||
|
},
|
||||||
"moduleGraph1": {
|
"moduleGraph1": {
|
||||||
"/mod.ts": {
|
"/mod.ts": {
|
||||||
"dependencies": [{
|
"dependencies": [{
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
{}
|
{
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
{}
|
{
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
{}
|
{
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ fn check_diagnostics(diagnostics: &[DocDiagnostic]) -> Result<(), AnyError> {
|
||||||
for (line, diagnostics_by_col) in diagnostics_by_lc {
|
for (line, diagnostics_by_col) in diagnostics_by_lc {
|
||||||
for (col, diagnostics) in diagnostics_by_col {
|
for (col, diagnostics) in diagnostics_by_col {
|
||||||
for diagnostic in diagnostics {
|
for diagnostic in diagnostics {
|
||||||
log::warn!("{}", diagnostic.kind);
|
log::warn!("{}", diagnostic.message());
|
||||||
}
|
}
|
||||||
log::warn!(
|
log::warn!(
|
||||||
" at {}:{}:{}\n",
|
" at {}:{}:{}\n",
|
||||||
|
@ -276,7 +276,7 @@ fn check_diagnostics(diagnostics: &[DocDiagnostic]) -> Result<(), AnyError> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bail!(
|
bail!(
|
||||||
"Found {} documentation diagnostic{}.",
|
"Found {} documentation lint error{}.",
|
||||||
colors::bold(diagnostics.len().to_string()),
|
colors::bold(diagnostics.len().to_string()),
|
||||||
if diagnostics.len() == 1 { "" } else { "s" }
|
if diagnostics.len() == 1 { "" } else { "s" }
|
||||||
);
|
);
|
||||||
|
|
|
@ -669,6 +669,12 @@ impl<'a> GraphDisplayContext<'a> {
|
||||||
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
|
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
|
||||||
self.build_error_msg(specifier, "(missing)")
|
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 { .. } => {
|
ModuleError::UnknownPackage { .. } => {
|
||||||
self.build_error_msg(specifier, "(unknown package)")
|
self.build_error_msg(specifier, "(unknown package)")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue