Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 3b738ec

Browse files
committed
Add test that the lint works for any expression, not just variables
1 parent 731789a commit 3b738ec

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/src/rules/no_literal_bool_comparisons.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ From [Effective Dart](https://dart.dev/guides/language/effective-dart/usage#dont
1717
1818
**DON'T** use `true` or `false` in equality operations.
1919
20-
This lint applies only if the variable is of a non-nullable `bool` type.
20+
This lint applies only if the expression is of a non-nullable `bool` type.
2121
2222
**BAD:**
2323
```dart

test_data/rules/no_literal_bool_comparisons.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ void foo() {
2020
{
2121
print('oh');
2222
}
23+
24+
print((x && f) != true); // LINT
25+
print(x && (f != true)); // LINT
2326
}
2427

2528
void bar(bool x, bool? y) {

0 commit comments

Comments
 (0)