Closed bounty1342 closed 4 years ago
Which kind of problems do you observe, and how do they arise? Are you using pedantic
on a package where one or more libraries are generated by reflectable?
Could you use an exclude
directive or something similar cf. this page to control the usage of the analyzer on the generated file?
Hi,
I use the package dart_json_mapper witch generate files using reflectable.
As there is already those ignore comments, why not add implementation_imports
?
// ignore_for_file: unnecessary_const
// ignore_for_file: prefer_collection_literals
// ignore_for_file: prefer_adjacent_string_concatenation
// ignore:unused_import
import 'package:reflectable/mirrors.dart' as m;
// ignore:unused_import
import 'package:reflectable/src/reflectable_builder_based.dart' as r;
// ignore:unused_import
import 'package:reflectable/reflectable.dart' as r show Reflectable;
Regards
I created https://github.com/dart-lang/reflectable/pull/204 to do this.
It could be argued that we shouldn't keep adding linter directives like this (maybe we should offer a more general mechanism for including arbitrary code into one or more locations in the generated file). But for this particular lint it is actually justified by the nature of the reflectable code generation: Reflectable generates code that does need to import arbitrary libraries that are reachable via a chain of imports, because it may need to denote declarations in such libraries in order to provide reflection support as specified by the developer.
Hi, In the generated main.reflectable.dart, I presume the following comment can be added to reduce the numbers of problems :
// ignore_for_file: implementation_imports
What do you think ? Is there another way of doing it ?
Regards