sort-pub-dependencies
Same as sort_pub_dependencies in Dart lints
- Group
- Correctness
- Path
cross-file/correctness/sort-pub-dependencies- Default
- Off, opt in
- Origin
- Dart lints
- Rule
- 438 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.
Require pubspec.yaml dependency sections to be sorted alphabetically.
The dependencies,
dev_dependencies, and dependency_overrides mappings of every package
pubspec.yaml enclosing an analyzed file are walked in source order, and
the first package name that sorts before its predecessor is reported; like
the official rule, each section reports at most one name (the first break in
the order) so that fixing it and re-running converges. Names compare by
UTF-16 code units, exactly as Dart's String.compareTo, so Zebra sorts
before apple. Malformed YAML (including duplicate keys) and non-mapping
sections are skipped. This is a cross-file rule because it reads the package
manifest rather than Dart source.
Invalid
void main() {}No diagnostics in this file.
Configure sort-pub-dependencies
Set its severity in falcon.json under the cross-file section. See the configuration guide.
{
"cross-file": {
"rules": {
"correctness": {
"sort-pub-dependencies": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore cross-file/correctness/sort-pub-dependencies: <reason>More correctness rules
- test-types-in-equals
test_types_in_equalsrecommendedFlags casting the parameter of
operator ==instead of testing its type. - throw-in-finally
throw_in_finallyrecommendedFlags
throwinside afinallyblock. - type-literal-in-constant-pattern
type_literal_in_constant_patternrecommendedDon't use constant patterns whose expressions have the core
Typetype. - undeclared-dependenciescross-file
Report package imports and exports missing from the enclosing pubspec.
- unnecessary-flutter-importsrecommendedflutter
Disallow unused Flutter framework and
dart:asyncimports. - unnecessary-nullable
check-unnecessary-nullablecross-fileFlags private function or method parameters whose nullable type is unnecessary.
- unnecessary-nullable-return-type
unnecessary_nullable_return_typeDisallow nullable return types on functions that never return null.
- unnecessary-statements
unnecessary_statementsrecommendedFlags expression statements whose expression has no clear effect.