Skip to main content

prefer_match_file_name

Warns about a mismatch between file name and first declared element inside.

This improves navigation by matching file content and file name.

Tests

State: Disabled.

It's acceptable to include stubs or other helper classes into the test file.

Example

BAD:

File name: my_class.dart

class NotMyClass {} // LINT

File name: other_class.dart

class _OtherClass {}
class SomethingPublic {} // LINT

GOOD:

File name: my_class.dart

class MyClass {} // OK

File name: something_public.dart

class _OtherClass {}
class SomethingPublic {} // OK