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 lints from Dart 3.7 #439

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/leancode_lint-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.6
sdk: 3.7

- name: Publish and release
uses: leancodepl/mobile-tools/.github/actions/pub-release@pub-release-v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/leancode_lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
include:
- version: 3.27.x
- version: 3.29.x

defaults:
run:
Expand Down
14 changes: 14 additions & 0 deletions packages/leancode_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 16.0.0

- Support Flutter 3.29 and Dart 3.7
- Enable the following lints:
- [`strict_top_level_inference`](https://dart.dev/tools/linter-rules/strict_top_level_inference)
- [`unnecessary_underscores`](https://dart.dev/tools/linter-rules/unnecessary_underscores)
- [`omit_obvious_property_types`](https://dart.dev/tools/linter-rules/omit_obvious_property_types)
- [`unnecessary_async`](https://dart.dev/tools/linter-rules/unnecessary_async)
- [`unsafe_variance`](https://dart.dev/tools/linter-rules/unsafe_variance)
- Remove the following lints which have been removed from Dart:
- [`package_api_docs`](https://dart.dev/tools/linter-rules/package_api_docs)
- [`unsafe_html`](https://dart.dev/tools/linter-rules/unsafe_html)
- Disable the [`require_trailing_commas`](https://dart.dev/tools/linter-rules/require_trailing_commas) lint as it conflicts with Dart 3.7 formatter (https://github.com/dart-lang/sdk/issues/60119).

# 15.0.0

- Enable the following lints:
Expand Down
16 changes: 11 additions & 5 deletions packages/leancode_lint/lib/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ analyzer:
null_check_on_nullable_type_parameter: warning
null_closures: warning
omit_obvious_local_variable_types: warning
omit_obvious_property_types: warning
only_throw_errors: warning
overridden_fields: warning
package_names: warning
Expand Down Expand Up @@ -129,7 +130,6 @@ analyzer:
prefer_void_to_null: warning
provide_deprecation_message: warning
recursive_getters: warning
require_trailing_commas: warning
secure_pubspec_urls: warning
sized_box_for_whitespace: warning
sized_box_shrink_expand: warning
Expand All @@ -138,6 +138,7 @@ analyzer:
sort_constructors_first: warning
sort_pub_dependencies: warning
sort_unnamed_constructors_first: warning
strict_top_level_inference: warning
test_types_in_equals: warning
throw_in_finally: warning
tighten_type_of_initializing_formals: warning
Expand All @@ -146,6 +147,7 @@ analyzer:
type_literal_in_constant_pattern: warning
unawaited_futures: warning
unintended_html_in_doc_comment: warning
unnecessary_async: warning
unnecessary_await_in_return: warning
unnecessary_brace_in_string_interps: warning
unnecessary_breaks: warning
Expand All @@ -170,8 +172,9 @@ analyzer:
unnecessary_string_interpolations: warning
unnecessary_this: warning
unnecessary_to_list_in_spreads: warning
unnecessary_underscores: warning
unrelated_type_equality_checks: warning
unsafe_html: warning
unsafe_variance: warning
use_build_context_synchronously: warning
use_enums: warning
use_full_hex_values_for_flutter_colors: warning
Expand Down Expand Up @@ -316,10 +319,10 @@ linter:
null_check_on_nullable_type_parameter: true
null_closures: true
omit_obvious_local_variable_types: true
omit_obvious_property_types: true
one_member_abstracts: false
only_throw_errors: true
overridden_fields: true
package_api_docs: false
package_names: true
package_prefixed_library_names: true
parameter_assignments: true
Expand Down Expand Up @@ -365,7 +368,7 @@ linter:
provide_deprecation_message: true
public_member_api_docs: false
recursive_getters: true
require_trailing_commas: true
require_trailing_commas: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling this might not be necessary, since the lint itself will detect the language version — dart-lang/sdk@2227249

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but this fix will land in 3.8.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a TODO in that case

secure_pubspec_urls: true
sized_box_for_whitespace: true
sized_box_shrink_expand: true
Expand All @@ -374,6 +377,7 @@ linter:
sort_constructors_first: true
sort_pub_dependencies: true
sort_unnamed_constructors_first: true
strict_top_level_inference: true
test_types_in_equals: true
throw_in_finally: true
tighten_type_of_initializing_formals: true
Expand All @@ -382,6 +386,7 @@ linter:
type_literal_in_constant_pattern: true
unawaited_futures: true
unintended_html_in_doc_comment: true
unnecessary_async: true
unnecessary_await_in_return: true
unnecessary_brace_in_string_interps: true
unnecessary_breaks: true
Expand All @@ -407,9 +412,10 @@ linter:
unnecessary_string_interpolations: true
unnecessary_this: true
unnecessary_to_list_in_spreads: true
unnecessary_underscores: true
unreachable_from_main: false
unrelated_type_equality_checks: true
unsafe_html: true
unsafe_variance: true
use_build_context_synchronously: true
use_colored_box: false
use_decorated_box: false
Expand Down
2 changes: 0 additions & 2 deletions packages/leancode_lint/lib/analysis_options_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ include: package:leancode_lint/analysis_options.yaml

analyzer:
errors:
package_api_docs: warning
public_member_api_docs: warning

linter:
rules:
package_api_docs: true
public_member_api_docs: true
4 changes: 2 additions & 2 deletions packages/leancode_lint/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: leancode_lint
version: 15.0.0
version: 16.0.0
homepage: https://github.com/leancodepl/flutter_corelibrary/tree/master/packages/leancode_lint
repository: https://github.com/leancodepl/flutter_corelibrary
description: Robust, high-quality lint rules used at LeanCode.
Expand All @@ -9,7 +9,7 @@ topics:
- lints

environment:
sdk: ">=3.6.0 <4.0.0"
sdk: ">=3.7.0 <4.0.0"

dependencies:
analyzer: ^6.11.0
Expand Down
16 changes: 8 additions & 8 deletions packages/leancode_lint/test/lints_test_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -98,10 +98,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev"
source: hosted
version: "1.19.0"
version: "1.19.1"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -249,7 +249,7 @@ packages:
path: "../.."
relative: true
source: path
version: "14.4.0"
version: "16.0.0"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -286,10 +286,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.16.0"
nested:
dependency: transitive
description:
Expand Down Expand Up @@ -488,5 +488,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.6.0 <4.0.0"
dart: ">=3.7.0 <4.0.0"
flutter: ">=3.0.0"