Closed ivangalkindeveloper closed 5 months ago
Diagnostics can only be emitted on the file your lint is running against. There's no such thing as "analyze file A, but emit a warning on file B".
If you want to emit a warning on a file, the analyzed file should be that file.
You'll therefore need to either:
add_bloc_event_sealed_event.dart
file only.
This could be done by relying on the file name or a custom annotation to help the linter know more about the class.add_bloc_event_sealed.dart
instead.
For example a good candidate is to warn on the BlocEvent
as part of Bloc<BlocEvent, String>
In any cases, that's expected.
Describe the bug Hello Thank you very much for the package, it is a very convenient tool for analysis, although it needs to be studied well.
I'm trying to make a rule to check the keyword for BLoC events and states. I thought that a class element provides a specific class declaration, but when reporting an error on a class element that may be located in another file, I get strange behavior - the error is highlighted in the analysis file of the block itself. Or am I misunderstanding something about declaration elements?
To Reproduce Rule:
Example - Bloc and Event.
The
eventElement.source
property of the element under study shows correctly -.../pedant/example/lib/add/add_bloc_event_sealed_event.dart
Reporting problem:
Expected behavior Error highlighting in another file.