Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linter] Some linter issues #49

Closed
bounty1342 opened this issue May 19, 2021 · 9 comments · Fixed by #50
Closed

[Linter] Some linter issues #49

bounty1342 opened this issue May 19, 2021 · 9 comments · Fixed by #50

Comments

@bounty1342
Copy link

Ignore or fix :
sort_constructors_first
always_specify_types

Fix :
prefer_const_constructors

  static final Set<Locale> supportedLocals = {
    Locale('en', 'US'),
    Locale('fr', 'FR'),
  };

Regards

@defuncart
Copy link
Collaborator

defuncart commented May 20, 2021

@bounty1342 What version of flappy_translator are you using? And what analyzer settings are you using? Even with pedantic I haven't seen prefer_const_constructors warning for supportedLocals.

I'll take a deeper look into this. In the meantime you can update analysis_options.yaml:

analyzer:
  exclude: lib/i18n.dart

@bounty1342
Copy link
Author

Hi,

Thanks you for looking into this.
Fyi, excluding from the analyser remove the auto-import feature.
So not very practical to manually import the class each time you use it 😉

Regards

@bounty1342
Copy link
Author

There is also this one : "avoid_escaping_inner_quotes".

@bounty1342
Copy link
Author

@defuncart :

flappy_translator: ^2.0.0-nullsafety.1
lint: ^1.5.3

@defuncart
Copy link
Collaborator

@bounty1342 Using the package's example, I cannot reproduce these warnings. bugfix/linter-issues

Can you provide a minimal reproducible example?

@bounty1342
Copy link
Author

Hi @defuncart,
you can find a minimal projet there :
test_flappy.zip

Screenshot 2021-05-24 at 14 20 47
Screenshot 2021-05-24 at 14 21 03

Concerning the linting exclusion, there is an open issue since 2016 : dart-lang/linter#320
But in the meantime, it also exclude it from the analyser, forbidding import.

Pedantic define only a subset of the linting rules :

If you could just add the one below to //ignore_for_file: it will avoid lint errors for those without breaking anything :)

avoid_escaping_inner_quotes
prefer_const_constructors
sort_constructors_first
always_specify_types

So if I understand correctly change the line in FlappyTranslator/lib/src/services/code_generation/template.dart :
// ignore_for_file: public_member_api_docs, prefer_single_quotes, avoid_escaping_inner_quotes, prefer_const_constructors, sort_constructors_first, always_specify_types

Regards

@defuncart
Copy link
Collaborator

@bounty1342 Thanks for the detailed MRE. Can you test if this fix solves this issue for you?

flappy_translator:
  git:
    url: https://github.com/smartnsoft/FlappyTranslator
    ref: bugfix/linter-issues

@bounty1342
Copy link
Author

Hi,

Thanks, it does fix the linting issues.

Thank you.

@defuncart
Copy link
Collaborator

@bounty1342 I've pushed pre-release 2.0.0-nullsafety.2. Let me know if you spot another other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants