Skip to content

Commit

Permalink
chore: add graphql linter (#1205)
Browse files Browse the repository at this point in the history
And fix up the reported issues, including removing references to
deprecated fields.

Closes #1204
  • Loading branch information
tackley committed May 28, 2024
1 parent 9aeee1b commit a095388
Show file tree
Hide file tree
Showing 24 changed files with 16,682 additions and 181 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ src/locales/*.js

# these files are code generated
src/graphql-client/*.ts
src/graphql/ads-serve.graphql.schema.json

# npm and prettier fight over a EOF on these files, let npm win:
package.json
Expand Down
3 changes: 3 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const config: CodegenConfig = {
fragmentMasking: false,
},
},
"src/graphql/ads-serve.graphql.schema.json": {
plugins: ["introspection"],
},
},
config: {
strictScalars: true,
Expand Down
29 changes: 26 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ import jsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
import prettier from "eslint-config-prettier";
import reactHooks from "eslint-plugin-react-hooks";
import lingui from "eslint-plugin-lingui";
import * as graphql from "@graphql-eslint/eslint-plugin";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
prettier,
"react-hooks": reactHooks,
lingui,
},
},
{
files: ["**/*.{js,cjs,jsx,mjsx,ts,tsx,mtsx}"],
...reactRecommended,
Expand All @@ -18,10 +26,24 @@ export default tseslint.config(
version: "detect",
},
},
},
{
name: "apply graphql processor to all typescript files",
files: ["**/*.{ts,tsx}"],
processor: graphql.processors.graphql,
},
{
name: "configure graphql linter",
files: ["**/*.graphql"],
plugins: {
prettier,
"react-hooks": reactHooks,
lingui,
"@graphql-eslint": graphql,
},
languageOptions: {
parser: graphql,
},
rules: {
...graphql.configs["operations-recommended"].rules,
"@graphql-eslint/no-deprecated": "warn",
},
},
{
Expand Down Expand Up @@ -91,6 +113,7 @@ export default tseslint.config(
ignores: [
"**/*.test.ts",
"src/components/TimeZonePicker/useTimeZoneList.ts",
"codegen.ts",
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion graphql.config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
schema: "../ads-serve/src/graphql/schema.graphql"
schema: "src/graphql/ads-serve.graphql.schema.json"
documents: "src/**/*.{ts,tsx,graphql}"
Loading

0 comments on commit a095388

Please sign in to comment.