dart-lang / i18n

A general mono-repo for Dart i18n and l10n packages.
BSD 3-Clause "New" or "Revised" License
64 stars 39 forks source link

Enhance generated code to comply to lint #598

Open pueffl opened 4 years ago

pueffl commented 4 years ago

When including lint analysis_options (include: package:lint/analysisoptions.yaml), the generated code for messages*.dart no longer works.

Please change one of the following:

static _notInlinedMessages(_) => <String, Function>{
        "enterEmailAddress": MessageLookupByLibrary.simpleMessage(
            "Please enter you email address"),
        "preferencesGlobal":
            MessageLookupByLibrary.simpleMessage("Global Settings"),
        "preferencesTitle": MessageLookupByLibrary.simpleMessage("Settings")
      };

becomes

static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
        "enterEmailAddress": MessageLookupByLibrary.simpleMessage(
            "Please enter you email address") as Function,
        "preferencesGlobal":
            MessageLookupByLibrary.simpleMessage("Global Settings") as Function,
        "preferencesTitle": MessageLookupByLibrary.simpleMessage("Settings") as Function
      };
pueffl commented 4 years ago

I have 2 additional requests:

jpc-ae commented 4 years ago

Not all lints can be accounted for as some are mutually exclusive. Using effective_dart, I only have 3 lints that are giving suggestions, which I believe should be accounted for somehow:

Edit: In any case, this issue should probably be on intl_translation, not intl. I've created a pull request over there for ignoring the three lints I've mentioned.