dangling-library-doc-comments

Same as dangling_library_doc_comments in Dart lints

Group
Style
Path
lint/style/dangling-library-doc-comments
Default
On (recommended)
Origin
Dart lints
Rule
214 of 512
recommended

Attach library documentation to an explicit library directive. Line docs stay grouped across blank lines and ordinary comments; declarations report the doc token immediately before the first internal gap.

Invalid

example.dartdart
/// A library-level doc comment separated from the code below.

import 'dart:async';

void main() {}
Dangling library doc comment. Add a `library` directive or attach it to a declaration.
1/// A library-level doc comment separated from the code below.

Valid

example.dartdart
/// A widget that documents the class directly below it.
// An ordinary comment does not detach the documentation.
class Widget {}

Configure dangling-library-doc-comments

Set its severity in falcon.json. See the configuration guide.

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "dangling-library-doc-comments": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore lint/style/dangling-library-doc-comments: <reason>
  • deprecated-consistencydeprecated_consistencyrecommended

    Flags deprecations that are not carried through to related declarations.

  • directives-orderingdirectives_ordering

    Flags import and export directives that break the Effective Dart ordering.

  • do-not-use-environmentdo_not_use_environment

    Disallow reading compilation environment declarations, including type aliases.

  • double-literal-formatdouble-literal-format

    Flags double literals written with redundant or missing digits.

  • empty-constructor-bodiesempty_constructor_bodiesrecommended

    Flags constructors with an empty block body {}.

  • enum-constants-ordering

    Flags enum constants whose declared names violate the configured order.

  • eol-at-end-of-fileeol_at_end_of_filerecommended

    Flags a non-empty file that does not end with exactly one line break.

  • extend-equatableequatable

    Require Equatable semantics for configured class/file name patterns.