Problem
After the migration to the new analyzer plugin system, support for resolving inherited configurations (include: package:...) and package-default rule parameters stopped working. As a result, projects could not share lint rule parameters or use shared options.
Solution
Implemented a proper configuration loader and parser that restores support for package-level configurations and rule suppression.
Key Components:
-
Package URI Resolution:
- Implemented
lib/src/common/parameter_parser/package_config_resolver.dart to find the nearest .dart_tool/package_config.json and resolve package: URIs into absolute file system paths.
-
Include Processing & Merging:
- Added
lib/src/common/parameter_parser/analysis_options_parser.dart to recursively traverse includes (including package: paths), merge default options, and handle cyclic dependencies.
-
Rule Application:
- Wrapped rules in
lib/src/models/proxy_analysis_rule.dart and lib/src/models/proxy_multi_analysis_rule.dart to apply merged settings and respect rule suppression.
-
Testing:
- Added unit tests in
test/src/common/parameter_parser/analysis_options_loader_test.dart to verify package include resolution, parameter merging, and cyclic imports.
Problem
After the migration to the new analyzer plugin system, support for resolving inherited configurations (
include: package:...) and package-default rule parameters stopped working. As a result, projects could not share lint rule parameters or use shared options.Solution
Implemented a proper configuration loader and parser that restores support for package-level configurations and rule suppression.
Key Components:
Package URI Resolution:
lib/src/common/parameter_parser/package_config_resolver.dartto find the nearest.dart_tool/package_config.jsonand resolvepackage:URIs into absolute file system paths.Include Processing & Merging:
lib/src/common/parameter_parser/analysis_options_parser.dartto recursively traverse includes (includingpackage:paths), merge default options, and handle cyclic dependencies.Rule Application:
lib/src/models/proxy_analysis_rule.dartandlib/src/models/proxy_multi_analysis_rule.dartto apply merged settings and respect rule suppression.Testing:
test/src/common/parameter_parser/analysis_options_loader_test.dartto verify package include resolution, parameter merging, and cyclic imports.