require_module_barrel
v1.2.0WarningConfigurableArchitecture
analysis_options.yaml many_lints.yaml
Reports a source module with no barrel named after its directory. This checks file presence, not export completeness. It is in no preset; enable it by name.
lib/users/model.dart, with no lib/users/users.dart:
class User {}Keep the model and add lib/users/users.dart:
export 'model.dart';Generated files, part files, and files directly in a module root are skipped.
The diagnostic appears at the first token of each checked file in the module.
Use prefer_module_barrel_imports as well to check how callers import it.
Options
Section titled “Options”many_lints: rules: require_module_barrel: module_roots: [lib]rules: require_module_barrel: module_roots: [lib]| Option | Type | Default | Description |
|---|---|---|---|
module_roots |
List of strings | [lib] |
Package-relative parent directories of modules. The longest matching root wins. |
An empty or wrongly typed list uses [lib]. Configure include and exclude
for generated directories or modules that intentionally have no entry point.
Turning this rule off
Section titled “Turning this rule off”many_lints: rules: require_module_barrel: falseRelated rules
Section titled “Related rules”prefer_module_barrel_imports— Require public entry points when importing another module.avoid_banned_annotations— Ban specific annotations, optionally scoped by directory.avoid_banned_exports— Ban re-exports of specific libraries, optionally scoped by directory.avoid_banned_imports— Ban imports of specific libraries, optionally scoped by directory.