record-fields-ordering
- Group
- Style
- Path
lint/style/record-fields-ordering- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 428 of 512
Flags named record type fields that violate the configured order.
Set order to "ascending" or "descending" for case-sensitive
lexicographic ordering. Without a valid explicit order, this rule is inactive.
Named fields are checked independently for each record type. Positional fields
and record literals are ignored; reordering literal expressions can change effects.
Invalid
typedef First = ({int zebra, int apple});
typedef Mixed = (int, {int zebra, int apple});
typedef Nested = ({({int zebra, int apple}) outer});
({int zebra, int apple}) typed = (apple: 1, zebra: 2);
typedef Named = ({int zebra, int apple});typedef First = ({int zebra, int apple});typedef First = ({int zebra, int apple});typedef Mixed = (int, {int zebra, int apple});typedef Mixed = (int, {int zebra, int apple});typedef Nested = ({({int zebra, int apple}) outer});typedef Nested = ({({int zebra, int apple}) outer});({int zebra, int apple}) typed = (apple: 1, zebra: 2);({int zebra, int apple}) typed = (apple: 1, zebra: 2);typedef Named = ({int zebra, int apple});Valid
typedef Sorted = ({int apple, int zebra});
typedef Positional = (String, String);
typedef Mixed = (int, {int apple, int zebra});
typedef Singleton = ({int zebra});
({int apple, int zebra}) typed = (apple: 1, zebra: 2);
typedef Named = ({int apple, int zebra});
final unsortedLiteral = (zebra: 1, apple: 2);Configure record-fields-ordering
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"record-fields-ordering": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/record-fields-ordering: <reason>More style rules
- require-trailing-commas
require_trailing_commasFlags a multi-line call, declaration, assert, or collection literal that is missing a trailing comma.
- sized-box-shrink-expand
sized_box_shrink_expandrecommendedflutterPrefers
SizedBox.shrink()/SizedBox.expand()over aSizedBoxsized to zero or infinity. - slash-for-doc-comments
slash_for_doc_commentsrecommendedFlags
/** ... - sort-child-properties-last
sort_child_properties_lastrecommendedflutterSort Widget-valued child properties last, except before closure arguments.
- sort-constructors-first
sort_constructors_firstFlags a constructor declared after a non-constructor member.
- sort-unnamed-constructors-first
sort_unnamed_constructors_firstFlags an unnamed constructor declared after a named constructor.
- tighten-type-of-initializing-formals
tighten_type_of_initializing_formalsFlags a nullable
this.xorsuper.xinitializing formal whose constructor assertsx != null. - type-annotate-public-apis
type_annotate_public_apisrecommendedRequires type annotations on public declarations.