nilts_flutter_hooks 0.1.0
nilts_flutter_hooks: ^0.1.0 copied to clipboard
nilts_flutter_hooks is lint rules, quick fixes and assists for Dart and Flutter projects using flutter_hooks that helps you enforce best practices, and avoid errors.
nilts_flutter_hooks #
nilts_flutter_hooks is lint rules, quick fixes and assists for Dart and Flutter projects that helps you enforce best practices, and avoid errors.
Contents #
- Usage
- Configuration
- Lint rules and quick fixes
- Assists
- Known issues
- Feature requests
- Bug reports
- Contributing
Usage #
nilts_flutter_hooks depends on custom_lint
.
You should add nilts_flutter_hooks
and custom_lint
to your dev_dependencies
in pubspec.yaml
file.
dev_dependencies:
custom_lint: <version>
nilts_flutter_hooks: <version>
And also, add custom_lint
to your analysis_options.yaml
file.
analyzer:
plugins:
- custom_lint
Configuration #
You can configure all lint rules provided by nilts_flutter_hooks
in analysis_options.yaml
file.
Choice one of the following configuration strategies.
Disabling strategy #
All of nilts_flutter_hooks
rules are enabled by default.
Add lint rule name and set false
to disable it.
custom_lint:
rules:
# Disable particular lint rules if you want ignore them whole package.
- unnecessary_hook_widget: false
Enabling strategy #
You can disable all lint rules depends on custom_lint by setting enable_all_lint_rules
to false
.
Add lint rule name and set true
to enable it.
custom_lint:
# Disable all lint rules depends on custom_lint.
enable_all_lint_rules: false
rules:
- unnecessary_hook_widget: true
NOTE: If you enable_all_lint_rules
set to false
, all of lint rules (not only all of nilts_flutter_hooks's lint rules) depends on custom_lint
will be disabled by default.
Lint rules and quick fixes #
Read below to learn about each lint rules intend to. Some of lint rules support quick fixes on IDE.
Overview #
Rule name | Overview | Target SDK | Rule type | Maturity level | Quick fix |
---|---|---|---|---|---|
unnecessary_hook_widget | Checks if the widget is unnecessary to use HookWidget . |
Any versions nilts_flutter_hooks supports | Practice | Experimental | ✅️ |
Details #
unnecessary_hook_widget
- Target SDK : Any versions nilts_flutter_hooks supports
- Rule type : Practice
- Maturity level : Experimental
- Quick fix : ✅
Prefer using StatelessWidget
instead of HookWidget
when no hooks are used within the widget.
BAD:
class MyWidget extends HookWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
GOOD:
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
See also:
Assists #
Upcoming... 🚀
Known issues #
Quick fix priorities (Fixed) #
Important
Finding which a plugin version fixed the issue is hard, but it looks work as expected. Checked works as expected on Dart plugin 242.24931 and 243.23654.44.
The priorities assigned to quick fixes are not currently visible in IntelliJ IDEA and Android Studio due to the lack of support for PrioritizedSourceChange
in these environments.
In contrast, VS Code does support this feature, allowing quick fixes to be listed along with their respective priorities.
VS Code | IntelliJ IDEA / Android Studio |
---|---|
See also:
fix-all assist (Fixed) #
Important
Finding which a plugin version fixed the issue is hard, but it looks as expected. Checked works as expected on Dart plugin 242.24931 and 243.23654.44.
The fix-all assist feature has been introduced in custom_lint_builder 0.6.0.
However, this feature is not yet supported in IntelliJ IDEA and Android Studio, owing to their current lack of support for PrioritizedSourceChange
.
VS Code | IntelliJ IDEA / Android Studio |
---|---|
Feature requests #
If you have any feature requests, please create an issue from this template.
Bug reports #
If you find any bugs, please create an issue from this template.
Contributing #
Welcome your contributions!! Please read CONTRIBUTING docs before submitting your PR.