proposal: public_class_matches_filename
#4604
Labels
lint-proposal
P4
set-core
Affects a rule in the core Dart rule set
status-pending
type-enhancement
A request for a change that isn't a bug
public_class_matches_filename
Description
contains a public class which does not match its filename in
PascalCase
.Details
Naming a class the same as its filename is a common convention in many programming languages, including Dart. While it's not strictly enforced by the language itself, adhering to this convention has several benefits and is considered good practice:
Kind
style advice
Bad Examples
mammal.dart
large_mammal.dart
Good Examples
mammal.dart
large_mammal.dart
Discussion
camel_case_types
: https://dart.dev/tools/linter-rules/camel_case_typesfile_names
: https://dart.dev/tools/linter-rules/file_namesI didn't, however, find this specific proposal explicitly called out in official style guides.
Discussion checklist
The text was updated successfully, but these errors were encountered: