You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a library has an entrypoint, I'd like to report any publicly accessible elements which are not used within the library as unused.
An entrypoint is a top-level main function, or a function annotated with @pragma(vm:entry-point). These files are typically:
a VM script in bin/,
a web app in web/,
a VM tool in tool/,
a test like test/**/*_test.dart,
I think there will be very very few false positives. And perhaps any false positive indicates a code smell in library arrangement (the analyzer codebase I believe has some test files which reference another test file, each of which has a main).
Any element which is not publicly visible should already be reported with analyzer's unused_local_variable, unused_element, or unused_field diagnostics. This lint would cover publicly visible elements:
Any public class instance members (fields, methods, constructors), even those on private classes and mixins.
Any public top-level functions, variables, classes, enums, mixins, extensions, and typedefs.
Describe the rule you'd like to see implemented
If a library has an entrypoint, I'd like to report any publicly accessible elements which are not used within the library as unused.
An entrypoint is a top-level
main
function, or a function annotated with@pragma(vm:entry-point)
. These files are typically:bin/
,web/
,tool/
,test/**/*_test.dart
,I think there will be very very few false positives. And perhaps any false positive indicates a code smell in library arrangement (the analyzer codebase I believe has some test files which reference another test file, each of which has a
main
).Any element which is not publicly visible should already be reported with analyzer's
unused_local_variable
,unused_element
, orunused_field
diagnostics. This lint would cover publicly visible elements:Examples
Additional context
This is an alternative route to #685 and #1258.
The text was updated successfully, but these errors were encountered: