浏览代码

Use the default __generated__ directory name

Andrew Swistak 6 年之前
父节点
当前提交
77ab7e8b50

+ 5 - 2
.eslintrc.js

@@ -10,6 +10,7 @@ module.exports = {
     'plugin:@typescript-eslint/recommended',
     'prettier',
     'prettier/@typescript-eslint',
+    'plugin:relay/recommended',
   ],
   settings: {
     react: {
@@ -35,10 +36,12 @@ module.exports = {
       project: './tsconfig.json',
     },
   },
-  plugins: ['@typescript-eslint'],
+  plugins: ['relay', '@typescript-eslint'],
   rules: {
     // TypeScript Rules
     '@typescript-eslint/no-explicit-any': 0,
+    // JavaScript rules will handle these
+    '@typescript-eslint/camelcase': 0,
 
     // JavaScript Rules
     'arrow-body-style': ['warn', 'as-needed'],
@@ -61,7 +64,7 @@ module.exports = {
     'no-shadow': 1,
     'no-trailing-spaces': 'error',
     'no-unused-expressions': 1,
-    'no-unused-vars': 1,
+    'no-unused-vars': 0,
     'no-useless-rename': 'error',
     'no-whitespace-before-property': 'error',
     'object-curly-newline': ['error', {consistent: true}],

+ 0 - 0
app/javascript/packs/frontend/__generated_queries__/relayTestQuery.graphql.ts → app/javascript/packs/frontend/__generated__/relayTestQuery.graphql.ts


+ 62 - 0
app/javascript/packs/frontend/__generated__/show_pokemon.graphql.ts

@@ -0,0 +1,62 @@
+/* tslint:disable */
+
+import { ReaderFragment } from "relay-runtime";
+declare const _show_pokemon$ref: unique symbol;
+export type show_pokemon$ref = typeof _show_pokemon$ref;
+export type show_pokemon = {
+    readonly iid: string;
+    readonly pokedexNumber: number | null;
+    readonly nickname: string | null;
+    readonly createdAt: any | null;
+    readonly updatedAt: any | null;
+    readonly " $refType": show_pokemon$ref;
+};
+
+
+
+const node: ReaderFragment = {
+  "kind": "Fragment",
+  "name": "show_pokemon",
+  "type": "Pokemon",
+  "metadata": null,
+  "argumentDefinitions": [],
+  "selections": [
+    {
+      "kind": "ScalarField",
+      "alias": null,
+      "name": "iid",
+      "args": null,
+      "storageKey": null
+    },
+    {
+      "kind": "ScalarField",
+      "alias": null,
+      "name": "pokedexNumber",
+      "args": null,
+      "storageKey": null
+    },
+    {
+      "kind": "ScalarField",
+      "alias": null,
+      "name": "nickname",
+      "args": null,
+      "storageKey": null
+    },
+    {
+      "kind": "ScalarField",
+      "alias": null,
+      "name": "createdAt",
+      "args": null,
+      "storageKey": null
+    },
+    {
+      "kind": "ScalarField",
+      "alias": null,
+      "name": "updatedAt",
+      "args": null,
+      "storageKey": null
+    }
+  ]
+};
+(node as any).hash = '8a2ac0b4888fd3581f1987b05dd2d33b';
+export default node;

+ 1 - 1
babel.config.js

@@ -39,7 +39,7 @@ module.exports = function(api) {
       [
         require('babel-plugin-relay'),
         {
-          artifactDirectory: './app/javascript/packs/frontend/__generated_queries__',
+          artifactDirectory: './app/javascript/packs/frontend/__generated__',
         },
       ],
       require('@babel/plugin-syntax-dynamic-import').default,

+ 2 - 1
package.json

@@ -10,7 +10,7 @@
     "test": "jest --verbose false",
     "test:update_snapshots": "jest --updateSnapshot",
     "test:watch": "jest --watchAll",
-    "relay": "relay-compiler --src ./app/javascript/packs --schema ./db/schema.graphql  --language typescript --extensions js jsx ts tsx --artifactDirectory ./app/javascript/packs/frontend/__generated_queries__"
+    "relay": "relay-compiler --src ./app/javascript/packs --schema ./db/schema.graphql  --language typescript --extensions js jsx ts tsx --artifactDirectory ./app/javascript/packs/frontend/__generated__"
   },
   "jest": {
     "preset": "ts-jest",
@@ -76,6 +76,7 @@
     "eslint-config-prettier": "^4.1.0",
     "eslint-plugin-prettier": "^3.0.1",
     "eslint-plugin-react": "^7.12.4",
+    "eslint-plugin-relay": "^1.3.1",
     "graphql": "^14.3.0",
     "jest": "^24.7.1",
     "prettier": "^1.17.0",

+ 8 - 1
yarn.lock

@@ -3561,6 +3561,13 @@ eslint-plugin-react@^7.12.4:
     prop-types "^15.6.2"
     resolve "^1.9.0"
 
+eslint-plugin-relay@^1.3.1:
+  version "1.3.1"
+  resolved "https://registry.yarnpkg.com/eslint-plugin-relay/-/eslint-plugin-relay-1.3.1.tgz#93cf8f7d7892cd6ed997ecd635a92fc23689b41b"
+  integrity sha512-xGHC4FqWOzxBA5sZKk/hRqTNBOA5HiHZaKXFMwlHoVCVnkf59r4UHqo9Pz/dgLlPks09DvttyFfy7+hP8wN9Lg==
+  dependencies:
+    graphql "^14.0.0"
+
 eslint-scope@3.7.1:
   version "3.7.1"
   resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
@@ -4352,7 +4359,7 @@ graphql@^0.10.5:
   dependencies:
     iterall "^1.1.0"
 
-graphql@^14.3.0:
+graphql@^14.0.0, graphql@^14.3.0:
   version "14.3.0"
   resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.3.0.tgz#34dd36faa489ff642bcd25df6c3b4f988a1a2f3e"
   integrity sha512-MdfI4v7kSNC3NhB7cF8KNijDsifuWO2XOtzpyququqaclO8wVuChYv+KogexDwgP5sp7nFI9Z6N4QHgoLkfjrg==