enum-constants-ordering
- Group
- Style
- Path
lint/style/enum-constants-ordering- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 232 of 512
Flags enum constants whose declared names violate the configured order.
Set order to "ascending" or "descending" to compare names
lexicographically and case-sensitively. Without a valid explicit order,
this rule is inactive. Constructor arguments and enum members do not affect
the comparison.
Invalid
enum Fruit { zebra, apple }
enum Color { red, blue }
enum Enhanced { zebra(1), apple(2); const Enhanced(this.value); final int value; }
enum Named { zebra.x(), apple.x(); const Named.x(); }
enum Middle { apple, zebra, berry }enum Fruit { zebra, apple }enum Fruit { zebra, apple }enum Color { red, blue }enum Color { red, blue }enum Enhanced { zebra(1), apple(2); const Enhanced(this.value); final int value; }enum Enhanced { zebra(1), apple(2); const Enhanced(this.value); final int value; }enum Named { zebra.x(), apple.x(); const Named.x(); }enum Named { zebra.x(), apple.x(); const Named.x(); }enum Middle { apple, zebra, berry }Valid
enum Fruit { apple, zebra }
enum Color { blue, red }
enum Enhanced { apple(1), zebra(2); const Enhanced(this.value); final int value; }
enum Single { apple }
enum Named { apple.x(), zebra.x(); const Named.x(); }Configure enum-constants-ordering
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"enum-constants-ordering": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/enum-constants-ordering: <reason>More style rules
- eol-at-end-of-file
eol_at_end_of_filerecommendedFlags a non-empty file that does not end with exactly one line break.
- extend-equatableequatable
Require Equatable semantics for configured class/file name patterns.
- file-names
file_namesrecommendedEnforces
lowercase_with_underscoresfor source file names. - flutter-style-todos
flutter_style_todosFlags
TODOcomments that do not follow the Flutter style// TODO(username): message, https://URL-to-issue. - format-comment
format-commentFlags comments that are not formatted as complete sentences.
- implicit-call-tearoffs
implicit_call_tearoffsExplicitly tear off callable objects' call methods.
- initializers-ordering
Requires field initializers to follow their containing type's field declaration order by default.
- leading-newlines-in-multiline-strings
leading_newlines_in_multiline_stringsFlags a multiline string spanning several lines whose text does not start with a line break right after the opening quotes.