@@ -112,22 +112,17 @@ class CustomLintConfigs {
112112
113113 final errors = < String , ErrorSeverity > {...includedOptions.errors};
114114
115- final errorsYaml = customLint['errors' ] as Object ? ;
116- if (errorsYaml is Map ) {
115+ if (customLint['errors' ] case final Map <String , String > errorsYaml) {
117116 for (final entry in errorsYaml.entries) {
118- final value = entry.value;
119- if (entry.key case final String key? ) {
120- final severity = ErrorSeverity .values.firstWhereOrNull (
121- (e) => e.displayName == value,
122- );
123- if (severity == null ) {
124- throw ArgumentError (
125- 'Provided error severity: $value specified for key: $key is not valid. '
126- 'Valid error severities are: ${ErrorSeverity .values .map ((e ) => e .displayName ).join (', ' )}' ,
127- );
128- }
129- errors[key] = severity;
130- }
117+ errors[entry.key] = switch (entry.value) {
118+ 'info' => ErrorSeverity .INFO ,
119+ 'warning' => ErrorSeverity .WARNING ,
120+ 'error' => ErrorSeverity .ERROR ,
121+ 'none' => ErrorSeverity .NONE ,
122+ _ => throw UnsupportedError (
123+ 'Unsupported severity ${entry .value } for key: ${entry .key }' ,
124+ ),
125+ };
131126 }
132127 }
133128
0 commit comments