Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add require-jsdoc rule #972

Closed
wants to merge 5 commits into from
Closed

feat: add require-jsdoc rule #972

wants to merge 5 commits into from

Conversation

ah-yu
Copy link
Contributor

@ah-yu ah-yu commented Nov 15, 2021

ref #970

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ah-yu it looks good so far, but I believe we need to do it for more than just functions? Also, I think perhaps this should also look at public members of classes/interfaces?

}
}

fn check_jsdoc_exsit<'c>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: check_jsdoc_exists

@ah-yu
Copy link
Contributor Author

ah-yu commented Nov 16, 2021

added interfaces/classes jsdoc comment checks.
eslint-plugin-jsdoc/require-jsdoc only checks FunctionDeclaration by default, should we check classes/interfaces by default?
ref: https://github.com/gajus/eslint-plugin-jsdoc#require

@ah-yu ah-yu requested a review from dsherret November 16, 2021 11:36
@ah-yu ah-yu closed this Nov 19, 2021
@bartlomieju
Copy link
Member

@ah-yu the PR looked okay, what's the reason to close it?

@bartlomieju bartlomieju reopened this Dec 1, 2021
@bartlomieju
Copy link
Member

@dsherret please review, should we add more feature before landing?

@ah-yu
Copy link
Contributor Author

ah-yu commented Dec 2, 2021

@bartlomieju Sorry for late response, I was kind of busy those days so I closed this PR. And I'd like to finish it.

@iuioiua
Copy link
Contributor

iuioiua commented Dec 20, 2022

Hi @ah-yu, is there any way we could progress this PR? This change could be valuable for modules that'd like to enforce documentation.

@dsherret dsherret removed their request for review January 31, 2023 23:14
@sigmaSd
Copy link
Contributor

sigmaSd commented Jun 27, 2023

It would be definitely great to have something like rust #![warn(missing_docs)] hopefully this gets picked up again, its really useful for library authors (and in my opinion it should be opt in like rust's)

dsherret added a commit to denoland/deno that referenced this pull request Oct 31, 2023
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 denoland/deno_lint#972
Closes denoland/deno_lint#970
Closes #19356
@dsherret
Copy link
Member

Thanks, but we ended up going with a much more powerful linting system as part of deno doc. For details, see this PR denoland/deno#21032

@ah-yu ah-yu deleted the feat/jsdoc branch November 1, 2023 00:03
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants