StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

incorrect line break on assignment of function

Open matthargett opened this issue 3 years ago • 0 comments

exports.ScalarLeafsRule = function(context)
        return {
                Field = function(_self, node)
                        local type_ = context:getType()
                        local selectionSet = node.selectionSet
                        if type_ then
                                if isLeafType(getNamedType(type_)) then
                                        if selectionSet then
                                                local fieldName = node.name.value
                                                local typeStr = inspect(type_)
                                                context:reportError(
                                                        GraphQLError.new(
                                                                ('Field "%s" must not have a selection since type "%s" has no subfields.'):format(
                                                                        fieldName,
                                                                        typeStr
                                                                ),
                                                                selectionSet
                                                        )
                                                )
                                        end
                                elseif not selectionSet then
                                        local fieldName = node.name.value
                                        local typeStr = 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
                                                )
                                        )
                                end
                        end
                end,
        }
end
image

matthargett avatar Jul 26 '22 06:07 matthargett