diff --git a/package.json b/package.json index 2c34f91af..f56d08658 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "fast-glob": "3.2.5", "fast-json-stable-stringify": "2.1.0", "find-parent-dir": "0.3.0", - "flow-parser": "0.144.0", + "flow-parser": "0.145.0", "get-stdin": "8.0.0", "globby": "11.0.2", "graphql": "15.5.0", diff --git a/src/language-js/parser-flow.js b/src/language-js/parser-flow.js index 901f1b52e..91662089e 100644 --- a/src/language-js/parser-flow.js +++ b/src/language-js/parser-flow.js @@ -4,14 +4,31 @@ const createError = require("../common/parser-create-error"); const postprocess = require("./parse-postprocess"); const createParser = require("./parser/create-parser"); +// https://github.com/facebook/flow/tree/master/packages/flow-parser#options const parseOptions = { + // `all_comments` (boolean, default `true`) - include a list of all comments from the whole program + // all_comments: true, + // `comments` (boolean, default `true`) - attach comments to AST nodes (`leadingComments` and `trailingComments`) + comments: false, + // `enums` (boolean, default `false`) - enable parsing of Flow enums enums: true, - esproposal_decorators: true, + // `esproposal_class_instance_fields` (boolean, default `false`) - enable parsing of class instance fields esproposal_class_instance_fields: true, + // `esproposal_class_static_fields` (boolean, default `false`) - enable parsing of class static fields esproposal_class_static_fields: true, + // `esproposal_decorators` (boolean, default `false`) - enable parsing of decorators + esproposal_decorators: true, + // `esproposal_export_star_as` (boolean, default `false`) - enable parsing of `export * as` syntax esproposal_export_star_as: true, - esproposal_optional_chaining: true, + // `esproposal_nullish_coalescing` (boolean, default `false`) - enable parsing of nullish coalescing (`??`) esproposal_nullish_coalescing: true, + // `esproposal_optional_chaining` (boolean, default `false`) - enable parsing of optional chaining (`?.`) + esproposal_optional_chaining: true, + // `types` (boolean, default `true`) - enable parsing of Flow types + // types: true, + // `use_strict` (boolean, default `false`) - treat the file as strict, without needing a "use strict" directive + // use_strict: false, + // Not documented tokens: true, }; diff --git a/yarn.lock b/yarn.lock index 403573d36..8f252a5ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3502,10 +3502,10 @@ flatten@^1.0.2: resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b" integrity sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg== -flow-parser@0.144.0: - version "0.144.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.144.0.tgz#c9e9da22acc065102788112870f099845d0dfcdc" - integrity sha512-si2lCamPs0N1QcTiQY8p9RxvVsVGbx4rpkX6dcfUQ2OOvEg6Cya7LItlPqcx54Gtakdx1St6TseQlV8nafYW5g== +flow-parser@0.145.0: + version "0.145.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.145.0.tgz#e39af5f3470211cf21a50eb589da4d5cc5f71f39" + integrity sha512-dqpYiE0rZopmex5FR6pi/HTia8i+q/euc9WUWH6fTLt6sQgXjnAcsOwgMMLHCxwCSqPrvi/XFmBiicKitLNrKA== for-in@^1.0.2: version "1.0.2"