Git Product home page Git Product logo

graphql-prettier's People

Contributors

dependabot[bot] avatar martin-888 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

graphql-prettier's Issues

It removes the comments from the Query

Input

query Hello {
  __typename
	
  # History
  histories(find: {end: "", id: "", start: ""}, limit: 10, order: "") {
    event_date_utc
    flight {
      details
      id
    }
  }
}

Output

query Hello {
  __typename
  histories(find: {end: "", id: "", start: ""}, limit: 10, order: "") {
    event_date_utc
    flight {
      details
      id
    }
  }
}

Problem with this query (with duplicates)

query ( $ids: [String!] $idSize: Int $size: Int $from: Int $name: String $state: String ) { login { id devices(size: $size, from: $from, name: $name, state: $state) { total items { id name state created lastReported hardwareId endpoint { externalAddress internalAddress availability instability geo { connectionType countryName stateName city isp } } owner { id email } services { id name state created lastReported port type access { user { email } } sessions { timestamp endpoint { platform } user { id email } } } } } connections: devices(id: $ids, size: $idSize) { total items { id name state created lastReported hardwareId endpoint { externalAddress internalAddress availability instability geo { connectionType countryName stateName city isp } } owner { id email } services { id name state created lastReported port type access { user { email } } sessions { timestamp endpoint { platform } user { id email } } } } } } }

stack trace:

TypeError: Cannot read properties of undefined (reading 'value')

src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L60):60:1 in findIndex src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L73):73:1 src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L72):72:1 src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L63):63:1 in mergeDuplicatedNotLeafNodes src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L148):148:1 src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/[index.js](https://github.com/remoteit/serverless-test/tree/master/src/api/webpack:/graphql-api/node_modules/graphql-prettier/lib/index.js#L147):147:1

It's not formatting internal query variables

If there is a bunch of variables then It looks like a very complex query, Is it possible to format the variables too while prettifying?

Current outcome

query Hello {
  __typename
   histories(find: {end: "", id: "", start: ""}, limit: 10, order: "") {
    event_date_utc
    flight {
      details
      id
    }
  }
}

Expected outcome

query Hello {
  __typename
   histories( 
      find: { 
           end: "", 
           id: "",
           start: ""
       }, 
       limit: 10, 
       order: "" 
    ) {
    event_date_utc
    flight {
      details
      id
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.