@@ -113,27 +113,24 @@ export function validateQuery(
113
113
return [ ] ;
114
114
}
115
115
116
- const validationErrorAnnotations = mapCat (
117
- validateWithCustomRules ( schema , ast , customRules , isRelayCompatMode ) ,
118
- error => annotations ( error , DIAGNOSTIC_SEVERITY . Error , 'Validation' ) ,
116
+ const validationErrorAnnotations = validateWithCustomRules (
117
+ schema ,
118
+ ast ,
119
+ customRules ,
120
+ isRelayCompatMode ,
121
+ ) . flatMap ( error =>
122
+ annotations ( error , DIAGNOSTIC_SEVERITY . Error , 'Validation' ) ,
119
123
) ;
120
124
121
125
// TODO: detect if > [email protected] , and use the new rule for this.
122
- const deprecationWarningAnnotations = mapCat (
123
- validate ( schema , ast , [ NoDeprecatedCustomRule ] ) ,
124
- error => annotations ( error , DIAGNOSTIC_SEVERITY . Warning , 'Deprecation' ) ,
126
+ const deprecationWarningAnnotations = validate ( schema , ast , [
127
+ NoDeprecatedCustomRule ,
128
+ ] ) . flatMap ( error =>
129
+ annotations ( error , DIAGNOSTIC_SEVERITY . Warning , 'Deprecation' ) ,
125
130
) ;
126
131
return validationErrorAnnotations . concat ( deprecationWarningAnnotations ) ;
127
132
}
128
133
129
- // General utility for mapping-and-concatenating (aka flat-mapping).
130
- function mapCat < T > (
131
- array : ReadonlyArray < T > ,
132
- mapper : ( item : T ) => Array < any > ,
133
- ) : Array < any > {
134
- return Array . prototype . concat . apply ( [ ] , array . map ( mapper ) ) ;
135
- }
136
-
137
134
function annotations (
138
135
error : GraphQLError ,
139
136
severity : DiagnosticSeverity ,
0 commit comments