dart-lang / linter

Linter for Dart.
https://dart.dev/tools/linter-rules
BSD 3-Clause "New" or "Revised" License
636 stars 170 forks source link

What are the default lints enforced? #1363

Closed jonasfj closed 5 years ago

jonasfj commented 5 years ago

What are the default lints enforced...

Reading the README I would expect to learn what happens when I run dartanalyzer. I don't configure lints for most of my projects, and just assume that some sane defaults are present.

Reading the README:

The linter gives you feedback to help you catch potential errors and keep your code in line with the published Dart Style Guide. ... To help you choose the rules you want to enable for your package, we have provided a complete list of rules and a growing list of lints according to the Effective Dart guide.

Suggests that it might be that the defaults are:

But it's not clear to me that this is what it says. Could we possibly write a single line somewhere referencing the default lints?

pq commented 5 years ago

I completely agree that this is VERY confusing and it gets even worse when you look at all of the places we define implicit defaults (e.g., https://github.com/dart-lang/linter/issues/1365). As suggested there, for sane defaults, I'd like to converge on package:pedantic but need to collect some feedback.

@jonasfj: what do you think?

jonasfj commented 5 years ago

what do you think?

Nice try, haha :) I'm doing my best to not think about style/linting :see_no_evil:

I mostly care that we have one set of rules we recommend (and maybe one for flutter), and that someone is willing to defend those rules.

pq commented 5 years ago

I'm doing my best to not think about style/linting 🙈

🥇

I mostly care that we have one set of rules we recommend (and maybe one for flutter), and that someone is willing to defend those rules.

We're on the same page. That's exactly why I'm suggesting package:pedantic since a lot of work has gone into vetting it.

devoncarew commented 5 years ago

Should we be running any lints of none have been configured for a project? I think I would expect no lints to be enabled; just errors and warnings.

We can guide people to best practices about which lints to have in the project creation stage - have stagehand create projects with the recommended best practices lints (ala pedantic).

bwilkerson commented 5 years ago

Should we be running any lints of none have been configured for a project? I think I would expect no lints to be enabled; just errors and warnings.

Me too. (I thought I'd responded to the thread saying as much, but I guess I forgot to click "Comment", so I'm glad you said it.)

Lints are designed to be opt-in. I think it was a mistake to enable any lints by default, and I think we should fix that.

jonasfj commented 5 years ago

Ah, okay that's a fine opinion... I just assumed that there was some sane default set of lints it would always run, and I wanted to know what these were :)

bwilkerson commented 5 years ago

Well, there is a default set of lints, but I don't know that I'd call it sane. :-)