File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11
11
const NAME_RX = / ^ [ _ a - z A - Z ] [ _ a - z A - Z 0 - 9 ] * $ / ;
12
12
const ERROR_PREFIX_RX = / ^ E r r o r : / ;
13
13
14
+ // Silences warnings if an environment flag is enabled
15
+ const noNameWarning =
16
+ Boolean ( process && process . env && process . env . GRAPHQL_NO_NAME_WARNING ) ;
17
+
14
18
// Ensures console warnings are only issued once.
15
19
let hasWarnedAboutDunder = false ;
16
20
@@ -26,7 +30,12 @@ export function assertValidName(
26
30
`Must be named. Unexpected name: ${ name } .`
27
31
) ;
28
32
}
29
- if ( ! isIntrospection && name . slice ( 0 , 2 ) === '__' && ! hasWarnedAboutDunder ) {
33
+ if (
34
+ ! isIntrospection &&
35
+ ! hasWarnedAboutDunder &&
36
+ ! noNameWarning &&
37
+ name . slice ( 0 , 2 ) === '__'
38
+ ) {
30
39
hasWarnedAboutDunder = true ;
31
40
/* eslint-disable no-console */
32
41
if ( console && console . warn ) {
You can’t perform that action at this time.
0 commit comments