Open SunlightBro opened 2 years ago
I really don't like tagging 🙇 people, so I'm sorry. @rrousselGit can you give short feedback if this approach is acceptable? Then I would create an initial PR with the first lint.
Sure! I don't have anything special to say, it's looking good :)
Be sure to take into account situations where part declarations can be configured to be not right next to the source file through the build_runner configuration
Creating new package
freezed_lints
using custom_lintpackages/freezed_lints/
(not insidefreezed
,freezed_annotation
), so that it's opt-in for developersincomplete list of lint ideas
Don't hesitate to add your ideas for lints, or correct me on my ideas, should they be useless or even undoable with lints.
missing_part_directive
if you use@freezed
/@unfreezed
on a class, but there is nopart <filename>.freezed.dart;
missing_part_directive_json
same for when you use.fromJson(Map<String, Object?> json)
-constructor, but there is nopart <filename>.g.dart;
missing_private_empty_constructor
when a getter, method, or late variable is added to a freezed class , but it has no._()
-constructormixin_name_mismatch
whenclass MyExample with _$TypoInMixin {...}
fromjson_expression_body
when you dofactory MyClass.fromJson(Map<String, Object?> json) { return _$MyClassFromJson(json); }
fromjson_block_body
when you dofactory MyClass.fromJson(Map<String, Object?> json) => MyOwnImplementation();