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.

Example config:​

solid_lints:
diagnostics:
prefer_match_file_name:
exclude_entity:
- mixin
- extension
- extension_type
- enum

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

Parameters​

exclude_entity (String | List<String>)​

A list of entities that should be excluded from the lint.