Skip to content

Commit b51a0b0

Browse files
committed
chore: use new graphql linter
1 parent e0b6258 commit b51a0b0

File tree

5 files changed

+705
-494
lines changed

5 files changed

+705
-494
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ node_modules
22
_static
33
static
44
app/buildInfo.js
5+
build/schema.graphql
6+
digitransit-search-util/packages/digitransit-search-util-query-utils/schema/schema.graphql
57
digitransit-component/packages/**/lib
68
digitransit-store/packages/**/lib
79
digitransit-search-util/packages/**/lib

.eslintrc.js

+44-12
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ module.exports = {
4646
// compat
4747
'compat/compat': 'warn',
4848

49-
// graphql
50-
'graphql/template-strings': [
51-
'error',
52-
{
53-
env: 'relay',
54-
// eslint-disable-next-line global-require
55-
schemaJson: require('./build/schema.json').data,
56-
tagName: 'graphql',
57-
},
58-
],
59-
6049
// prettier
6150
'prettier/prettier': [
6251
'error',
@@ -71,8 +60,51 @@ module.exports = {
7160
env: {
7261
browser: true,
7362
},
74-
plugins: ['react', 'graphql', 'compat', 'prettier', 'jsx-a11y'],
63+
plugins: ['react', 'compat', 'prettier', 'jsx-a11y'],
7564
settings: {
7665
polyfills: ['fetch', 'promises'],
7766
},
67+
overrides: [
68+
{
69+
files: ['*.js'],
70+
processor: '@graphql-eslint/graphql',
71+
},
72+
{
73+
files: ['*.graphql'],
74+
extends: [
75+
'plugin:@graphql-eslint/operations-recommended',
76+
'plugin:@graphql-eslint/relay',
77+
],
78+
// Available rules can be found at https://the-guild.dev/graphql/eslint/rules/naming-convention
79+
rules: {
80+
'@graphql-eslint/no-deprecated': 'warn',
81+
// Recommended naming conventions have some clashes with relay conventions
82+
'@graphql-eslint/naming-convention': [
83+
'error',
84+
{
85+
VariableDefinition: 'camelCase',
86+
},
87+
],
88+
// Relay directives caused errors and ignoring them didn't work for some reason
89+
'@graphql-eslint/known-directives': 'off',
90+
91+
// These require parserOptions.operations to be defined
92+
// but haven't been able to figure out if it is possible
93+
// to define them with relay
94+
'@graphql-eslint/known-fragment-names': 'off',
95+
'@graphql-eslint/no-one-place-fragments': 'off',
96+
'@graphql-eslint/no-undefined-variables': 'off',
97+
'@graphql-eslint/no-unused-fragments': 'off',
98+
'@graphql-eslint/no-unused-variables': 'off',
99+
'@graphql-eslint/require-id-when-available': 'off',
100+
'@graphql-eslint/require-import-fragment': 'off',
101+
'@graphql-eslint/selection-set-depth': 'off',
102+
'@graphql-eslint/unique-fragment-name': 'off',
103+
'@graphql-eslint/unique-operation-name': 'off',
104+
},
105+
parserOptions: {
106+
schema: './build/schema.graphql',
107+
},
108+
},
109+
],
78110
};

.yarnrc.yml

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ packageExtensions:
2222
graphql-config@*:
2323
peerDependencies:
2424
typescript: "*"
25-
eslint-plugin-graphql@*:
26-
peerDependencies:
27-
typescript: "*"
2825
"@lerna/version@*":
2926
peerDependencies:
3027
"@octokit/core": "*"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@
238238
"@babel/runtime": "7.20.6",
239239
"@commitlint/cli": "9.1.2",
240240
"@commitlint/config-conventional": "9.1.2",
241+
"@graphql-eslint/eslint-plugin": "3.20.1",
241242
"@lerna/batch-packages": "3.16.0",
242243
"@lerna/filter-packages": "3.18.0",
243244
"@lerna/project": "3.21.0",
@@ -268,7 +269,6 @@
268269
"eslint-config-prettier": "9.1.0",
269270
"eslint-import-resolver-webpack": "0.13.8",
270271
"eslint-plugin-compat": "4.2.0",
271-
"eslint-plugin-graphql": "4.0.0",
272272
"eslint-plugin-import": "2.29.1",
273273
"eslint-plugin-jsx-a11y": "6.8.0",
274274
"eslint-plugin-prettier": "5.1.2",

0 commit comments

Comments
 (0)