The JSON representation: a rule list plus any warnings.
Map<String, dynamic> toJson() => { 'rules': [for (final m in rules) m.toJson()], if (warnings.isNotEmpty) 'warnings': warnings, };