diff --git a/CHANGELOG.md b/CHANGELOG.md index 37fcd55cd2..78f1449bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +* fix: correctly available check rule names. + ## 5.0.0 * feat: **Breaking change** rename `member-ordering-extended` to `member-ordering`, discarding the old implementation. diff --git a/lib/src/analyzers/lint_analyzer/lint_analysis_options_validator.dart b/lib/src/analyzers/lint_analyzer/lint_analysis_options_validator.dart index 1ac8a6f23b..34862ca5b6 100644 --- a/lib/src/analyzers/lint_analyzer/lint_analysis_options_validator.dart +++ b/lib/src/analyzers/lint_analyzer/lint_analysis_options_validator.dart @@ -9,6 +9,7 @@ import 'lint_analysis_config.dart'; import 'models/issue.dart'; import 'models/lint_file_report.dart'; import 'models/severity.dart'; +import 'rules/rules_factory.dart'; class LintAnalysisOptionsValidator { static LintFileReport? validateOptions( @@ -28,11 +29,11 @@ class LintAnalysisOptionsValidator { return null; } - final parsedRuleIds = config.codeRules.map((rule) => rule.id).toList(); + final ids = allRuleIds.toSet(); final issues = []; for (final rule in rulesList) { - if (!parsedRuleIds.contains(rule.ruleName)) { + if (!ids.contains(rule.ruleName)) { issues.add( Issue( ruleId: 'unknown-config', diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_factory.dart b/lib/src/analyzers/lint_analyzer/rules/rules_factory.dart index 764aad4ae0..f37bdddef3 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_factory.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_factory.dart @@ -144,6 +144,8 @@ final _implementedRules = )>{ TagNameRule.ruleId: TagNameRule.new, }; +Iterable get allRuleIds => _implementedRules.keys; + Iterable get allRules => _implementedRules.keys.map((id) => _implementedRules[id]!({}));