camel-case-extensions

Same as camel_case_extensions in Dart lints

Group
Style
Path
lint/style/camel-case-extensions
Default
On (recommended)
Origin
Dart lints
Rule
195 of 512
recommended

Flags named extensions whose name is not UpperCamelCase.

Extensions are types and should follow the same naming convention as classes and enums so that tooling and readers treat them consistently. Leading underscores are ignored for the check; the remainder must be one or more words, each starting with an uppercase letter or $. Unnamed extensions have no identifier to check and are skipped.

Invalid

example.dartdart
// Named extensions must be UpperCamelCase.

extension my_ext on int {}

extension foo_bar on String {}

extension lowercase on double {}

extension mixedCase on num {}

extension a on bool {}

extension _lower on List {}
Name extensions using `UpperCamelCase`.
2
3extension my_ext on int {}
Name extensions using `UpperCamelCase`.
4
5extension foo_bar on String {}
Name extensions using `UpperCamelCase`.
6
7extension lowercase on double {}
Name extensions using `UpperCamelCase`.
8
9extension mixedCase on num {}
Name extensions using `UpperCamelCase`.
10
11extension a on bool {}
Name extensions using `UpperCamelCase`.
12
13extension _lower on List {}

Valid

example.dartdart
// UpperCamelCase (or unnamed) extensions.

extension IntX on int {}

extension StringUtils on String {}

extension MyExtension on double {}

extension _Private on num {}

extension HTTPExt on bool {}

extension on List {}

Configure camel-case-extensions

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

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "camel-case-extensions": "error"
      }
    }
  }
}

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

example.dartdart
// falcon-ignore lint/style/camel-case-extensions: <reason>