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

feat: Update all lint rules #61

Merged
merged 2 commits into from
Oct 4, 2024
Merged
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: 2 additions & 0 deletions packages/altive_lints/lib/all_lint_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ linter:
- directives_ordering
- discarded_futures
- do_not_use_environment
- document_ignores
- empty_catches
- empty_constructor_bodies
- empty_statements
Expand All @@ -79,6 +80,7 @@ linter:
- implicit_call_tearoffs
- implicit_reopen
- invalid_case_patterns
- invalid_runtime_check_with_js_interop_types
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_annotations
Expand Down
3 changes: 1 addition & 2 deletions packages/altive_lints/lib/src/utils/types_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ bool _isWidget(DartType? type) => type?.getDisplayString() == 'Widget';
bool _isSubclassOfWidget(DartType? type) =>
type is InterfaceType && type.allSupertypes.any(_isWidget);

// ignore: deprecated_member_use
bool _isWidgetState(DartType? type) => type?.element2?.displayName == 'State';
Comment on lines -85 to -86
Copy link
Member

Choose a reason for hiding this comment

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

I was told to use element instead of element2, so I did!

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree!

bool _isWidgetState(DartType? type) => type?.element?.displayName == 'State';

bool _isSubclassOfWidgetState(DartType? type) =>
type is InterfaceType && type.allSupertypes.any(_isWidgetState);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore_for_file: avoid_single_child
import 'package:flutter/material.dart';

class MyWidget extends StatelessWidget {
Expand All @@ -9,6 +8,7 @@ class MyWidget extends StatelessWidget {
return Scaffold(
body: ListView(
children: [
const Text('Hello World!'),
Expanded(
// expect_lint: avoid_shrink_wrap_in_list_view
child: ListView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ class MyWidget extends StatelessWidget {
],
),
const Column(),
const Column(children: []), // ignore: avoid_redundant_argument_values
// Ignore this for the sake of example.
// ignore: avoid_redundant_argument_values
const Column(children: []),
],
);
}
Expand Down