Skip to content

proposal: dartdoc_macro_reference #58914

Open
@rrousselGit

Description

@rrousselGit

dartdoc_macro_reference

Description

"Only use macros with pre-defined templates"

Details

Currently, there is no safeguard for dartdoc macros.

When writing:

/// {@macro whatever}
var x;

there is nothing that checks whatever matches with a valid {@template whatever} defined previously.

So if a typo is made when using the macro, or if somehow during refactoring a template is renamed/removed, this would break the documentation.

A lint cold be added to verify that the macro string correctly has a template

Kind

info, like most of the other lints

Good Examples

/// {@template whatever}
/// {@endtemplate}
var a;

/// {@macro whatever} // "whatever" correctly exists as a template
var b;

Bad Examples

/// {@template whatever}
/// {@endtemplate}
var a;

/// {@macro not_found} 
     ^^^^^^^ // There's no template with the key "not_found"
var b;

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.closed-not-plannedClosed as we don't intend to take action on the reported issuedevexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions