Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

adding eslint-plugin-graphql as dependency #165

Merged
merged 1 commit into from
Sep 19, 2018

Conversation

patsissons
Copy link
Contributor

@patsissons patsissons commented Sep 19, 2018

relates to https://github.com/Shopify/sewing-kit/issues/971 and https://github.com/Shopify/web/pull/6689

This plugin is used by sewing-kit. Rather than having sewing kit depend on both this plugin and eslint-plugin-shopify, we can instead shuffle eslint-plugin-graphql as a dependency of this plugin and pull in all plugins from a single dependency requirement.

@lemonmade
Copy link
Member

Presumably we'd want to expose a config for GraphQL that just passes a bunch of stuff through to the ESLint plugin rules?

@patsissons
Copy link
Contributor Author

patsissons commented Sep 19, 2018

the base graphql config for the plugin (as per the online docs)

module.exports = {
  parser: 'babel-eslint',
  rules: {
    "graphql/template-strings": ['error', {
      env: 'literal'
    }]
  },
  plugins: [
    'graphql'
  ]
}

@lemonmade
Copy link
Member

Oh right, it doesn't even need schema info. We can probably just have a new config for graphql that does this.

@patsissons
Copy link
Contributor Author

on it! just updating the test

@patsissons
Copy link
Contributor Author

@lemonmade should this be added to the all config?

@patsissons patsissons force-pushed the add-eslint-plugin-graphql branch 5 times, most recently from d7ef74c to fdec394 Compare September 19, 2018 17:42
@lemonmade
Copy link
Member

I think so, IIRC all is used for detecting missing configuration for rules

@patsissons
Copy link
Contributor Author

how does that work if the rule from the config is not exposed (like the jquery config)

@patsissons patsissons force-pushed the add-eslint-plugin-graphql branch 5 times, most recently from 72de33c to 2e6a921 Compare September 19, 2018 20:12
@patsissons
Copy link
Contributor Author

patsissons commented Sep 19, 2018

In order to test the all config, we need to add a graphql@^0.13.0 devDependency (a requirement of eslint-plugin-graphql) and supply a dummy .graphqlconfig.yml and schema.graphql file to enable the plugin to full initialize. Unfortunately, the plugin is not smart enough to bail out gracefully if it is included but no graphql configuration exists.

package.json Outdated
@@ -96,6 +97,7 @@
"eslint-plugin-react": "7.11.1",
"eslint-plugin-sort-class-members": "1.3.1",
"eslint-plugin-typescript": "0.12.0",
"graphql": "^0.13.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint-plugin-graphql declares a peerDependency on graphql. Isn't that enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we only need it for testing, i can relegate to a dev dep.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, ty 👍

@patsissons patsissons force-pushed the add-eslint-plugin-graphql branch from 2e6a921 to 06d7fb2 Compare September 19, 2018 20:28
Copy link
Member

@GoodForOneFare GoodForOneFare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much appreciated 👍 Thank you for pulling on this thread, then following through so quickly.

@patsissons patsissons merged commit 56004f6 into master Sep 19, 2018
@patsissons patsissons deleted the add-eslint-plugin-graphql branch September 24, 2018 21:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants