Skip to content

Commit

Permalink
Merge pull request #11 from olmps/1.3.0
Browse files Browse the repository at this point in the history
`1.3.0`
  • Loading branch information
matuella authored Dec 8, 2021
2 parents 9cf2834 + 29907c2 commit 16fcc6d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 30 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 1.3.0

- Added references to unreleased rules: `avoid_final_parameters`, `no_leading_underscores_for_library_prefixes`,
`no_leading_underscores_for_local_identifiers`, `secure_pubspec_urls`, `sized_box_shrink_expand`,
`unnecessary_constructor_name`, `use_decorated_box`
- Enabled `avoid_dynamic_calls`, `avoid_multiple_declarations_per_line`, `depend_on_referenced_packages`,
`deprecated_consistency`, `eol_at_end_of_file`, `library_private_types_in_public_api`, `noop_primitive_operations`,
`prefer_null_aware_method_calls`, `require_trailing_commas`, `use_build_context_synchronously`,
`use_if_null_to_convert_nulls_to_bools`, `use_named_constants` and `use_test_throws_matchers`.
- Updated explanations on `avoid_final_parameters` and `prefer_final_parameters`.

## 1.2.0

- Added references to unreleased rules: `depend_on_referenced_packages`, `noop_primitive_operations`,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Add this package to your `dev_dependencies` in your `pubspec.yaml`:

