Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@jfrolich/gatsby-plugin-extract-schema

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jfrolich/gatsby-plugin-extract-schema

Extract Gatsby's generated graphql schema to a JSON file

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

gatsby-plugin-extract-schema

A Gatsby plugin that extracts your graphql schema to a .json file.

You can use this file to check your queries against your schema, by using eslint-plugin-graphql.

Install

Extract schema: npm install --save gatsby-plugin-extract-schema

Use extracted schema: npm install --save-dev eslint babel-eslint eslint-plugin-graphql

How to use

Edit gatsby-config.js

module.exports = {
  plugins: ["gatsby-plugin-extract-schema"]
};

or

{
  resolve: "gatsby-plugin-extract-schema",
    options: {
      dest: `${__dirname}/path/to/schema.json`,
    },
  },
}

Check queries against schema

Add .eslintrc.js to the project root

const path = require("path");
module.exports = {
  parser: "babel-eslint",
  rules: {
    "graphql/template-strings": [
      "error",
      {
        env: "relay",
        schemaJsonFilepath: path.resolve(__dirname, "./schema.json"),
        tagName: "graphql"
      }
    ]
  },
  plugins: ["graphql"]
};

Big thanks to Kurtis Kemple for all his help!

Keywords

gatsby

FAQs

Package last updated on 08 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts