Rules / Style / dangling-library-doc-comments
dangling-library-doc-comments
Flags a file-level /// doc comment that is not attached to any declaration.
A doc comment floating at the top of a file — separated from the first
declaration by a blank line, sitting above a directive, or ending the file —
is silently dropped by the documentation tooling. If it is meant to describe
the library, attach it to an explicit library directive; otherwise move it
onto the declaration it documents. Only the first such comment block in a
file is reported.
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.
class Widget {}
How to configure
Set the severity of dangling-library-doc-comments in your falcon.json:
falcon.jsonjson
{
"linter": {
"rules": {
"style": {
"dangling-library-doc-comments": "error"
}
}
}
}