Rules / Style / use-string-in-part-of-directives

use-string-in-part-of-directives

lint/style/use-string-in-part-of-directives
recommended
Same as use_string_in_part_of_directives · Dart lints

Flags a part of directive that names its library instead of using a string URI.

A part of my.library.name; directive identifies the enclosing library by its declared name, which forces the parent to carry a library name and couples the part to it indirectly. The URI form, part of 'parent.dart';, points straight at the containing file, is more robust, and is the form modern Dart tooling prefers. The rule reports only the named form (a non-empty dotted name with no string URI).

Invalid

example.dartdart
part of foo;
Use a string to refer to the containing library in a part-of directive.
1part of foo;

Valid

example.dartdart
part of 'main.dart';

How to configure

Set the severity of use-string-in-part-of-directives in your falcon.json:

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "use-string-in-part-of-directives": "error"
      }
    }
  }
}