rrousselGit / freezed

Code generation for immutable classes that has a simple syntax/API without compromising on the features.
https://pub.dev/packages/freezed
1.94k stars 237 forks source link

fix #1110 #1111

Closed SunlightBro closed 4 months ago

SunlightBro commented 4 months ago
changeset-bot[bot] commented 4 months ago

⚠️ No Changeset found

Latest commit: d5fffe754fe7eca2b651946107f2adb8fc724985

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

SunlightBro commented 4 months ago

using stable or beta flutter analyze . has no issues.

but on master the main issue (I think) is in custom_lint_core/lib/src/lint_codes.dart, because analyzer/src/dart/error/lint_codes.dart now also defines LintCode.

Analyzing freezed_lint...                                               

  error • The argument type 'dynamic' can't be assigned to the parameter type 'ErrorCode'.  • lib/src/missing_mixin.dart:30:37 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'ErrorCode'.  • lib/src/missing_mixin.dart:36:35 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'ErrorCode'.  • lib/src/missing_private_empty_ctor.dart:44:35 • argument_type_not_assignable
rrousselGit commented 4 months ago

Do you mind adding the necessary import alias or show/hide?

SunlightBro commented 4 months ago

Requires one change in custom_lint_core/lib/src/lint_rule.dart

  import 'package:analyzer/dart/ast/ast.dart';
- import 'package:analyzer/error/error.dart';
+ import 'package:analyzer/error/error.dart' show AnalysisError;
  import 'package:analyzer/error/listener.dart';
rrousselGit commented 4 months ago

TY!

lishaduck commented 1 month ago

@rrousselGit, can you publish this? Running custom_lint in one of my projects errors with [path-to-freezed_lint] 'LintCode' is imported from both [path-to-custom_lint_core] [path-to-analyzer]. Failed to start plugins The request analysis.setContextRoots failed with the following error: RequestErrorCode.PLUGIN_ERROR Bad state: Failed to start the plugins. without this PR, but pulling it in as a git dependency works fine. I'm as up-to-date as one can be on the stable channel. (I'm not sure why this fixes it, I have another project on the stable channel that also depends on analyzer@6.7.0, custom_lint_core@0.6.5 and freezed_lint@0.0.5 which works fine, but 🤷‍♂️)