flutter-style-todos

Same as flutter_style_todos in Dart lints

Group
Style
Path
lint/style/flutter-style-todos
Default
Off, opt in
Origin
Dart lints
Rule
237 of 512

Flags TODO comments that do not follow the Flutter style // TODO(username): message, https://URL-to-issue.

A TODO names who can explain it and, ideally, links an issue. A line comment starting with TODO (any case, any number of slashes) must read // TODO(name): with a name made of letters, digits, -, and .:

// TODO: implement            flagged
// todo(user) missing colon   flagged
/// TODO(user): add docs      flagged: doc comments are not TODOs
// TODO(user): implement, https://github.com/org/repo/issues/1

Invalid

example.dartdart
 // TODO: implement
 // todo(user) missing colon
 /// TODO(user): doc comments are not to-dos
 //TODO implement
 // TODO(): empty name
 // ToDo(user):missing space
void main() {
   // TODO(-user): name must start alphanumeric
}

int a = 1;
var s = '${a  // TODO wrong
}';
To-do comment doesn't follow the Flutter style.
1 // TODO: implement
To-do comment doesn't follow the Flutter style.
1 // TODO: implement
2 // todo(user) missing colon
To-do comment doesn't follow the Flutter style.
2 // todo(user) missing colon
3 /// TODO(user): doc comments are not to-dos
To-do comment doesn't follow the Flutter style.
3 /// TODO(user): doc comments are not to-dos
4 //TODO implement
To-do comment doesn't follow the Flutter style.
4 //TODO implement
5 // TODO(): empty name
To-do comment doesn't follow the Flutter style.
5 // TODO(): empty name
6 // ToDo(user):missing space
To-do comment doesn't follow the Flutter style.
7void main() {
8 // TODO(-user): name must start alphanumeric
To-do comment doesn't follow the Flutter style.
11int a = 1;
12var s = '${a // TODO wrong

Valid

example.dartdart
// TODO(user): implement, https://github.com/org/repo/issues/1
// TODO(user.name-2): message
//TODO(u): no leading space is fine
// TODOS are not to-dos
/* TODO: block comments are not checked */
// A comment mentioning a TODO later on.
void main() {
  // TODO(bob): handle errors
  var s = '// TODO: inside a string';
  print(s);
}

Configure flutter-style-todos

Set its severity in falcon.json. See the configuration guide.

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "flutter-style-todos": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore lint/style/flutter-style-todos: <reason>
  • format-commentformat-comment

    Flags comments that are not formatted as complete sentences.

  • implicit-call-tearoffsimplicit_call_tearoffs

    Explicitly 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-stringsleading_newlines_in_multiline_strings

    Flags a multiline string spanning several lines whose text does not start with a line break right after the opening quotes.

  • library-annotationslibrary_annotationsrecommended

    Requires library-targeted metadata to attach to a library directive.

  • library-nameslibrary_namesrecommended

    Flags a library name that is not lowercase_with_underscores.

  • library-prefixeslibrary_prefixesrecommended

    Flags import prefixes that are not lower_case_with_underscores.

  • lines-longer-than-80-charslines_longer_than_80_chars

    Flags source lines longer than 80 characters.