You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exports.ScalarLeafsRule=function(context)
return {
Field=function(_self, node)
localtype_=context:getType()
localselectionSet=node.selectionSetiftype_thenifisLeafType(getNamedType(type_)) thenifselectionSetthenlocalfieldName=node.name.valuelocaltypeStr=inspect(type_)
context:reportError(
GraphQLError.new(
('Field "%s" must not have a selection since type "%s" has no subfields.'):format(
fieldName,
typeStr
),
selectionSet
)
)
endelseifnotselectionSetthenlocalfieldName=node.name.valuelocaltypeStr=inspect(type_)
context:reportError(
GraphQLError.new(
('Field "%s" of type "%s" must have a selection of subfields. Did you mean "%s { ... }"?'):format(
fieldName,
typeStr,
fieldName
),
node
)
)
endendend,
}
end
The text was updated successfully, but these errors were encountered:
[Copying message from offline]
The reason this is hanging is because it produces less lines...
That is because of this expression
context:reportError(
GraphQLError.new(
('Field "%s" of type "%s" must have a selection of subfields. Did you mean "%s { ... }"?'):format(
fieldName,
typeStr,
fieldName
),
node
)
)
Because, when we hang at the equals token, the block gets indented a level further, and the extra indentation causes a re-formatting to
context:reportError(
GraphQLError.new(
(
'Field "%s" of type "%s" must have a selection of subfields. Did you mean "%s { ... }"?'
):format(fieldName, typeStr, fieldName),
node
)
)
which... technically has less lines
The reason it only gets reformatted when the block is indented is because the parentheses expression finishes just before the char limit, and when we indent it now goes over it.
One potential fix we could do here is to just prevent the expression ("str"):call from ever expanding the parentheses, as it provides no added benefit. It doesn't fix the underlying cause, but it should stop this from hanging
The text was updated successfully, but these errors were encountered: