Mayank1791989 / gql

112 stars 19 forks source link

JSON5 Error -Expected ':' instead of 'G' #59

Closed idkjs closed 7 years ago

idkjs commented 7 years ago

I tried to use the JSON5 template. I cp'd the sample code into .gqlconfig

I get error: ' Expected ':' instead of 'G'''. Ran JSON5 validator on it, same result. New to json5. Do i need a different extension? Thank you.


  type GQLConfig = {
  schema: {
    files: FileMatchConfig,
    validate?: ValidateConfig
  },
  query?: { // query optional
    files: Array<{
      match: FileMatchConfig, // match files
      parser: QueryParser, 
      isRelay?: boolean,
      validate?: ValidateConfig,
    }>
  }
};

type FileMatchConfig = Globs | { include: Globs, ignore?: Globs };
type Globs = string | Array<string>; // eg **/*.js  **/*.gql

type QueryParser = (
  'QueryParser'
  | ['EmbeddedQueryParser', { startTag: regexpStr, endTag: regexpStr }];
);

type ValidateConfig = {
  extends: 'gql-rules-schema' | 'gql-rules-query' | 'gql-rules-query-relay',
  rules?: {
    [ruleName: string]: 'off' | 'warn' | 'error',
  },
};
Mayank1791989 commented 7 years ago

The code which you are using is the file structure (using flow types), the actual json file sample is below it in readme.

// .gqlconfig (only schema)
{
  schema: {
    files: 'schema/**/*.gql'
  }
}

I will fix the readme to avoid confusion.

idkjs commented 7 years ago

Thank you.