diff --git a/package.json b/package.json index 9de67e5f3..c4c9f67e9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dependencies": { "@angular/compiler": "12.2.15", "@babel/code-frame": "7.16.7", - "@babel/parser": "7.16.8", + "@babel/parser": "7.16.12", "@glimmer/syntax": "0.83.1", "@iarna/toml": "2.2.5", "@typescript-eslint/typescript-estree": "5.10.0", diff --git a/tests/format/js/in/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/in/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..ca4e4ca0c --- /dev/null +++ b/tests/format/js/in/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`arrow-function.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +const x = () => [].includes(true) || "ontouchend" in document + +const y = () => [] in x + +=====================================output===================================== +const x = () => [].includes(true) || "ontouchend" in document; + +const y = () => [] in x; + +================================================================================ +`; + +exports[`arrow-function-invalid.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +() => [] in x + +=====================================output===================================== +() => [] in x; + +================================================================================ +`; diff --git a/tests/format/js/in/arrow-function-invalid.js b/tests/format/js/in/arrow-function-invalid.js new file mode 100644 index 000000000..bb4eca799 --- /dev/null +++ b/tests/format/js/in/arrow-function-invalid.js @@ -0,0 +1 @@ +() => [] in x diff --git a/tests/format/js/in/arrow-function.js b/tests/format/js/in/arrow-function.js new file mode 100644 index 000000000..7ba44a835 --- /dev/null +++ b/tests/format/js/in/arrow-function.js @@ -0,0 +1,3 @@ +const x = () => [].includes(true) || "ontouchend" in document + +const y = () => [] in x diff --git a/tests/format/js/in/jsfmt.spec.js b/tests/format/js/in/jsfmt.spec.js new file mode 100644 index 000000000..270de08db --- /dev/null +++ b/tests/format/js/in/jsfmt.spec.js @@ -0,0 +1,3 @@ +run_spec(__dirname, ["babel", "flow", "typescript"], { + errors: ["arrow-function-invalid.js"], +}); diff --git a/yarn.lock b/yarn.lock index 441289616..c97eb63fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -301,12 +301,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@7.16.8": - version "7.16.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.8.tgz#61c243a3875f7d0b0962b0543a33ece6ff2f1f17" - integrity sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw== - -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.10", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7", "@babel/parser@^7.7.2": +"@babel/parser@7.16.12", "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.10", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7", "@babel/parser@^7.7.2": version "7.16.12" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" integrity sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==