flutter_compositions_lints 0.2.6 copy "flutter_compositions_lints: ^0.2.6" to clipboard
flutter_compositions_lints: ^0.2.6 copied to clipboard

Custom lint rules for Flutter Compositions to ensure reactive props usage and best practices.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased] #

0.2.6 - 2026-08-12 #

Changed #

  • Extracted the shared "is this a CompositionWidget setup()" check into an internal utility used by all rules.

Fixed #

  • flutter_compositions_no_conditional_composition no longer analyzes unrelated top-level or local functions named setup.
  • All rules now recognize widgets that extend CompositionWidget indirectly through an intermediate base class.
  • flutter_compositions_shallow_reactivity now checks the target's static type, eliminating false positives on ValueNotifier.value, Animation.value, and other non-ref .value accessors.
  • flutter_compositions_shallow_reactivity now detects mutations through nested chains (ref.value.a.b = x, ref.value.items.add(...)), which were previously missed entirely.
  • flutter_compositions_shallow_reactivity now also flags Set.removeAll / Set.retainAll.
  • flutter_compositions_controller_lifecycle now matches controller types through the supertype chain: user-defined controller subclasses are checked, and unrelated types whose names merely start with a controller name are no longer flagged.
  • flutter_compositions_no_logic_in_builder / flutter_compositions_prefer_raw_controller now also check builder functions returned from nested control flow (e.g. inside if) and expression-bodied setup().
  • flutter_compositions_prefer_raw_controller now recognizes more controller parameter names (pageController, tabController, textEditingController, transformationController, searchController).
  • flutter_compositions_ensure_reactive_props uses a type-safe field-element check instead of comparing ElementKind.toString(), and now correctly flags bare (non-this.-prefixed) field accesses, which the string-based check silently missed.
  • flutter_compositions_ensure_reactive_props no longer flags static fields or computed getters (e.g. String get label => ...) as non-reactive prop access — only genuine instance fields declared on the widget are props.

0.2.5 - 2026-07-19 #

Changed #

  • Upgraded analyzer to ^12.1.0, analysis_server_plugin to ^0.3.14, and analyzer_testing to ^0.2.5 (the latest versions compatible with Flutter 3.44.x).

0.2.4 - 2026-03-28 #

Changed #

  • Upgrade analyzer from ^9.0.0 to ^10.0.0
  • Upgrade analyzer_testing from 0.1.7 to ^0.1.9
  • Upgrade test_reflective_loader from ^0.2.0 to ^0.4.0

0.2.3 - 2026-02-17 #

Changed #

  • Version bump to align with core package v0.2.3

0.2.2 - 2026-02-17 #

0.2.1 - 2026-02-15 #

Changed #

  • Downgrade analyzer to ^9.0.0 and analysis_server_plugin to ^0.3.0 for workspace compatibility
  • Pin analyzer_testing to 0.1.7 for Flutter SDK compatibility
  • Add analysis_options.yaml inheriting from very_good_analysis
  • Fix all lint issues: add doc comments, use cascades, use final locals, fix formatting

0.2.0 - 2026-02-15 #

Changed #

  • BREAKING: Replaced flutter_compositions_no_mutable_fields rule with flutter_compositions_shallow_reactivity
    • The new rule warns about shallow reactivity limitations instead of enforcing final fields
    • Detects direct mutations that won't trigger reactive updates:
      • Property assignments: ref.value['key'] = x or ref.value.property = x
      • Array element assignments: ref.value[0] = x
      • Mutating method calls: ref.value.add(), .remove(), .clear(), etc.
    • Updated all documentation (English and Chinese) to reflect the new rule
    • Updated example code and fixtures
  • BREAKING: Migrate from custom_lint to analysis_server_plugin
    • New entry point: lib/main.dart with analysis_server_plugin format
    • Rules now extend AnalysisRule instead of DartLintRule
    • Tests migrated to AnalysisRuleTest with @reflectiveTest
    • Removed fixture files and old test utilities
  • Upgrade Dart SDK constraint to ^3.10.0

Removed #

  • flutter_compositions_no_mutable_fields lint rule and all associated tests

Added #

  • flutter_compositions_shallow_reactivity lint rule with comprehensive test coverage
  • New test fixtures demonstrating shallow reactivity patterns
  • Detailed documentation explaining common mutation patterns to avoid
  • flutter_compositions_no_logic_in_builder lint rule — prevents logic in builder functions
  • flutter_compositions_prefer_raw_controller lint rule — suggests .raw over .value for controllers in builders

0.1.1 - 2025-11-06 #

  • REFACTOR: remove type safety lint rule and related tests.
  • FIX: configure dart test to exclude fixture files from test runs.
  • FEAT: init project.

0.1.0 - 2025-10-27 #

Added #

  • Initial release of Flutter Compositions Lints
  • Custom lint rules for enforcing Flutter Compositions best practices:
    • flutter_compositions_ensure_reactive_props - Ensures props are accessed via widget() for reactivity
    • flutter_compositions_no_async_setup - Prevents async setup methods
    • flutter_compositions_controller_lifecycle - Ensures proper controller disposal with use* helpers
    • flutter_compositions_no_mutable_fields - Enforces immutable widget fields
    • flutter_compositions_provide_inject_type_match - Warns against common type conflicts in DI
    • flutter_compositions_no_conditional_composition - Prevents conditional composition API calls
  • Comprehensive test coverage using testAnalyzeAndRun()
  • Fixture files for each lint rule
  • Integration tests
  • Documentation for all rules

Documentation #

  • Complete rules documentation in RULES.md
  • Testing guide in test/README.md
  • Example code for good and bad practices

Development #

  • Automated testing with custom_lint_builder
  • All tests passing (18/18)
  • GitHub Actions CI integration
0
likes
140
points
158
downloads

Documentation

Documentation
API reference

Publisher

verified publisheryokikiyo.com

Weekly Downloads

Custom lint rules for Flutter Compositions to ensure reactive props usage and best practices.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

analysis_server_plugin, analyzer

More

Packages that depend on flutter_compositions_lints