import RuleDetails from '@site/src/components/RuleDetails';
Warns when a public top-level member (expect the entrypoint) is declared inside a test file.
It helps reduce code bloat and find unused declarations in test files.
::: note
If you want to set exclude
config for this rule, the default ['/**', '!test/**']
will be overriden.
:::
Bad:
final public = 1; // LINT
void function() {} // LINT
class Class {} // LINT
mixin Mixin {} // LINT
extension Extension on String {} // LINT
enum Enum { first, second } // LINT
typedef Public = String; // LINT
Good:
final _private = 2;
void _function() {}
class _Class {}
mixin _Mixin {}
extension _Extension on String {}
enum _Enum { first, second }
typedef _Private = String;