deno/cli/tools
David Sherret d1ef561dbf
feat: deno doc --lint (#21032)
Adds a new `--lint` flag to `deno doc` that surfaces three kinds of
diagnostics:

1. Diagnostic for non-exported type referenced in an exported type.
* Why? People often forget to export types from a module in TypeScript.
To supress this diagnostic, add an `@internal` jsdoc tag to the internal
type.
1. Diagnostic for missing return type or missing property type on a
**public** type.
* Why? Otherwise `deno doc` will not display good documentation. Adding
explicit types also helps with type checking performance.
1. Diagnostic for missing jsdoc on a **public** type.
* Why? Everything should be documented. This diagnostic can be supressed
by adding a jsdoc comment description.

If the lint passes, `deno doc` generates documentation as usual.

For example, checking for deno doc diagnostics on the CI:

```shellsession
$ deno doc --lint mod.ts second_entrypoint.ts > /dev/null
```

This feature is incredibly useful for library authors.

## Why not include this in `deno lint`?

1. The command needs the documenation output in order to figure out the
diagnostics.
1. `deno lint` doesn't understand where the entrypoints are. That's
critical for the diagnostics to be useful.
1. It's much more performant to do this while generating documentation.
1. There is precedence in rustdoc (ex. `#![warn(missing_docs)]`).

## Why not `--check`?

It is confusing with `deno run --check`, since that means to run type
checking (and confusing with `deno check --docs`).

## Output Future Improvement

The output is not ideal atm, but it's fine for a first pass. We will
improve it in the future.

Closes https://github.com/denoland/deno_lint/pull/972
Closes https://github.com/denoland/deno_lint/issues/970
Closes https://github.com/denoland/deno/issues/19356
2023-10-31 18:19:42 -04:00
..
bench feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
coverage fix: improved using declaration support (#20959) 2023-10-24 09:37:02 -04:00
init fix(init): skip existing files instead of erroring (#20434) 2023-09-12 12:55:26 +02:00
jupyter chore: remove usage of chrono::Utc::now() (#20995) 2023-10-30 11:45:45 -04:00
repl refactor: upgrade to deno_ast 0.31 and deno_graph 0.59 (#20965) 2023-10-24 21:43:19 +00:00
run feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
test feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
vendor refactor: break out ModuleInfoCache from ParsedSourceCache (#20977) 2023-10-25 18:13:22 -04:00
bundle.rs feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
check.rs refactor(npm): break up NpmModuleLoader and move more methods into the managed CliNpmResolver (#20777) 2023-10-03 19:05:06 -04:00
compile.rs refactor: break out ModuleInfoCache from ParsedSourceCache (#20977) 2023-10-25 18:13:22 -04:00
doc.rs feat: deno doc --lint (#21032) 2023-10-31 18:19:42 -04:00
fmt.rs feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
info.rs refactor: upgrade to deno_ast 0.31 and deno_graph 0.59 (#20965) 2023-10-24 21:43:19 +00:00
installer.rs refactor: use "deno_config" crate (#20260) 2023-08-24 11:21:34 +02:00
lint.rs feat: deno run --unstable-hmr (#20876) 2023-10-31 01:25:58 +01:00
mod.rs feat: Add "deno jupyter" subcommand (#20337) 2023-09-16 02:42:09 +02:00
task.rs chore(task): remove warning for npm "scripts" (#20880) 2023-10-12 07:33:59 +01:00
upgrade.rs refactor: migrate more ops to op2 macro (#20808) 2023-10-07 21:04:03 +05:30