no-import-cycles
- Group
- Correctness
- Path
cross-file/correctness/no-import-cycles- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 287 of 512
Cross-file rule. It runs in falcon's whole-project pass, analyzing relationships across every file rather than one file at a time. Configure it under the top-level cross-file key.
Report mutually dependent components of imported or exported library files.
Cycles couple libraries and make dependency boundaries harder to maintain.
Each diagnostic includes the complete chain, ending back at its first file.
Import and export targets include every conditional alternative; part and
part of directives are not dependency edges. Only analyzed, resolved files
participate; package URIs without a known package identity are skipped.
Canonical path aliases and repeated directives share one edge.
Each mutually dependent component is reported once, including self-imports.
The chain is a shortest cycle through its lexicographically first canonical
file, not an enumeration of all cycles within that component.
Configure this project-wide rule under the cross-file section.
Invalid
export 'stub.dart'
if (dart.library.html) 'b.dart';export 'stub.dart' if (dart.library.html) 'b.dart';Configure no-import-cycles
Set its severity in falcon.json under the cross-file section. See the configuration guide.
{
"cross-file": {
"rules": {
"correctness": {
"no-import-cycles": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore cross-file/correctness/no-import-cycles: <reason>More correctness rules
- no-logic-in-create-state
no_logic_in_create_staterecommendedflutterRequire
StatefulWidget.createStateto return only a fresh zero-argument FlutterStateconstruction. - no-self-assignments
no_self_assignmentsrecommendedFlags assignments of a variable to itself, such as
x = x;. - null-check-on-nullable-type-parameter
null_check_on_nullable_type_parameterrecommendedFlags a null assertion
x!on a nullable type parameterT?whose expected type isTorT?for a potentially nullableT, and null-assert patterns whose matched value is a nullable type parameter. - null-closures
null_closuresrecommendedReject literal
nullin the closure slots of curated SDK APIs. - prefer-correct-json-casts
Decode JSON containers using their actual runtime generic types.
- prefer-define-hero-tagflutter
Require an explicit heroTag on Flutter
FloatingActionButtonconstructors. - prefer-expect-latertest
Requires expectLater when a canonical expect call receives an unawaited Future.
- prefer-immutable-bloc-eventsrecommendedbloc
Flags Bloc event classes without an explicit @immutable annotation.