diff --git a/.eslintrc b/.eslintrc index 3a11e64e89..3c50bc0560 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,7 +2,9 @@ "parser": "babel-eslint", "plugins": [ - "babel" + "babel", + "flowtype", + "flow-vars" ], "env": { @@ -44,6 +46,11 @@ "array-bracket-spacing": 0, "generator-star-spacing": 0, + "flowtype/space-after-type-colon": [2, "always"], + "flowtype/space-before-type-colon": [2, "never"], + "flow-vars/define-flow-type": 2, + "flow-vars/use-flow-type": 2, + "arrow-spacing": 2, "block-scoped-var": 0, "brace-style": [2, "1tbs", {"allowSingleLine": true}], @@ -155,7 +162,7 @@ "no-return-assign": 2, "no-script-url": 2, "no-self-compare": 0, - "no-sequences": 2, + "no-sequences": 0, "no-shadow": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, diff --git a/package.json b/package.json index 166a38448b..cd9417dbde 100644 --- a/package.json +++ b/package.json @@ -38,23 +38,25 @@ "babel-runtime": ">=6.0.0" }, "devDependencies": { - "babel-cli": "6.6.5", - "babel-eslint": "6.0.2", - "babel-plugin-syntax-async-functions": "6.5.0", - "babel-plugin-transform-class-properties": "6.6.0", - "babel-plugin-transform-flow-strip-types": "6.7.0", - "babel-plugin-transform-object-rest-spread": "6.6.5", - "babel-plugin-transform-regenerator": "6.6.5", - "babel-plugin-transform-runtime": "6.6.0", + "babel-cli": "6.9.0", + "babel-eslint": "6.0.4", + "babel-plugin-syntax-async-functions": "6.8.0", + "babel-plugin-transform-class-properties": "6.9.1", + "babel-plugin-transform-flow-strip-types": "6.8.0", + "babel-plugin-transform-object-rest-spread": "6.8.0", + "babel-plugin-transform-regenerator": "6.9.0", + "babel-plugin-transform-runtime": "6.9.0", "babel-preset-es2015": "6.6.0", "chai": "3.5.0", "chai-subset": "1.2.2", "coveralls": "2.11.9", - "eslint": "2.7.0", + "eslint": "2.11.1", "eslint-plugin-babel": "3.2.0", - "flow-bin": "0.22.1", + "eslint-plugin-flow-vars": "^0.4.0", + "eslint-plugin-flowtype": "2.2.7", + "flow-bin": "0.26.0", "isparta": "4.0.0", - "mocha": "2.4.5", + "mocha": "2.5.3", "sane": "1.3.4" } } diff --git a/src/language/lexer.js b/src/language/lexer.js index c3d783435e..d325b0ab65 100644 --- a/src/language/lexer.js +++ b/src/language/lexer.js @@ -193,22 +193,19 @@ function readToken(source: Source, fromPosition: number): Token { case 124: return makeToken(TokenKind.PIPE, position, position + 1); // } case 125: return makeToken(TokenKind.BRACE_R, position, position + 1); - // A-Z + // A-Z _ a-z case 65: case 66: case 67: case 68: case 69: case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: case 90: - // _ case 95: - // a-z case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: return readName(source, position); - // - + // - 0-9 case 45: - // 0-9 case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: return readNumber(source, position, code); diff --git a/src/language/parser.js b/src/language/parser.js index 11faabb4b0..e1fa423a1b 100644 --- a/src/language/parser.js +++ b/src/language/parser.js @@ -204,10 +204,11 @@ function parseDefinition(parser: Parser): Definition { if (peek(parser, TokenKind.NAME)) { switch (parser.token.value) { + // Note: subscription is an experimental non-spec addition. case 'query': case 'mutation': - // Note: subscription is an experimental non-spec addition. - case 'subscription': return parseOperationDefinition(parser); + case 'subscription': + return parseOperationDefinition(parser); case 'fragment': return parseFragmentDefinition(parser);