```yaml
dev_dependencies:
strict: ^1.2.0
strict: ^1.3.0
```
and the following to your `analysis_options.yaml` (create one in the root of your project if you don't
Expand Down
10 changes: 9 additions & 1 deletion lib/all_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# It's also important to keep updating this list based on the `yaml` above.
#
# Last updated version: 1.5.0 | 09/06/2021 (DD/MM/YYYY)
# Last updated version: 1.15.0 | 07/12/2021 (DD/MM/YYYY)
linter:
rules:
- always_declare_return_types
Expand All @@ -25,6 +25,7 @@ linter:
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
- avoid_init_to_null
Expand Down Expand Up @@ -72,6 +73,7 @@ linter:
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
Expand All @@ -91,6 +93,8 @@ linter:
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
- no_runtimeType_toString
- non_constant_identifier_names
Expand Down Expand Up @@ -149,7 +153,9 @@ linter:
- public_member_api_docs
- recursive_getters
- require_trailing_commas
- secure_pubspec_urls
- sized_box_for_whitespace
- sized_box_shrink_expand
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
Expand All @@ -164,6 +170,7 @@ linter:
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_final
- unnecessary_getters_setters
- unnecessary_lambdas
Expand All @@ -182,6 +189,7 @@ linter:
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_decorated_box
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
Expand Down
57 changes: 31 additions & 26 deletions lib/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,22 @@ linter:
# particular namespace for that class.
# - avoid_classes_with_only_static_members
- avoid_double_and_int_checks
# TODO: Unreleased, and also not sure, needs more testing, but I THINK we should enable when available.
# - avoid_dynamic_calls
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
# As we already disable `prefer_final_parameters`, we should enforce its counterpart, which will keep things
# consistent.
# TODO: Unreleased, enable when available
# - avoid_final_parameters
# Dart uses follows some functional concepts, so there is no clear benefit for not allowing a single independent
# forEach call.
# - avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
# TODO: Unreleased, enable when available
# - avoid_multiple_declarations_per_line
- avoid_multiple_declarations_per_line
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_print
Expand Down Expand Up @@ -93,7 +95,7 @@ linter:
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
- avoid_web_libraries_in_flutter # Experimental
- avoid_web_libraries_in_flutter
- await_only_futures
- camel_case_extensions
- camel_case_types
Expand All @@ -106,30 +108,28 @@ linter:
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
# TODO: Unreleased, enable when available
# - depend_on_referenced_packages
# TODO: Unreleased, enable when available
# - deprecated_consistency
- depend_on_referenced_packages
- deprecated_consistency
# TODO: Not sure, as I have never used this before.
# - diagnostic_describe_all_properties
- directives_ordering
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- invariant_booleans # Experimental
- invariant_booleans
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
# TODO: Unreleased, enable when available
# - library_private_types_in_public_api
- library_private_types_in_public_api
# Possibly one of the most discussed topics in code-styling. We prefer to keep it at 120, due to several reasons.
# This is a totally biased opinion and all three 80, 100 and 120 line lenghts have good/valid points. Although,
# when exceeding 120, it becomes really hard to read.
Expand All @@ -142,11 +142,14 @@ linter:
# behave the same for the rest of the enum-like cases.
# - no_default_cases
- no_duplicate_case_values
# TODO: Unreleased, enable when available
# - no_leading_underscores_for_library_prefixes
# TODO: Unreleased, enable when available
# - no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
- no_runtimeType_toString
- non_constant_identifier_names
# TODO: Unreleased, enable when available
# - noop_primitive_operations
- noop_primitive_operations
# TODO: Not sure, couldn't quite understand why it's better to type cast to a non-nullable type instead of using
# the "!" bang operator.
# - null_check_on_nullable_type_parameter
Expand Down Expand Up @@ -211,8 +214,8 @@ linter:
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
# TODO: Unreleased, and not quite sure if we should enforce this, as it gives a TON of verbosity to the overall
# codebase, with the benefit of never accidentally reassigning a parameter
# Gives a ton of verbosity on function declarations and can be controlled by `parameter_assignments`, which enforces
# that parameters of functions or methods can't be reassigned.
# - prefer_final_parameters
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
Expand All @@ -229,8 +232,7 @@ linter:
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
# TODO: Unreleased, enable when available
# - prefer_null_aware_method_calls
- prefer_null_aware_method_calls
- prefer_null_aware_operators
# Contradicts with `always_use_package_imports`. Relative imports can get really messy to read if the codebase
# is slightly complex, frequently seeing things like: '../../../../../../importedFile.dart'. We prefer a more
Expand All @@ -245,9 +247,12 @@ linter:
# to simply conform to this rule.
# - public_member_api_docs
- recursive_getters
- require_trailing_commas
# TODO: Unreleased, enable when available
# - require_trailing_commas
# - secure_pubspec_urls
- sized_box_for_whitespace
# TODO: Unreleased, enable when available
# - sized_box_shrink_expand
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
Expand All @@ -264,6 +269,8 @@ linter:
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
# TODO: Unreleased, enable when available
# - unnecessary_constructor_name
# While var keyword is indeed shorter than final, when we allow this approach as our default behavior, we could
# eventually create mutable variables where they aren't expected to change - contrariwise to the final approach.
# - unnecessary_final
Expand All @@ -283,27 +290,25 @@ linter:
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
# TODO: Unreleased, enable when available
# - use_build_context_synchronously
# - use_decorated_box
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
# TODO: Unreleased, enable when available
# - use_if_null_to_convert_nulls_to_bools
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
# While keys can be used for a couple of reasons, like reusing/reordering widgets of the same class, requiring it
# for all Widgets may not reflect all of the existing Widget's use-cases.
# Example: when we want to create a Widget that represents a page, which usually will only have one instance
# throughout the app lifecycle.
# - use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
# TODO: Unreleased, enable when available
# - use_named_constants
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
# TODO: Unreleased, enable when available
# - use_test_throws_matchers
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: strict
version: 1.2.0
version: 1.3.0
description: A heavily opinionated analysis_options for Dart/Flutter projects with strict - but justified - lint rules
repository: https://github.com/olmps/strict
issue_tracker: https://github.com/olmps/strict/issues

environment:
sdk: ">=2.13.0 <3.0.0"
sdk: ">=2.14.0 <3.0.0"

0 comments on commit 16fcc6d

Please sign in to comment.