Skip to content

Commit

Permalink
Remove eslint-plugin-graphql (#340)
Browse files Browse the repository at this point in the history
eslint-plugin-graphql is outdated and unsupported. Consumers should use
`@graphql-eslint/eslint-plugin` to lint their grahql files. This plugin
is not included as graphql has a large install footprint and we do not
want to burden consumers that do not use graphql.
  • Loading branch information
BPScott authored Jun 29, 2022
1 parent d8c61cc commit af6fccc
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 593 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-tigers-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/eslint-plugin': major
---

Remove the `@shopify/eslint-plugin/graphql` config and the dependency on `eslint-plugin-graphql` as it is outdated and unsupported. If you used the graphql config then you should migrate to [`@graphql-eslint/eslint-plugin`](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin). We no longer provide recommended graphql config as it has a large install footprint and we do not want to push that onto consumers that do not use graphql.
5 changes: 4 additions & 1 deletion packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ This plugin also provides the following tool-specific configurations, which can
```

- [react](lib/config/react.js): Use this for React projects.
- [graphql](lib/config/graphql.js): Use this for projects that use [graphql-config](https://github.com/prisma/graphql-config) for graphql validation.
- [polaris](lib/config/polaris.js): Use this for projects that use [Shopify’s React Polaris components](https://polaris.shopify.com/components/get-started).
- [prettier](lib/config/prettier.js): Use [prettier](https://github.com/prettier/prettier) for consistent formatting. Extending this Shopify's prettier config will [override](https://github.com/prettier/eslint-config-prettier/blob/master/index.js) the default Shopify eslint rules in favor of prettier formatting. Prettier must be installed within your project, as @shopify/eslint-plugin does not provide the dependency itself.
- [webpack](lib/config/webpack.js): Use this for projects built by [webpack](https://webpack.js.org/).
Expand Down Expand Up @@ -153,3 +152,7 @@ This plugin provides the following custom rules, which are included as appropria
- [typescript/prefer-singular-enums](docs/rules/typescript/prefer-singular-enums.md): Prefer TypeScript enums be singular.
- [typescript/prefer-build-client-schema](docs/rules/typescript/prefer-build-client-schema.md): Prefer buildClientSchema for schema building.
- [webpack/no-unnamed-dynamic-imports](docs/rules/webpack/no-unnamed-dynamic-imports.md): Require that all dynamic imports contain a `webpackChunkName` comment.

## Suggested additional configs

For applications that use graphql we recommend using [`@graphql-eslint/eslint-plugin`](https://github.com/B2o5T/graphql-eslint). This is not included as part of this plugin because graphql has a large install footprint and not everybody needs it.
1 change: 0 additions & 1 deletion packages/eslint-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ module.exports = {
typescript: require('./lib/config/typescript'),

// Augmenting configs - When extending, these go after the core config
graphql: require('./lib/config/graphql'),
jest: require('./lib/config/jest'),
node: require('./lib/config/node'),
polaris: require('./lib/config/polaris'),
Expand Down
23 changes: 0 additions & 23 deletions packages/eslint-plugin/lib/config/graphql.js

This file was deleted.

16 changes: 7 additions & 9 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
"url": "https://github.com/Shopify/web-configs/issues"
},
"homepage": "https://github.com/Shopify/web-configs/blob/main/packages/eslint-plugin/README.md",
"devDependencies": {
"graphql": "^14.6.0",
"react": "^16.13.1",
"typescript": "^3.9.2"
},
"peerDependencies": {
"eslint": "^8.3.0"
},
"dependencies": {
"@babel/eslint-parser": "^7.16.3",
"@babel/eslint-plugin": "^7.14.5",
Expand All @@ -43,7 +35,6 @@
"eslint-config-prettier": "^8.3.0",
"eslint-module-utils": "^2.7.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-graphql": "^4.0.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jest-formatting": "^3.1.0",
Expand All @@ -57,5 +48,12 @@
"jsx-ast-utils": "^3.2.1",
"pkg-dir": "^5.0.0",
"pluralize": "^8.0.0"
},
"peerDependencies": {
"eslint": "^8.3.0"
},
"devDependencies": {
"react": "^16.13.1",
"typescript": "^3.9.2"
}
}
3 changes: 1 addition & 2 deletions packages/eslint-plugin/tests/enable-all-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ module.exports = {
'plugin:@shopify/es5',
'plugin:@shopify/esnext',
'plugin:@shopify/typescript',
'plugin:@shopify/react',

// Augmenting configs - When extending, these go after the core config
'plugin:@shopify/graphql',
'plugin:@shopify/jest',
'plugin:@shopify/node',
'plugin:@shopify/polaris',
'plugin:@shopify/react',
'plugin:@shopify/webpack',

// Prettier config - When extending, this must go last
Expand Down
4 changes: 0 additions & 4 deletions packages/eslint-plugin/tests/fixtures/all/.graphqlconfig

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions packages/eslint-plugin/tests/fixtures/all/build/schema.gql

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

35 changes: 0 additions & 35 deletions packages/eslint-plugin/tests/lib/config/graphql.test.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/eslint-plugin/tests/lib/config/prettier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ describe('config', () => {
).toMatch(/Replace .*"bar".* with .*'bar'/);
}, 8000);

it('does not generate prettier errors in graphql files', () => {
expect(
execESLint(
`--ignore-pattern "**/prettier-graphql/build/*" --config "${fixtureFile(
'prettier-graphql/.eslintrc.js',
)}" "${fixtureFile('prettier-graphql')}"`,
),
).toBe('');
}, 8000);

it('uses .prettierrc as the source of prettier rules', () => {
expect(
execESLint(
Expand Down
Loading

0 comments on commit af6fccc

Please sign in to comment.