library-annotations

Same as library_annotations in Dart lints

Group
Style
Path
lint/style/library-annotations
Default
On (recommended)
Origin
Dart lints
Rule
251 of 512
recommended

Requires library-targeted metadata to attach to a library directive.

Invalid

example.dartdart
@TestOn('browser')
import 'package:test/test.dart';
@pragma('dart2js:late:trust')
export 'other.dart';
void main() {}
Attach library annotations to a library directive.
1@TestOn('browser')
Attach library annotations to a library directive.
2import 'package:test/test.dart';
3@pragma('dart2js:late:trust')

Valid

example.dartdart
@TestOn('browser')
library;
import 'package:test/test.dart';
void main() {}

class pragma {
  const pragma(String value);
}

@pragma('dart2js:late:trust')
class LocalPragma {}

Configure library-annotations

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

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

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

example.dartdart
// falcon-ignore lint/style/library-annotations: <reason>
  • library-nameslibrary_namesrecommended

    Flags a library name that is not lowercase_with_underscores.

  • library-prefixeslibrary_prefixesrecommended

    Flags import prefixes that are not lower_case_with_underscores.

  • lines-longer-than-80-charslines_longer_than_80_chars

    Flags source lines longer than 80 characters.

  • map-keys-ordering

    Flags literal string map keys that violate the configured order.

  • matching-super-parametersmatching_super_parameters

    Flags positional super parameters named differently from the super constructor's corresponding parameter.

  • member-orderingmember-ordering

    Flags class members declared out of the configured order.

  • missing-whitespace-between-adjacent-stringsmissing_whitespace_between_adjacent_stringsrecommended

    Flags adjacent string literals that join two words without a space between them.

  • newline-before-break

    Requires a blank line before a break that follows another statement.