aboutsummaryrefslogtreecommitdiffstats
path: root/webui
diff options
context:
space:
mode:
authorQuentin Gliech <quentingliech@gmail.com>2020-02-11 22:11:08 +0100
committerQuentin Gliech <quentingliech@gmail.com>2020-02-11 22:11:08 +0100
commitb70b4ba4b17d02d9744bd72494549f5cf7d980f8 (patch)
tree0df79bf22bc556389b95348302d89d4950a42899 /webui
parent465f7ca73d7093eeeecb6553c804d8cfb06e6652 (diff)
downloadgit-bug-b70b4ba4b17d02d9744bd72494549f5cf7d980f8.tar.gz
webui: lint graphql files
Diffstat (limited to 'webui')
-rw-r--r--webui/.eslintrc.js (renamed from webui/.eslintrc)15
-rw-r--r--webui/Makefile1
-rw-r--r--webui/codegen.yaml9
-rw-r--r--webui/package-lock.json55
-rw-r--r--webui/package.json4
-rw-r--r--webui/src/.gitignore1
6 files changed, 77 insertions, 8 deletions
diff --git a/webui/.eslintrc b/webui/.eslintrc.js
index 3c6e976f..2b4a60de 100644
--- a/webui/.eslintrc
+++ b/webui/.eslintrc.js
@@ -1,10 +1,17 @@
-{
- "extends": [
+module.exports = {
+ extends: [
"react-app",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
- "rules": {
+ plugins: [
+ "graphql"
+ ],
+ rules: {
+ "graphql/template-strings": ["error", {
+ "schemaJson": require("./src/schema.json"),
+ "env": "literal"
+ }],
"import/order": [
"error", {
"alphabetize": {"order": "asc"},
@@ -22,4 +29,4 @@
}
]
}
-}
+};
diff --git a/webui/Makefile b/webui/Makefile
index 8c028e10..4ba7fa29 100644
--- a/webui/Makefile
+++ b/webui/Makefile
@@ -5,6 +5,7 @@ install:
npm install
test:
+ npm run generate
npm run lint
CI=true npm run test
diff --git a/webui/codegen.yaml b/webui/codegen.yaml
index 30b67e45..1580632e 100644
--- a/webui/codegen.yaml
+++ b/webui/codegen.yaml
@@ -10,9 +10,12 @@ generates:
./src/gqlTypes.ts:
plugins:
- typescript
+ ./src/schema.json:
+ plugins:
+ - introspection
./src/:
plugins:
- - add: '/* eslint-disable @typescript-eslint/no-unused-vars */'
+ - add: '/* eslint-disable @typescript-eslint/no-unused-vars, import/order */'
- typescript-operations
- typescript-react-apollo
preset: near-operation-file
@@ -25,5 +28,5 @@ generates:
withHooks: true
hooks:
- afterOneFileWrite:
- - eslint --fix
+ afterAllFileWrite:
+ - prettier --write
diff --git a/webui/package-lock.json b/webui/package-lock.json
index 78551d98..9bc9576c 100644
--- a/webui/package-lock.json
+++ b/webui/package-lock.json
@@ -1340,6 +1340,36 @@
"@graphql-codegen/plugin-helpers": "1.12.1"
}
},
+ "@graphql-codegen/introspection": {
+ "version": "1.12.2",
+ "resolved": "https://registry.npmjs.org/@graphql-codegen/introspection/-/introspection-1.12.2.tgz",
+ "integrity": "sha512-YMQIn1R2CxYZLkxkW6fUxqfTBr2WC3Cimp6/0oEcSyLA/W1scVuDw/IUeU5Iu4CEmz8IaqPSjSMEN+8l95wKlA==",
+ "dev": true,
+ "requires": {
+ "@graphql-codegen/plugin-helpers": "1.12.2",
+ "tslib": "1.10.0"
+ },
+ "dependencies": {
+ "@graphql-codegen/plugin-helpers": {
+ "version": "1.12.2",
+ "resolved": "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-1.12.2.tgz",
+ "integrity": "sha512-N294rqdBh+mCi4HWHbhPV9wE0XLCVKx524pYL4yp8qWiSdAs3Iz9+q9C9QNsLBvHypZdqml44M8kBMG41A9I/Q==",
+ "dev": true,
+ "requires": {
+ "@graphql-toolkit/common": "0.9.7",
+ "camel-case": "4.1.1",
+ "common-tags": "1.8.0",
+ "constant-case": "3.0.3",
+ "import-from": "3.0.0",
+ "lower-case": "2.0.1",
+ "param-case": "3.0.3",
+ "pascal-case": "3.1.1",
+ "tslib": "1.10.0",
+ "upper-case": "2.0.1"
+ }
+ }
+ }
+ },
"@graphql-codegen/near-operation-file-preset": {
"version": "1.12.2-alpha-ea7264f9.15",
"resolved": "https://registry.npmjs.org/@graphql-codegen/near-operation-file-preset/-/near-operation-file-preset-1.12.2-alpha-ea7264f9.15.tgz",
@@ -6300,6 +6330,31 @@
"lodash": "^4.17.15"
}
},
+ "eslint-plugin-graphql": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-graphql/-/eslint-plugin-graphql-3.1.1.tgz",
+ "integrity": "sha512-VNu2AipS8P1BAnE/tcJ2EmBWjFlCnG+1jKdUlFNDQjocWZlFiPpMu9xYNXePoEXK+q+jG51M/6PdhOjEgJZEaQ==",
+ "dev": true,
+ "requires": {
+ "graphql-config": "^2.0.1",
+ "lodash": "^4.11.1"
+ },
+ "dependencies": {
+ "graphql-config": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/graphql-config/-/graphql-config-2.2.1.tgz",
+ "integrity": "sha512-U8+1IAhw9m6WkZRRcyj8ZarK96R6lQBQ0an4lp76Ps9FyhOXENC5YQOxOFGm5CxPrX2rD0g3Je4zG5xdNJjwzQ==",
+ "dev": true,
+ "requires": {
+ "graphql-import": "^0.7.1",
+ "graphql-request": "^1.5.0",
+ "js-yaml": "^3.10.0",
+ "lodash": "^4.17.4",
+ "minimatch": "^3.0.4"
+ }
+ }
+ }
+ },
"eslint-plugin-import": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.0.tgz",
diff --git a/webui/package.json b/webui/package.json
index ed143e68..cf61b883 100644
--- a/webui/package.json
+++ b/webui/package.json
@@ -36,7 +36,9 @@
"@graphql-codegen/near-operation-file-preset": "^1.12.2-alpha-ea7264f9.15",
"@graphql-codegen/typescript-operations": "^1.12.1",
"@graphql-codegen/typescript-react-apollo": "^1.12.1",
+ "@graphql-codegen/introspection": "^1.12.2",
"eslint-config-prettier": "^6.10.0",
+ "eslint-plugin-graphql": "^3.1.1",
"eslint-plugin-prettier": "^3.1.2",
"prettier": "^1.19.1"
},
@@ -46,7 +48,7 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"generate": "graphql-codegen",
- "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'"
+ "lint": "eslint src --ext .ts --ext .tsx --ext .js --ext .jsx --ext .graphql"
},
"proxy": "http://localhost:3001",
"browserslist": [
diff --git a/webui/src/.gitignore b/webui/src/.gitignore
index 52b71a15..640de4f9 100644
--- a/webui/src/.gitignore
+++ b/webui/src/.gitignore
@@ -1,3 +1,4 @@
fragmentTypes.js
gqlTypes.ts
*.generated.*
+schema.json