diff --git a/vscode-extension/.eslintrc b/vscode-extension/.eslintrc index 13ab439eeb6de..554bc1943d979 100644 --- a/vscode-extension/.eslintrc +++ b/vscode-extension/.eslintrc @@ -10,11 +10,13 @@ "operator-linebreak": "off", "@typescript-eslint/indent": "off", "@typescript-eslint/object-curly-spacing": "off", + "object-curly-newline": "off", + "arrow-parens": "off", // Opinionated "import/prefer-default-export": "off", "no-await-in-loop": "off", "no-use-before-define": "off", - "@typescript-eslint/no-use-before-define": ["error", { "functions": false }] + "@typescript-eslint/no-use-before-define": ["error", {"functions": false}] } } diff --git a/vscode-extension/grammars/graphql.js.json b/vscode-extension/grammars/graphql.js.json index aa6f672172d89..5dd2aa6fe5f18 100644 --- a/vscode-extension/grammars/graphql.js.json +++ b/vscode-extension/grammars/graphql.js.json @@ -28,7 +28,7 @@ "name": "punctuation.definition.string.template.end.js" } }, - "patterns": [{ "include": "source.graphql" }] + "patterns": [{"include": "source.graphql"}] }, { "name": "taggedTemplates", @@ -48,7 +48,7 @@ "name": "punctuation.definition.string.template.end.js" } }, - "patterns": [{ "include": "source.graphql" }] + "patterns": [{"include": "source.graphql"}] } ], "scopeName": "inline.graphql" diff --git a/vscode-extension/grammars/graphql.json b/vscode-extension/grammars/graphql.json index 3658be0bcd2cb..d96a71a965176 100644 --- a/vscode-extension/grammars/graphql.json +++ b/vscode-extension/grammars/graphql.json @@ -2,31 +2,31 @@ "name": "GraphQL", "scopeName": "source.graphql", "fileTypes": ["graphql", "graphqls", "gql", "graphcool"], - "patterns": [{ "include": "#graphql" }], + "patterns": [{"include": "#graphql"}], "repository": { "graphql": { "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-fragment-definition" }, - { "include": "#graphql-directive-definition" }, - { "include": "#graphql-type-interface" }, - { "include": "#graphql-enum" }, - { "include": "#graphql-scalar" }, - { "include": "#graphql-union" }, - { "include": "#graphql-schema" }, - { "include": "#graphql-operation-def" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-fragment-definition"}, + {"include": "#graphql-directive-definition"}, + {"include": "#graphql-type-interface"}, + {"include": "#graphql-enum"}, + {"include": "#graphql-scalar"}, + {"include": "#graphql-union"}, + {"include": "#graphql-schema"}, + {"include": "#graphql-operation-def"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-operation-def": { "patterns": [ - { "include": "#graphql-query-mutation" }, - { "include": "#graphql-name" }, - { "include": "#graphql-variable-definitions" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-selection-set" } + {"include": "#graphql-query-mutation"}, + {"include": "#graphql-name"}, + {"include": "#graphql-variable-definitions"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-selection-set"} ] }, "graphql-fragment-definition": { @@ -34,25 +34,25 @@ "begin": "\\s*(?:(\\bfragment\\b)\\s*([_A-Za-z][_0-9A-Za-z]*)?\\s*(?:(\\bon\\b)\\s*([_A-Za-z][_0-9A-Za-z]*)))", "end": "(?<=})", "captures": { - "1": { "name": "keyword.fragment.graphql" }, - "2": { "name": "entity.name.fragment.graphql" }, - "3": { "name": "keyword.on.graphql" }, - "4": { "name": "support.type.graphql" } + "1": {"name": "keyword.fragment.graphql"}, + "2": {"name": "entity.name.fragment.graphql"}, + "3": {"name": "keyword.on.graphql"}, + "4": {"name": "support.type.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-selection-set"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-skip-newlines"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-query-mutation": { "match": "\\s*\\b(query|mutation)\\b", "captures": { - "1": { "name": "keyword.operation.graphql" } + "1": {"name": "keyword.operation.graphql"} } }, "graphql-type-interface": { @@ -61,41 +61,41 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.type.graphql" }, - "2": { "name": "keyword.type.graphql" }, - "3": { "name": "keyword.interface.graphql" }, - "4": { "name": "keyword.input.graphql" }, - "5": { "name": "support.type.graphql" } + "1": {"name": "keyword.type.graphql"}, + "2": {"name": "keyword.type.graphql"}, + "3": {"name": "keyword.interface.graphql"}, + "4": {"name": "keyword.input.graphql"}, + "5": {"name": "support.type.graphql"} }, "patterns": [ { "begin": "\\s*\\b(implements)\\b\\s*", "end": "\\s*(?={)", "beginCaptures": { - "1": { "name": "keyword.implements.graphql" } + "1": {"name": "keyword.implements.graphql"} }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "support.type.graphql" } + "1": {"name": "support.type.graphql"} } }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-ampersand" }, - { "include": "#graphql-comma" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-ampersand"}, + {"include": "#graphql-comma"} ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-type-object" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-ignore-spaces" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-type-object"}, + {"include": "#literal-quasi-embedded"}, + {"include": "#graphql-ignore-spaces"} ] }, "graphql-ignore-spaces": { @@ -106,18 +106,18 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-object-type" }, - { "include": "#graphql-type-definition" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-object-type"}, + {"include": "#graphql-type-definition"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-type-definition": { @@ -125,74 +125,74 @@ "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.graphql" } + "1": {"name": "variable.graphql"} }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": {"name": "punctuation.comma.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-variable-definitions" }, - { "include": "#graphql-type-object" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-input-types" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-variable-definitions"}, + {"include": "#graphql-type-object"}, + {"include": "#graphql-colon"}, + {"include": "#graphql-input-types"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-schema": { "begin": "\\s*\\b(schema)\\b", "end": "(?<=})", "beginCaptures": { - "1": { "name": "keyword.schema.graphql" } + "1": {"name": "keyword.schema.graphql"} }, "patterns": [ { "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "patterns": [ { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.arguments.graphql" } + "1": {"name": "variable.arguments.graphql"} }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": {"name": "punctuation.comma.graphql"} }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "support.type.graphql" } + "1": {"name": "support.type.graphql"} } }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-colon"}, + {"include": "#graphql-skip-newlines"} ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-skip-newlines"} ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-skip-newlines"} ] }, "graphql-comment": { @@ -242,14 +242,14 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "captures": { - "1": { "name": "meta.brace.round.graphql" } + "1": {"name": "meta.brace.round.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-variable-definition" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-variable-definition"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-variable-definition": { @@ -258,31 +258,31 @@ "begin": "\\s*(\\$?[_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*((\\$?[_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(}|\\))))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.parameter.graphql" } + "1": {"name": "variable.parameter.graphql"} }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": {"name": "punctuation.comma.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-input-types" }, - { "include": "#graphql-variable-assignment" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-colon"}, + {"include": "#graphql-input-types"}, + {"include": "#graphql-variable-assignment"}, + {"include": "#literal-quasi-embedded"}, + {"include": "#graphql-skip-newlines"} ] }, "graphql-input-types": { "patterns": [ - { "include": "#graphql-scalar-type" }, + {"include": "#graphql-scalar-type"}, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(!))?", "captures": { - "1": { "name": "support.type.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": {"name": "support.type.graphql"}, + "2": {"name": "keyword.operator.nulltype.graphql"} } }, { @@ -290,16 +290,16 @@ "begin": "\\s*(\\[)", "end": "\\s*(\\])(?:\\s*(!))?", "captures": { - "1": { "name": "meta.brace.square.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": {"name": "meta.brace.square.graphql"}, + "2": {"name": "keyword.operator.nulltype.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-input-types" }, - { "include": "#graphql-comma" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-input-types"}, + {"include": "#graphql-comma"}, + {"include": "#literal-quasi-embedded"} ] } ] @@ -307,15 +307,15 @@ "graphql-scalar": { "match": "\\s*\\b(scalar)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "keyword.scalar.graphql" }, - "2": { "name": "entity.scalar.graphql" } + "1": {"name": "keyword.scalar.graphql"}, + "2": {"name": "entity.scalar.graphql"} } }, "graphql-scalar-type": { "match": "\\s*\\b(Int|Float|String|Boolean|ID)\\b(?:\\s*(!))?", "captures": { - "1": { "name": "support.type.builtin.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": {"name": "support.type.builtin.graphql"}, + "2": {"name": "keyword.operator.nulltype.graphql"} } }, "graphql-variable-assignment": { @@ -323,38 +323,38 @@ "end": "(?=[\n,)])", "applyEndPatternLast": 1, "beginCaptures": { - "1": { "name": "punctuation.assignment.graphql" } + "1": {"name": "punctuation.assignment.graphql"} }, - "patterns": [{ "include": "#graphql-value" }] + "patterns": [{"include": "#graphql-value"}] }, "graphql-comma": { "match": "\\s*(,)", "captures": { - "1": { "name": "punctuation.comma.graphql" } + "1": {"name": "punctuation.comma.graphql"} } }, "graphql-ampersand": { "match": "\\s*(&)", "captures": { - "1": { "name": "keyword.operator.logical.graphql" } + "1": {"name": "keyword.operator.logical.graphql"} } }, "graphql-colon": { "match": "\\s*(:)", "captures": { - "1": { "name": "punctuation.colon.graphql" } + "1": {"name": "punctuation.colon.graphql"} } }, "graphql-union-mark": { "match": "\\s*(\\|)", "captures": { - "1": { "name": "punctuation.union.graphql" } + "1": {"name": "punctuation.union.graphql"} } }, "graphql-name": { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "entity.name.function.graphql" } + "1": {"name": "entity.name.function.graphql"} } }, "graphql-directive": { @@ -362,15 +362,15 @@ "end": "(?=.)", "applyEndPatternLast": 1, "beginCaptures": { - "1": { "name": "entity.name.function.directive.graphql" } + "1": {"name": "entity.name.function.directive.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-arguments" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-arguments"}, + {"include": "#literal-quasi-embedded"}, + {"include": "#graphql-skip-newlines"} ] }, "graphql-directive-definition": { @@ -384,8 +384,8 @@ "2": { "name": "entity.name.function.directive.graphql" }, - "3": { "name": "keyword.on.graphql" }, - "4": { "name": "support.type.graphql" } + "3": {"name": "keyword.on.graphql"}, + "4": {"name": "support.type.graphql"} }, "patterns": [ { @@ -439,21 +439,21 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-field" }, - { "include": "#graphql-fragment-spread" }, - { "include": "#graphql-inline-fragment" }, - { "include": "#graphql-comma" }, - { "include": "#native-interpolation" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-field"}, + {"include": "#graphql-fragment-spread"}, + {"include": "#graphql-inline-fragment"}, + {"include": "#graphql-comma"}, + {"include": "#native-interpolation"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-field": { @@ -461,21 +461,21 @@ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)\\s*(:)", "captures": { - "1": { "name": "string.unquoted.alias.graphql" }, - "2": { "name": "punctuation.colon.graphql" } + "1": {"name": "string.unquoted.alias.graphql"}, + "2": {"name": "punctuation.colon.graphql"} } }, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "variable.graphql" } + "1": {"name": "variable.graphql"} } }, - { "include": "#graphql-arguments" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-selection-set" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-arguments"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-selection-set"}, + {"include": "#literal-quasi-embedded"}, + {"include": "#graphql-skip-newlines"} ] }, "graphql-fragment-spread": { @@ -483,17 +483,17 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.operator.spread.graphql" }, - "2": { "name": "variable.fragment.graphql" } + "1": {"name": "keyword.operator.spread.graphql"}, + "2": {"name": "variable.fragment.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-selection-set"}, + {"include": "#graphql-directive"}, + {"include": "#literal-quasi-embedded"}, + {"include": "#graphql-skip-newlines"} ] }, "graphql-inline-fragment": { @@ -501,18 +501,18 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.operator.spread.graphql" }, - "2": { "name": "keyword.on.graphql" }, - "3": { "name": "support.type.graphql" } + "1": {"name": "keyword.operator.spread.graphql"}, + "2": {"name": "keyword.on.graphql"}, + "3": {"name": "support.type.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-selection-set"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-skip-newlines"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-arguments": { @@ -520,59 +520,59 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "beginCaptures": { - "1": { "name": "meta.brace.round.directive.graphql" } + "1": {"name": "meta.brace.round.directive.graphql"} }, "endCaptures": { - "1": { "name": "meta.brace.round.directive.graphql" } + "1": {"name": "meta.brace.round.directive.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(:))", "end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|\\)))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.parameter.graphql" }, - "2": { "name": "punctuation.colon.graphql" } + "1": {"name": "variable.parameter.graphql"}, + "2": {"name": "punctuation.colon.graphql"} }, "endCaptures": { - "3": { "name": "punctuation.comma.graphql" } + "3": {"name": "punctuation.comma.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-value" }, - { "include": "#graphql-skip-newlines" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-value"}, + {"include": "#graphql-skip-newlines"} ] }, - { "include": "#literal-quasi-embedded" } + {"include": "#literal-quasi-embedded"} ] }, "graphql-variable-name": { "match": "\\s*(\\$[_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "variable.graphql" } + "1": {"name": "variable.graphql"} } }, "graphql-float-value": { "match": "\\s*(-?(0|[1-9][0-9]*)(\\.[0-9]+)?((e|E)(\\+|-)?[0-9]+)?)", "captures": { - "1": { "name": "constant.numeric.float.graphql" } + "1": {"name": "constant.numeric.float.graphql"} } }, "graphql-boolean-value": { "match": "\\s*\\b(true|false)\\b", "captures": { - "1": { "name": "constant.language.boolean.graphql" } + "1": {"name": "constant.language.boolean.graphql"} } }, "graphql-null-value": { "match": "\\s*\\b(null)\\b", "captures": { - "1": { "name": "constant.language.null.graphql" } + "1": {"name": "constant.language.null.graphql"} } }, "graphql-string-value": { @@ -580,17 +580,17 @@ "begin": "\\s*+((\"))", "end": "\\s*+(?:((\"))|(\n))", "beginCaptures": { - "1": { "name": "string.quoted.double.graphql" }, - "2": { "name": "punctuation.definition.string.begin.graphql" } + "1": {"name": "string.quoted.double.graphql"}, + "2": {"name": "punctuation.definition.string.begin.graphql"} }, "endCaptures": { - "1": { "name": "string.quoted.double.graphql" }, - "2": { "name": "punctuation.definition.string.end.graphql" }, - "3": { "name": "invalid.illegal.newline.graphql" } + "1": {"name": "string.quoted.double.graphql"}, + "2": {"name": "punctuation.definition.string.end.graphql"}, + "3": {"name": "invalid.illegal.newline.graphql"} }, "patterns": [ - { "include": "#graphql-string-content" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-string-content"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-string-content": { @@ -610,8 +610,8 @@ "begin": "\\s*+\\b(enum)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "end": "(?<=})", "beginCaptures": { - "1": { "name": "keyword.enum.graphql" }, - "2": { "name": "support.type.enum.graphql" } + "1": {"name": "keyword.enum.graphql"}, + "2": {"name": "support.type.enum.graphql"} }, "patterns": [ { @@ -619,26 +619,26 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": {"name": "punctuation.operation.graphql"} }, "patterns": [ - { "include": "#graphql-object-type" }, + {"include": "#graphql-object-type"}, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-enum-value" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"}, + {"include": "#graphql-enum-value"}, + {"include": "#literal-quasi-embedded"} ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-directive"} ] }, "graphql-enum-value": { @@ -647,17 +647,17 @@ }, "graphql-value": { "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-variable-name" }, - { "include": "#graphql-float-value" }, - { "include": "#graphql-string-value" }, - { "include": "#graphql-boolean-value" }, - { "include": "#graphql-null-value" }, - { "include": "#graphql-enum-value" }, - { "include": "#graphql-list-value" }, - { "include": "#graphql-object-value" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-variable-name"}, + {"include": "#graphql-float-value"}, + {"include": "#graphql-string-value"}, + {"include": "#graphql-boolean-value"}, + {"include": "#graphql-null-value"}, + {"include": "#graphql-enum-value"}, + {"include": "#graphql-list-value"}, + {"include": "#graphql-object-value"}, + {"include": "#literal-quasi-embedded"} ] }, "graphql-list-value": { @@ -667,12 +667,12 @@ "begin": "\\s*+(\\[)", "end": "\\s*(\\])", "endCaptures": { - "1": { "name": "meta.brace.square.graphql" } + "1": {"name": "meta.brace.square.graphql"} }, "beginCaptures": { - "1": { "name": "meta.brace.square.graphql" } + "1": {"name": "meta.brace.square.graphql"} }, - "patterns": [{ "include": "#graphql-value" }] + "patterns": [{"include": "#graphql-value"}] } ] }, @@ -683,14 +683,14 @@ "begin": "\\s*+({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "meta.brace.curly.graphql" } + "1": {"name": "meta.brace.curly.graphql"} }, "endCaptures": { - "1": { "name": "meta.brace.curly.graphql" } + "1": {"name": "meta.brace.curly.graphql"} }, "patterns": [ - { "include": "#graphql-object-field" }, - { "include": "#graphql-value" } + {"include": "#graphql-object-field"}, + {"include": "#graphql-value"} ] } ] @@ -698,9 +698,9 @@ "graphql-object-field": { "match": "\\s*(([_A-Za-z][_0-9A-Za-z]*))\\s*(:)", "captures": { - "1": { "name": "constant.object.key.graphql" }, - "2": { "name": "string.unquoted.graphql" }, - "3": { "name": "punctuation.graphql" } + "1": {"name": "constant.object.key.graphql"}, + "2": {"name": "string.unquoted.graphql"}, + "3": {"name": "punctuation.graphql"} } }, "graphql-union": { @@ -708,8 +708,8 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.union.graphql" }, - "2": { "name": "support.type.graphql" } + "1": {"name": "keyword.union.graphql"}, + "2": {"name": "support.type.graphql"} }, "patterns": [ { @@ -717,29 +717,29 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "punctuation.assignment.graphql" }, - "2": { "name": "support.type.graphql" } + "1": {"name": "punctuation.assignment.graphql"}, + "2": {"name": "support.type.graphql"} }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" }, + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-skip-newlines"}, + {"include": "#literal-quasi-embedded"}, { "match": "\\s*(\\|)\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "punctuation.or.graphql" }, - "2": { "name": "support.type.graphql" } + "1": {"name": "punctuation.or.graphql"}, + "2": {"name": "support.type.graphql"} } } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + {"include": "#graphql-comment"}, + {"include": "#graphql-description-docstring"}, + {"include": "#graphql-description-singleline"}, + {"include": "#graphql-skip-newlines"}, + {"include": "#literal-quasi-embedded"} ] }, "native-interpolation": { @@ -747,16 +747,16 @@ "begin": "\\s*(\\${)", "end": "(})", "beginCaptures": { - "1": { "name": "keyword.other.substitution.begin" } + "1": {"name": "keyword.other.substitution.begin"} }, "endCaptures": { - "1": { "name": "keyword.other.substitution.end" } + "1": {"name": "keyword.other.substitution.end"} }, "patterns": [ - { "include": "source.js" }, - { "include": "source.ts" }, - { "include": "source.js.jsx" }, - { "include": "source.tsx" } + {"include": "source.js"}, + {"include": "source.ts"}, + {"include": "source.js.jsx"}, + {"include": "source.tsx"} ] }, "graphql-skip-newlines": { diff --git a/vscode-extension/language/language-configuration.json b/vscode-extension/language/language-configuration.json index f724497b5745a..4297e38de1ffa 100644 --- a/vscode-extension/language/language-configuration.json +++ b/vscode-extension/language/language-configuration.json @@ -12,7 +12,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - { "open": "\"", "close": "\"", "notIn": ["string", "comment"] }, + {"open": "\"", "close": "\"", "notIn": ["string", "comment"]}, ["'", "'"] ], "surroundingPairs": [ diff --git a/vscode-extension/package.json b/vscode-extension/package.json index 445fbafdec68d..e478c5ffcdf6c 100644 --- a/vscode-extension/package.json +++ b/vscode-extension/package.json @@ -137,10 +137,8 @@ "arrowParens": "avoid", "bracketSameLine": true, "bracketSpacing": false, - "requirePragma": true, "singleQuote": true, - "trailingComma": "all", - "parser": "flow" + "trailingComma": "all" }, "scripts": { "typecheck": "tsc --noEmit", diff --git a/vscode-extension/src/commands/register.ts b/vscode-extension/src/commands/register.ts index 05ab4a0d37c92..e344826c8317a 100644 --- a/vscode-extension/src/commands/register.ts +++ b/vscode-extension/src/commands/register.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import { commands } from 'vscode'; -import { RelayExtensionContext } from '../context'; -import { handleRestartLanguageServerCommand } from './restart'; -import { handleShowOutputCommand } from './showOutput'; -import { handleStartCompilerCommand } from './startCompiler'; -import { handleStopCompilerCommand } from './stopCompiler'; +import {commands} from 'vscode'; +import {RelayExtensionContext} from '../context'; +import {handleRestartLanguageServerCommand} from './restart'; +import {handleShowOutputCommand} from './showOutput'; +import {handleStartCompilerCommand} from './startCompiler'; +import {handleStopCompilerCommand} from './stopCompiler'; export function registerCommands(context: RelayExtensionContext) { context.extensionContext.subscriptions.push( diff --git a/vscode-extension/src/commands/restart.ts b/vscode-extension/src/commands/restart.ts index eb6c9e444a237..a1642d60ff490 100644 --- a/vscode-extension/src/commands/restart.ts +++ b/vscode-extension/src/commands/restart.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { createAndStartCompiler, killCompiler } from '../compiler'; -import { getConfig } from '../config'; -import { RelayExtensionContext } from '../context'; +import {createAndStartCompiler, killCompiler} from '../compiler'; +import {getConfig} from '../config'; +import {RelayExtensionContext} from '../context'; import { createAndStartLanguageClient, killLanguageClient, @@ -28,7 +28,7 @@ export function handleRestartLanguageServerCommand( createAndStartCompiler(context); } - killLanguageClient(context).then((languageClientKilledSuccessfully) => { + killLanguageClient(context).then(languageClientKilledSuccessfully => { if (languageClientKilledSuccessfully) { createAndStartLanguageClient(context); } diff --git a/vscode-extension/src/commands/showOutput.ts b/vscode-extension/src/commands/showOutput.ts index 8a4d551200d81..2a3158d8654b5 100644 --- a/vscode-extension/src/commands/showOutput.ts +++ b/vscode-extension/src/commands/showOutput.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import { RelayExtensionContext } from '../context'; +import {RelayExtensionContext} from '../context'; export function handleShowOutputCommand(context: RelayExtensionContext): void { context.primaryOutputChannel.show(); diff --git a/vscode-extension/src/commands/startCompiler.ts b/vscode-extension/src/commands/startCompiler.ts index 45b7eb1a6d895..e046e8fff328a 100644 --- a/vscode-extension/src/commands/startCompiler.ts +++ b/vscode-extension/src/commands/startCompiler.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { window } from 'vscode'; -import { RelayExtensionContext } from '../context'; -import { createAndStartCompiler } from '../compiler'; +import {window} from 'vscode'; +import {RelayExtensionContext} from '../context'; +import {createAndStartCompiler} from '../compiler'; export function handleStartCompilerCommand( context: RelayExtensionContext, diff --git a/vscode-extension/src/commands/stopCompiler.ts b/vscode-extension/src/commands/stopCompiler.ts index 8dffdc4508ba2..a78784137fb87 100644 --- a/vscode-extension/src/commands/stopCompiler.ts +++ b/vscode-extension/src/commands/stopCompiler.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { window } from 'vscode'; -import { RelayExtensionContext } from '../context'; -import { killCompiler } from '../compiler'; +import {window} from 'vscode'; +import {RelayExtensionContext} from '../context'; +import {killCompiler} from '../compiler'; export function handleStopCompilerCommand( context: RelayExtensionContext, diff --git a/vscode-extension/src/compiler.ts b/vscode-extension/src/compiler.ts index 711dc3a62257b..a8bc7b4fa14f3 100644 --- a/vscode-extension/src/compiler.ts +++ b/vscode-extension/src/compiler.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { window } from 'vscode'; -import { RelayExtensionContext } from './context'; -import { getConfig } from './config'; +import {window} from 'vscode'; +import {RelayExtensionContext} from './context'; +import {getConfig} from './config'; export function createAndStartCompiler(context: RelayExtensionContext) { if (context.compilerTerminal) { diff --git a/vscode-extension/src/config.ts b/vscode-extension/src/config.ts index 24b47cfb6bf10..9097f315961d0 100644 --- a/vscode-extension/src/config.ts +++ b/vscode-extension/src/config.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import { ConfigurationScope, workspace } from 'vscode'; +import {ConfigurationScope, workspace} from 'vscode'; export type Config = { rootDirectory: string | null; diff --git a/vscode-extension/src/context.ts b/vscode-extension/src/context.ts index 405ae97aae367..219048e3feaff 100644 --- a/vscode-extension/src/context.ts +++ b/vscode-extension/src/context.ts @@ -5,13 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import { - ExtensionContext, - OutputChannel, - StatusBarItem, - Terminal, -} from 'vscode'; -import { LanguageClient } from 'vscode-languageclient/node'; +import {ExtensionContext, OutputChannel, StatusBarItem, Terminal} from 'vscode'; +import {LanguageClient} from 'vscode-languageclient/node'; // Mutable object to pass around to command handlers so they // can reference the current state of the extension diff --git a/vscode-extension/src/errorHandler.ts b/vscode-extension/src/errorHandler.ts index b212088157a74..b99a4598ebc08 100644 --- a/vscode-extension/src/errorHandler.ts +++ b/vscode-extension/src/errorHandler.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { window } from 'vscode'; -import { CloseAction, ErrorAction, ErrorHandler } from 'vscode-languageclient'; -import { RelayExtensionContext } from './context'; +import {window} from 'vscode'; +import {CloseAction, ErrorAction, ErrorHandler} from 'vscode-languageclient'; +import {RelayExtensionContext} from './context'; export function createErrorHandler( context: RelayExtensionContext, @@ -35,7 +35,7 @@ export function createErrorHandler( 'Go to output', 'Ignore', ) - .then((selected) => { + .then(selected => { if (selected === 'Go to output') { context.primaryOutputChannel.show(); } @@ -51,7 +51,7 @@ export function createErrorHandler( 'Go to output', 'Ignore', ) - .then((selected) => { + .then(selected => { if (selected === 'Go to output') { context.primaryOutputChannel.show(); } diff --git a/vscode-extension/src/extension.ts b/vscode-extension/src/extension.ts index f798f451b0b15..adc0d42df79b2 100644 --- a/vscode-extension/src/extension.ts +++ b/vscode-extension/src/extension.ts @@ -6,15 +6,15 @@ */ import path = require('path'); -import { ExtensionContext, window, workspace } from 'vscode'; -import { registerCommands } from './commands/register'; -import { createAndStartCompiler } from './compiler'; -import { getConfig } from './config'; - -import { RelayExtensionContext } from './context'; -import { createAndStartLanguageClient } from './languageClient'; -import { createStatusBarItem, intializeStatusBarItem } from './statusBarItem'; -import { findRelayBinaryWithWarnings } from './utils/findRelayBinary'; +import {ExtensionContext, window, workspace} from 'vscode'; +import {registerCommands} from './commands/register'; +import {createAndStartCompiler} from './compiler'; +import {getConfig} from './config'; + +import {RelayExtensionContext} from './context'; +import {createAndStartLanguageClient} from './languageClient'; +import {createStatusBarItem, intializeStatusBarItem} from './statusBarItem'; +import {findRelayBinaryWithWarnings} from './utils/findRelayBinary'; let relayExtensionContext: RelayExtensionContext | null = null; diff --git a/vscode-extension/src/languageClient.ts b/vscode-extension/src/languageClient.ts index 0aa1d3770375b..99e27ee1f545b 100644 --- a/vscode-extension/src/languageClient.ts +++ b/vscode-extension/src/languageClient.ts @@ -9,13 +9,13 @@ import { LanguageClientOptions, RevealOutputChannelOn, } from 'vscode-languageclient'; -import { ServerOptions, LanguageClient } from 'vscode-languageclient/node'; -import { window } from 'vscode'; +import {ServerOptions, LanguageClient} from 'vscode-languageclient/node'; +import {window} from 'vscode'; import * as path from 'path'; -import { RelayExtensionContext } from './context'; -import { createErrorHandler } from './errorHandler'; -import { LSPStatusBarFeature } from './lspStatusBarFeature'; -import { getConfig } from './config'; +import {RelayExtensionContext} from './context'; +import {createErrorHandler} from './errorHandler'; +import {LSPStatusBarFeature} from './lspStatusBarFeature'; +import {getConfig} from './config'; export function createAndStartLanguageClient(context: RelayExtensionContext) { const config = getConfig(); @@ -47,10 +47,10 @@ export function createAndStartLanguageClient(context: RelayExtensionContext) { isTrusted: true, }, documentSelector: [ - { scheme: 'file', language: 'javascript' }, - { scheme: 'file', language: 'typescript' }, - { scheme: 'file', language: 'typescriptreact' }, - { scheme: 'file', language: 'javascriptreact' }, + {scheme: 'file', language: 'javascript'}, + {scheme: 'file', language: 'typescript'}, + {scheme: 'file', language: 'typescriptreact'}, + {scheme: 'file', language: 'javascriptreact'}, ], outputChannel: context.lspOutputChannel, @@ -59,7 +59,7 @@ export function createAndStartLanguageClient(context: RelayExtensionContext) { // in VSCode shows up a lot. This tells vscode not to show it in any case. revealOutputChannelOn: RevealOutputChannelOn.Never, - initializationFailedHandler: (error) => { + initializationFailedHandler: error => { context?.primaryOutputChannel.appendLine( `initializationFailedHandler ${error}`, ); diff --git a/vscode-extension/src/lspStatusBarFeature.ts b/vscode-extension/src/lspStatusBarFeature.ts index 7b0a9ed8b6f08..362f9544a0598 100644 --- a/vscode-extension/src/lspStatusBarFeature.ts +++ b/vscode-extension/src/lspStatusBarFeature.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import { Disposable } from 'vscode'; +import {Disposable} from 'vscode'; import { StaticFeature, InitializeParams, RequestType, } from 'vscode-languageclient'; -import { RelayExtensionContext } from './context'; +import {RelayExtensionContext} from './context'; // the following type definitions are one to one mappings of the types defined // by the lsp_types package in this rust crate. @@ -141,7 +141,7 @@ export class LSPStatusBarFeature implements StaticFeature { initialize(): void { this.disposable = this.context.client?.onRequest( new RequestType('window/showStatus'), - (params) => { + params => { handleShowStatusMethod(this.context, params); }, ); diff --git a/vscode-extension/src/statusBarItem.ts b/vscode-extension/src/statusBarItem.ts index 14b3f7f280e74..963cc522688b4 100644 --- a/vscode-extension/src/statusBarItem.ts +++ b/vscode-extension/src/statusBarItem.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { StatusBarAlignment, StatusBarItem, window } from 'vscode'; +import {StatusBarAlignment, StatusBarItem, window} from 'vscode'; -import { RelayExtensionContext } from './context'; +import {RelayExtensionContext} from './context'; const SHOW_OUTPUT_COMMAND = 'relay.showOutput'; diff --git a/vscode-extension/src/utils/findRelayBinary.ts b/vscode-extension/src/utils/findRelayBinary.ts index ee516fb0f1d35..d811eb61c1ffd 100644 --- a/vscode-extension/src/utils/findRelayBinary.ts +++ b/vscode-extension/src/utils/findRelayBinary.ts @@ -8,9 +8,9 @@ import * as path from 'path'; import * as fs from 'fs/promises'; import * as semver from 'semver'; -import { OutputChannel, window, workspace } from 'vscode'; -import { SEMVER_RANGE } from '../constants'; -import { getConfig } from '../config'; +import {OutputChannel, window, workspace} from 'vscode'; +import {SEMVER_RANGE} from '../constants'; +import {getConfig} from '../config'; async function exists(file: string): Promise { return fs @@ -86,10 +86,10 @@ async function findRelayCompilerDirectory( } type RelayCompilerPackageInformation = - | { kind: 'compilerFound'; path: string } - | { kind: 'prereleaseCompilerFound'; path: string } - | { kind: 'architectureNotSupported' } - | { kind: 'packageNotFound' } + | {kind: 'compilerFound'; path: string} + | {kind: 'prereleaseCompilerFound'; path: string} + | {kind: 'architectureNotSupported'} + | {kind: 'packageNotFound'} | { kind: 'versionDidNotMatch'; path: string; @@ -103,13 +103,13 @@ async function findRelayCompilerBinary( const relayCompilerDirectory = await findRelayCompilerDirectory(rootPath); if (!relayCompilerDirectory) { - return { kind: 'packageNotFound' }; + return {kind: 'packageNotFound'}; } const relayBinaryRelativeToPackage = getBinaryPathRelativeToPackage(); if (!relayBinaryRelativeToPackage) { - return { kind: 'architectureNotSupported' }; + return {kind: 'architectureNotSupported'}; } const packageManifest = JSON.parse(