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

[Proposal] Lint rule or analyzer code for unresolved DartDoc symbols, post @docImport introduction #56878

Closed
navaronbracke opened this issue Oct 10, 2024 · 5 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@navaronbracke
Copy link

With the new @docImport feature, I was looking for a way to have unresolved doc references be flagged, since we now have an extra option of dealing with this problem.

We do have #55414 for a similar case: Warn when a doc import is unused.

However, it would be nice if we had a rule for unresolved doc references in DartDoc.
For example:

/// This class references an unresolved class [Bar].
class Foo {}

This would warn on [Bar] not being found. It could suggest either:

  • adding a @docImport
  • importing the library normally
  • fixing the reference if it was a typo or if the symbol no longer exists (which could be the case if docs were not updated)

I think that if we implement something like this, it could be very helpful for the quality of DartDoc in IDE's.

I'm not sure if this should become a code in the analyzer (like the issue mentioned above) or a lint rule.

@dart-github-bot
Copy link
Collaborator

Summary: The user proposes a new lint rule or analyzer code to flag unresolved DartDoc symbols, leveraging the @docImport feature. This would help improve DartDoc quality by identifying and suggesting fixes for unresolved references within documentation comments.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-enhancement A request for a change that isn't a bug labels Oct 10, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Oct 13, 2024
@pq
Copy link
Member

pq commented Oct 15, 2024

/fyi @srawlins

@pq pq added the P2 A bug or feature request we're likely to work on label Oct 15, 2024
@srawlins
Copy link
Member

This is the comment_references lint rule.

@pq
Copy link
Member

pq commented Oct 15, 2024

@navaronbracke: check out comment_references and if it doesn't work for you please re-open this request with more details. Thanks!

@pq pq closed this as completed Oct 15, 2024
@navaronbracke
Copy link
Author

TIL about that lint. Working as expected, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants