-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for disabled allowed_in_widget_params lint parameter
- Loading branch information
1 parent
9c00eba
commit e40e846
Showing
5 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
lint_test/no_magic_number_allowed_in_widget_params_test/analysis_options.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
analyzer: | ||
plugins: | ||
- ../custom_lint | ||
|
||
custom_lint: | ||
rules: | ||
- no_magic_number: | ||
allowed_in_widget_params: true |
27 changes: 27 additions & 0 deletions
27
...c_number_allowed_in_widget_params_test/no_magic_number_allowed_in_widget_params_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Allowed for numbers in a Widget subtype parameters. | ||
abstract interface class Widget {} | ||
|
||
class StatelessWidget implements Widget {} | ||
|
||
class MyWidget extends StatelessWidget { | ||
final MyWidgetDecoration decoration; | ||
final int value; | ||
|
||
MyWidget({ | ||
required this.decoration, | ||
required this.value, | ||
}); | ||
} | ||
|
||
class MyWidgetDecoration { | ||
final int size; | ||
|
||
MyWidgetDecoration({required this.size}); | ||
} | ||
|
||
Widget build() { | ||
return MyWidget( | ||
decoration: MyWidgetDecoration(size: 12), | ||
value: 23, | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
lint_test/no_magic_number_allowed_in_widget_params_test/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: no_magic_number_allowed_in_widget_params_test | ||
description: A starting point for Dart libraries or applications. | ||
publish_to: none | ||
|
||
environment: | ||
sdk: '>=3.0.0 <4.0.0' | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
solid_lints: | ||
path: ../../ | ||
test: ^1.20.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters