i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Analyzer reports non_constant_identifier_names on keys that contain underscores

Open MarcelGarus opened this issue 5 years ago • 1 comments
trafficstars

Our keys follow a hierarchy and we use underscores as a delimiter:

"app_emptyState_retry": "Try again",
"app_error_conflict": "Your changes conflict with changes someone else did at the same time.",
"app_error_noConnection": "No connection to the server.",
"app_error_noPermission": "You don't have the permission to do that.",
"app_error_rateLimit": "Too many requests. Try again in {timeToWait}.",
…

Thus, the generated code correctly contains getters named app_emptyState_retry etc.
Because we enabled pedantic analysis options in our project the analyzer complains about naming non-constant identifiers using lowerCamelCase. So, we get hundreds of linter errors once we generate the translation file.

Excluding files from the Dart analyzer seemingly won't work anytime soon (https://github.com/dart-lang/sdk/issues/25551), so would it be possible to add the following comment at the top of the file?

// ignore_for_file: non_constant_identifier_names

I'd be happy to file the PR.

MarcelGarus avatar Mar 24 '20 11:03 MarcelGarus

Any updates on this?

MarcelGarus avatar Apr 20 '20 11:04 MarcelGarus