Skip to content

Determine default lint set for dart create #739

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

Closed
mit-mit opened this issue May 11, 2021 · 6 comments
Closed

Determine default lint set for dart create #739

mit-mit opened this issue May 11, 2021 · 6 comments

Comments

@mit-mit
Copy link
Member

mit-mit commented May 11, 2021

We should make a final call regarding what set of lints dart create puts the user on. We currently use core, but that is inconsistent with flutter create which uses recommended

@goderbauer
Copy link
Contributor

but that is inconsistent with flutter create which uses recommended

flutter create uses package:flutter_lints, which is build on top of recommended. It doesn't have an equivalent to core.

@lrhn
Copy link
Member

lrhn commented May 12, 2021

I think we should use recommended. After all, it's what we recommend that you use. You can still choose core if you want to, but dart create is allowed to be opinionated since you're free to change it afterwards.

@mit-mit
Copy link
Member Author

mit-mit commented May 12, 2021

Pedantic 1.8 has been the default for many Dart-only packages (as it's what pub.dev scores with). If we use recommended for the Dart default, then these lints are new to those coming from pedantic 1.8:

  • always_require_non_null_named_parameters
  • annotate_overrides
  • avoid_function_literals_in_foreach_calls
  • avoid_null_checks_in_equality_operators
  • avoid_renaming_method_parameters
  • avoid_returning_null_for_void
  • avoid_single_cascade_in_expression_statements
  • constant_identifier_names
  • control_flow_in_finally
  • empty_statements
  • exhaustive_cases
  • implementation_imports
  • overridden_fields
  • package_names
  • prefer_adjacent_string_concatenation
  • prefer_collection_literals
  • prefer_conditional_assignment
  • prefer_final_fields
  • prefer_for_elements_to_map_fromIterable
  • prefer_function_declarations_over_variables
  • prefer_if_null_operators
  • prefer_initializing_formals
  • prefer_inlined_adds
  • prefer_is_not_operator
  • prefer_null_aware_operators
  • prefer_spread_collections
  • prefer_void_to_null
  • unnecessary_brace_in_string_interps
  • unnecessary_getters_setters
  • unnecessary_string_escapes
  • unnecessary_string_interpolations
  • unnecessary_this
  • use_function_type_syntax_for_parameters

That is a pretty long list, and more than I had initially imagined. But I think it's a good choice to use recommended as a default:

  • It bring alignment between dart create and flutter create
  • It's just a default; you can easily switch to core
  • The template change will only affect new projects.

@mit-mit
Copy link
Member Author

mit-mit commented May 12, 2021

If we agree to go with recommended, then we should update the example in the readme to import that:
https://github.com/dart-lang/lints/blob/main/README.md#how-to-enable-these-lints

@pq
Copy link
Member

pq commented May 12, 2021

+1 to recommended.

@mit-mit
Copy link
Member Author

mit-mit commented May 12, 2021

Updating in https://dart-review.googlesource.com/c/sdk/+/199482

dart-bot referenced this issue in dart-lang/sdk May 12, 2021
Bug: https://github.com/dart-lang/lints/issues/20
Change-Id: I433a393a9a6755ed9140326a413f8360a4d508bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199482
Reviewed-by: Phil Quitslund <[email protected]>
Commit-Queue: Michael Thomsen <[email protected]>
@mit-mit mit-mit closed this as completed May 12, 2021
@mosuem mosuem transferred this issue from dart-archive/lints Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants