leancodepl / flutter_corelibrary

Our core packages used for building the best Flutter apps.
https://pub.dev/publishers/leancode.co
57 stars 7 forks source link

Cannot find a way to make the example work #373

Closed MobiliteDev closed 1 month ago

MobiliteDev commented 1 month ago

Hello,

I'm not sure if I'm misusing the package or if it's a bug, but I can't seem to get it working.

Steps to Reproduce

  1. Open VSCode and create a new Flutter project.

    image

  2. Choose "Empty Application".

  3. Update the pubspec.yaml file as follows:

    name: test_leancode_lint
    description: "A new Flutter project."
    publish_to: 'none'
    version: 0.1.0
    
    environment:
     sdk: ^3.5.0
    
    dependencies:
     flutter:
       sdk: flutter
    
    dev_dependencies:
     flutter_test:
       sdk: flutter
     flutter_lints: ^4.0.0
     leancode_lint: ^14.2.0
     custom_lint: ^0.6.8
    
    flutter:
     uses-material-design: true
  4. Update analysis_options.yaml to this:

    include: package:leancode_lint/analysis_options.yaml
    
    # Optional lint rules configuration
    custom_lint:
     rules:
       - use_design_system_item:
           AppText:
             - instead_of: Text
               from_package: flutter
             - instead_of: RichText
               from_package: flutter
           AppScaffold:
             - instead_of: Scaffold
               from_package: flutter
    
    analyzer:
     plugins:
       # Required for custom lint support
       - custom_lint
     exclude:
       - '**/*.g.dart'
  5. Restart VSCode.

Expected Result

I expect to see a warning suggesting to replace Text with AppText.

Actual Result

No warning is triggered, even after manually running dart analyze.

However, if I add double quotes to a string, a warning does get triggered, which indicates that the analysis is running correctly.

image

Any help or guidance would be greatly appreciated!

MobiliteDev commented 1 month ago

I found the solution. It was not related to this package but to my Flutter installations. Sorry for the inconvenience.