unnecessary-library-name

Same as unnecessary_library_name in Dart lints

Group
Style
Path
lint/style/unnecessary-library-name
Default
On (recommended)
Origin
Dart lints
Rule
460 of 512
recommended

Flags a library directive that carries an explicit name.

Since Dart 2.19 the library directive no longer needs a name: part of directives can reference their parent by URI, and library-level doc comments and annotations attach to a bare library;. A named library is legacy syntax that only adds a global identifier which can collide across packages. Remove the name, keeping the library; directive itself if it anchors documentation or annotations.

Invalid

example.dartdart
library foo;
Library names are not necessary.
1library foo;

Valid

example.dartdart
library;

class Model {}

Configure unnecessary-library-name

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

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "unnecessary-library-name": "error"
      }
    }
  }
}

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

example.dartdart
// falcon-ignore lint/style/unnecessary-library-name: <reason>