Skip to content

require_module_barrel

v1.2.0WarningConfigurableArchitecture

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.

analysis_options.yaml
many_lints:
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.

many_lints:
rules:
require_module_barrel: false