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

Add Dart linters to the packages #561

Closed
tenhobi opened this issue Oct 10, 2019 · 12 comments
Closed

Add Dart linters to the packages #561

tenhobi opened this issue Oct 10, 2019 · 12 comments
Assignees
Labels
enhancement New feature or request
Projects

Comments

@tenhobi
Copy link
Collaborator

tenhobi commented Oct 10, 2019

None of the packages uses lints in it's analysis_options.yaml file. (Except Angular which does have a few.)

My propose is to add more linters, so the code could easilly follow the same standards.

Maybe you know the package:pedantic Google internally uses as lints list. A few days ago I have made the package:effective_dart (https://github.com/tenhobi/effective_dart) which follows the Effecive Dart guide's lints, which I believe is suitable for our purpose.

Alternatively, we can make our own list, but the Effective Dart guide provides a good set of rule, I believe.

@felangel
Copy link
Owner

Hi @tenhobi 👋
Thanks for opening an issue!

I’ll definitely take a look at how effective_dart compares with pedantic and hopefully add one 👍. Thanks for bringing this up!

@felangel felangel self-assigned this Oct 10, 2019
@felangel felangel added the enhancement New feature or request label Oct 10, 2019
@felangel felangel added this to To do in bloc Oct 10, 2019
@tenhobi
Copy link
Collaborator Author

tenhobi commented Oct 22, 2019

Btw. also check https://github.com/dart-lang/linter/tree/master/example and https://github.com/dart-lang/linter#usage for more info. (btw. as for now, effective dart repo is also mentioned there) 🙂

@felangel
Copy link
Owner

Awesome, I’ll try to take a look today 👍

@tenhobi
Copy link
Collaborator Author

tenhobi commented Oct 24, 2019

Another reason why to use lints according the effective dart guide is that you can now add this super cool badge to your collection. 🤣

style: effective dart

(just a joke ofc, consider what suits best for the project)

@felangel
Copy link
Owner

@tenhobi can you go over the differences between effective_dart and pedantic?

@tenhobi
Copy link
Collaborator Author

tenhobi commented Oct 24, 2019

Basically, package:effective_dart attempts to comply with all Effective Dart guide rules which are described in that guide. package:pedantic sets only a limited subset of those rules (partial implementation) and maybe some other rules as well (which is not mentioned by the effective dart guide).

You can check the diff of https://github.com/tenhobi/effective_dart/blob/master/lib/analysis_options.1.0.0.yaml and https://github.com/dart-lang/pedantic/blob/master/lib/analysis_options.1.8.0.yaml.

The Effective Dart is the ideal state – the guide describes what you should do and don't do (and avoid, prefer, or concider) in your Dart project.


Or this is how I understand it. I like using the effective dart guide and I feel no real limitations.

@felangel
Copy link
Owner

@tenhobi thanks for the clarification 👍

I want to evaluate what the implications (if any) would be tomorrow (flying back from vacation 😛) and then can quickly make the updates if everything looks good. Thanks!

@tenhobi
Copy link
Collaborator Author

tenhobi commented Oct 24, 2019

Sure, check both styles and evaluate. You can also easily see what lints are used using http://dart-lang.github.io/linter/lints/ page. Tho I will add support for showing effective_dart tomorrow (tenhobi/effective_dart#1).

Wow, flying from vacation and you did so much last days!

@felangel
Copy link
Owner

Wow, flying from vacation and you did so much last days!

Haha I tried to do what I can here and there on my phone 😛

@tenhobi
Copy link
Collaborator Author

tenhobi commented Oct 28, 2019

Thx for your work!

@bernaferrari
Copy link
Contributor

I missed this issue, only saw it today. I would like to say thanks to @felangel and all. I recently also added analysis_options to my app, and to my surprise there were maaaany issues. I got even more surprised since some of the issues were in my blocs, and most of them (at least their structure) were copied from the official samples. That meant samples weren't following the analyser.

But now they do. So no one will ever get again the warnings I got! Yaaay!

@tenhobi
Copy link
Collaborator Author

tenhobi commented Nov 7, 2019

@bernaferrari it might not be an issue in general. Lints provides also (opinionated) styles how you write your code. And the official samples might follow a different set of rules, for some reason.

But it is a good idea to follow some set of rules for sure, to keep your project in one style.

Check https://github.com/tenhobi/effective_dart for Effective Dart rules. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
bloc
  
Done
Development

No branches or pull requests

3 participants