Currently Graphile Export attempts to make your code as efficient as possible via hoisting - anything that can be hoisted to the top will be. We should selectively un-hoist some of these things for legibility, especially where the hoisting confers no benefit.
One example is the GraphQLObjectTypeSpec.fields() callback. It will only be called once, so there's no need to hoist. i.e.
We should also consider selectively downgrading Object.assign(Object.create(null), { ... }) to just { ... } where it's safe to do so. Maybe via a configuration flag ("dangerouslyReadable" 😉 )
Currently Graphile Export attempts to make your code as efficient as possible via hoisting - anything that can be hoisted to the top will be. We should selectively un-hoist some of these things for legibility, especially where the hoisting confers no benefit.
One example is the
GraphQLObjectTypeSpec.fields()
callback. It will only be called once, so there's no need to hoist. i.e.should become:
We should also consider selectively downgrading
Object.assign(Object.create(null), { ... })
to just{ ... }
where it's safe to do so. Maybe via a configuration flag ("dangerouslyReadable" 😉 )