From 79487987ec2b70842a9d8e6007b34b71bd33df1d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Jan 2021 04:47:20 +0000
Subject: [PATCH 001/237] Build(deps-dev): Bump webpack-cli from 4.3.1 to 4.4.0
in /website (#10090)
---
website/package.json | 2 +-
website/yarn.lock | 58 ++++++++++++++++++++++++++++++++------------
2 files changed, 44 insertions(+), 16 deletions(-)
diff --git a/website/package.json b/website/package.json
index 40a2107ad..964cb66b0 100644
--- a/website/package.json
+++ b/website/package.json
@@ -24,6 +24,6 @@
"js-yaml": "4.0.0",
"svgo": "1.3.2",
"webpack": "5.17.0",
- "webpack-cli": "4.3.1"
+ "webpack-cli": "4.4.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index caafd986a..59b0662a1 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -1222,6 +1222,11 @@
"@webassemblyjs/ast" "1.11.0"
"@xtuc/long" "4.2.2"
+"@webpack-cli/configtest@^1.0.0":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.0.0.tgz#2aff5f1ebc6f793c13ba9b2a701d180eab17f5ee"
+ integrity sha512-Un0SdBoN1h4ACnIO7EiCjWuyhNI0Jl96JC+63q6xi4HDUYRZn8Auluea9D+v9NWKc5J4sICVEltdBaVjLX39xw==
+
"@webpack-cli/info@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.2.1.tgz#af98311f983d0b9fce7284cfcf1acaf1e9f4879c"
@@ -1229,10 +1234,10 @@
dependencies:
envinfo "^7.7.3"
-"@webpack-cli/serve@^1.2.1":
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.2.1.tgz#7513d7a769e3f97958de799b5b49874425ae3396"
- integrity sha512-Zj1z6AyS+vqV6Hfi7ngCjFGdHV5EwZNIHo6QfFTNe9PyW+zBU1zJ9BiOW1pmUEq950RC4+Dym6flyA/61/vhyw==
+"@webpack-cli/serve@^1.2.2":
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.2.2.tgz#1f8eee44f96524756268f5e3f43e9d943f864d41"
+ integrity sha512-03GkWxcgFfm8+WIwcsqJb9agrSDNDDoxaNnexPnCCexP5SCE4IgFd9lNpSy+K2nFqVMpgTFw6SwbmVAVTndVew==
"@xtuc/ieee754@^1.2.0":
version "1.2.0"
@@ -1989,6 +1994,15 @@ cliui@^5.0.0:
strip-ansi "^5.2.0"
wrap-ansi "^5.1.0"
+clone-deep@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387"
+ integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==
+ dependencies:
+ is-plain-object "^2.0.4"
+ kind-of "^6.0.2"
+ shallow-clone "^3.0.0"
+
clone-response@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b"
@@ -6520,6 +6534,13 @@ setprototypeof@1.1.1:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==
+shallow-clone@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3"
+ integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==
+ dependencies:
+ kind-of "^6.0.2"
+
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
@@ -7382,14 +7403,15 @@ webidl-conversions@^4.0.2:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
-webpack-cli@4.3.1:
- version "4.3.1"
- resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.3.1.tgz#87a7873bc9c6a4708aa657759274b691e72a04a8"
- integrity sha512-/F4+9QNZM/qKzzL9/06Am8NXIkGV+/NqQ62Dx7DSqudxxpAgBqYn6V7+zp+0Y7JuWksKUbczRY3wMTd+7Uj6OA==
+webpack-cli@4.4.0:
+ version "4.4.0"
+ resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.4.0.tgz#38c7fa01ea31510f5c490245dd1bb28018792f1b"
+ integrity sha512-/Qh07CXfXEkMu5S8wEpjuaw2Zj/CC0hf/qbTDp6N8N7JjdGuaOjZ7kttz+zhuJO/J5m7alQEhNk9lsc4rC6xgQ==
dependencies:
"@discoveryjs/json-ext" "^0.5.0"
+ "@webpack-cli/configtest" "^1.0.0"
"@webpack-cli/info" "^1.2.1"
- "@webpack-cli/serve" "^1.2.1"
+ "@webpack-cli/serve" "^1.2.2"
colorette "^1.2.1"
commander "^6.2.0"
enquirer "^2.3.6"
@@ -7399,14 +7421,15 @@ webpack-cli@4.3.1:
interpret "^2.2.0"
rechoir "^0.7.0"
v8-compile-cache "^2.2.0"
- webpack-merge "^4.2.2"
+ webpack-merge "^5.7.3"
-webpack-merge@^4.2.2:
- version "4.2.2"
- resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.2.tgz#a27c52ea783d1398afd2087f547d7b9d2f43634d"
- integrity sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==
+webpack-merge@^5.7.3:
+ version "5.7.3"
+ resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.7.3.tgz#2a0754e1877a25a8bbab3d2475ca70a052708213"
+ integrity sha512-6/JUQv0ELQ1igjGDzHkXbVDRxkfA57Zw7PfiupdLFJYrgFqY5ZP8xxbpp2lU3EPwYx89ht5Z/aDkD40hFCm5AA==
dependencies:
- lodash "^4.17.15"
+ clone-deep "^4.0.1"
+ wildcard "^2.0.0"
webpack-sources@^2.1.1:
version "2.1.1"
@@ -7492,6 +7515,11 @@ wide-align@^1.1.0:
dependencies:
string-width "^1.0.2 || 2"
+wildcard@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec"
+ integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==
+
wordwrap@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
From fecc0c3b62fa85fadfcce2fee486199f4c4e843f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Jan 2021 06:05:43 +0000
Subject: [PATCH 002/237] Build(deps-dev): Bump cspell from 4.2.5 to 4.2.8
(#10130)
---
package.json | 2 +-
yarn.lock | 415 ++++++++++++++++++++++++++-------------------------
2 files changed, 211 insertions(+), 206 deletions(-)
diff --git a/package.json b/package.json
index 8ed634c75..4b86a5910 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,7 @@
"benchmark": "2.1.4",
"builtin-modules": "3.2.0",
"cross-env": "7.0.3",
- "cspell": "4.2.5",
+ "cspell": "4.2.8",
"eslint": "7.18.0",
"eslint-config-prettier": "7.2.0",
"eslint-formatter-friendly": "7.0.0",
diff --git a/yarn.lock b/yarn.lock
index 7c7e41cbe..f3ab08c39 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -871,170 +871,170 @@
exec-sh "^0.3.2"
minimist "^1.2.0"
-"@cspell/dict-aws@^1.0.12":
- version "1.0.12"
- resolved "https://registry.yarnpkg.com/@cspell/dict-aws/-/dict-aws-1.0.12.tgz#34fab54e0cc8ce0384c9e298fe584a3290d4eea2"
- integrity sha512-2jI3VCdizeFssndayOco36HiTnWVG6SYc49sMazSdu/hJwKdvoT/5CX5qXOG6I0hU+L0Q964pGjhk05NTFeG2g==
+"@cspell/dict-aws@^1.0.13":
+ version "1.0.13"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-aws/-/dict-aws-1.0.13.tgz#5961c9764a2f731e488debee1c70fd488ee59727"
+ integrity sha512-9rq8BS5p418THq12PIkLQmGhg4kQ8tMH8vyB7gTF2lOrA+xMwV5HjZAepoYiJCxDQI5GAQJZlAaBi5DRG3AN2A==
-"@cspell/dict-bash@^1.0.10":
+"@cspell/dict-bash@^1.0.11":
+ version "1.0.11"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-bash/-/dict-bash-1.0.11.tgz#5ba56250e467d2c2ed3f2795081f4934af0c9afc"
+ integrity sha512-DTOugbPacEFIav5s+VniByouu4apD1SKS5inwiBndw0TH3Pkm4MFTPUwfT1y7Ki4HEIyfRI2ughig2045SBqRw==
+
+"@cspell/dict-companies@^1.0.35":
+ version "1.0.35"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.35.tgz#3f244e005afa533cdec8896ceaf866c82d77251a"
+ integrity sha512-lFoXFqXgAUjj14t7VJm+D/j9jU9kn4Eud+Q2gVQTKs6+oMivJ0hROpqZv/CEYHlm/4MpP5Livp0z0E6ARCE0kQ==
+
+"@cspell/dict-cpp@^1.1.37":
+ version "1.1.37"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-cpp/-/dict-cpp-1.1.37.tgz#79b33a42ebc0d7bed19bd8d07559e95c8668a70a"
+ integrity sha512-1X48pxiOdAw5Q7zj0k8/L5B1YY2W0k4go4CB5rcsuGRzsWXsdnKXHQTeMTAw7epIe4lj+Ef9oWaU+ODQpDZOCQ==
+
+"@cspell/dict-cryptocurrencies@^1.0.10":
version "1.0.10"
- resolved "https://registry.yarnpkg.com/@cspell/dict-bash/-/dict-bash-1.0.10.tgz#223e0f676dbbf8f928bbf502ccf2166498edbb96"
- integrity sha512-xYEOfGeqJUvGr5EPggMA9b/LQt3bw7k29pXeLHbpOymbAmb1rYVg69oSItZDMXenqG/KjNdx885qKtJA3OlRkQ==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-cryptocurrencies/-/dict-cryptocurrencies-1.0.10.tgz#04426fdfee8752818b375686d34a154b2fb40c7d"
+ integrity sha512-47ABvDJOkaST/rXipNMfNvneHUzASvmL6K/CbOFpYKfsd0x23Jc9k1yaOC7JAm82XSC/8a7+3Yu+Fk2jVJNnsA==
-"@cspell/dict-companies@^1.0.34":
- version "1.0.34"
- resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.34.tgz#2ce261c9c8de1637a721828c18593268a6c24f1c"
- integrity sha512-zwCa+8Z/du3WOwH2pzEQynckIKMHi2ZoK+VYDRz2/+jatpueOYoPJRjMKpTAigQuOEXM7k5y5XR9piyrrteYWA==
+"@cspell/dict-csharp@^1.0.10":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-csharp/-/dict-csharp-1.0.10.tgz#3806ff6646764f720ac02a0eb65d6b97b99811fe"
+ integrity sha512-jAl4HeRTwbN2+tEqL8cjM7GLXSJr9Jde3k8CqfxKME7qwVRCoBW6RkhyDHfEyaQ1LomDhnr35uiHEVrw7xCHMw==
-"@cspell/dict-cpp@^1.1.36":
- version "1.1.36"
- resolved "https://registry.yarnpkg.com/@cspell/dict-cpp/-/dict-cpp-1.1.36.tgz#138e845074a5bb42a1d97da3eb3e531175005a1c"
- integrity sha512-c2jWVVPWTzEV+puML05NeZRk+loUve6uonLRrL1L6WhZDKNEE6HJCqTPw7E91xck75fl3UPhriYrVNOE5UAInQ==
+"@cspell/dict-css@^1.0.10":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-css/-/dict-css-1.0.10.tgz#80ef4e89ec83a8386a69d9770b76184a2c26370e"
+ integrity sha512-QQbh+GBAyTVU8Wlf1xZPxZQQ3uRzb1lYE5RjE7hnRTSc4HtWYcb2+6XpO51QDl/dRhCmP3vEHzFF/swzHRa5hw==
-"@cspell/dict-cryptocurrencies@^1.0.9":
- version "1.0.9"
- resolved "https://registry.yarnpkg.com/@cspell/dict-cryptocurrencies/-/dict-cryptocurrencies-1.0.9.tgz#babe24a0e11a04027829f08442547f3b68231cc5"
- integrity sha512-n7P4uIO3cykPFxST5DJFEpdgCg6HzmMuO+RBpIj9oW+urRHrg97LrIVrMa8Xqk2eJ1hnFWnWyUm8JA8g8ego0w==
+"@cspell/dict-django@^1.0.25":
+ version "1.0.25"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-django/-/dict-django-1.0.25.tgz#7f821e781b2ae35bc12491a663ca506185f6d008"
+ integrity sha512-kQfZhvjAodb5CNgryYoEKlUaHA+IVGhZIpON5ZJBuxrPUZ4SyklACPXKxDyXnKAibrERoi4zNL6pBbsljEL03w==
-"@cspell/dict-csharp@^1.0.9":
- version "1.0.9"
- resolved "https://registry.yarnpkg.com/@cspell/dict-csharp/-/dict-csharp-1.0.9.tgz#937a07ad265cd9deca2576f498def742bc1fff9f"
- integrity sha512-GHEOX40Bk4OeDL/RgW1MIrMH7S3oEnrjIpsh+cOTWBxsqj25LcOCF0pA7c9zsjbJy9xTMS2ZRL3iBVU8AaS6rg==
-
-"@cspell/dict-css@^1.0.9":
- version "1.0.9"
- resolved "https://registry.yarnpkg.com/@cspell/dict-css/-/dict-css-1.0.9.tgz#44a2e817768f0bf0ea1606a8a5d42b0dd6316c11"
- integrity sha512-S2mJEZRZ0oF+RqfbGNkmWIf/5uDUN6mIveUXRrOPatX42gTUiZZ0iIpdjadeW9Eg/M8f2u7LjKlqT6bZ39azjA==
-
-"@cspell/dict-django@^1.0.24":
+"@cspell/dict-dotnet@^1.0.24":
version "1.0.24"
- resolved "https://registry.yarnpkg.com/@cspell/dict-django/-/dict-django-1.0.24.tgz#7b9a9b23cfc7472677eca9bda6ad3515d7b218f6"
- integrity sha512-Fwx1XMVMhd2CL7aW0W8S8hDyMnsl6ipah3H1YIb/m+IemdISZYy1zk+EplXmQxuReausk7IRtQMXWvvtiEhWRQ==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-dotnet/-/dict-dotnet-1.0.24.tgz#432a1f3bf6920860de86a6e7101639c1b4e348be"
+ integrity sha512-TxmMSh2T7C+DzF0rGTwVWFGCwqiwqLpyKar37kJt62bhadbxFKv+XxkLjOLVmgoqhA17BXM813hIjjZrICj4jg==
-"@cspell/dict-dotnet@^1.0.23":
+"@cspell/dict-elixir@^1.0.23":
version "1.0.23"
- resolved "https://registry.yarnpkg.com/@cspell/dict-dotnet/-/dict-dotnet-1.0.23.tgz#0482a052e35d50430d8824d47812d1c07cbe3dfe"
- integrity sha512-st7Kbzf88L4ZWh4+5y2S66ub7D/VU+gS1m15avYu6qFGOMq/xxZViudHfv4rqPSoEo8aOwOYb7k7pFCH8D5yqA==
-
-"@cspell/dict-elixir@^1.0.22":
- version "1.0.22"
- resolved "https://registry.yarnpkg.com/@cspell/dict-elixir/-/dict-elixir-1.0.22.tgz#2fbf1bb5c3ac84793e3e403462592435519982a3"
- integrity sha512-Ik4UDk9o0LH3wVPyEFpT4syiZMWrkdPzKxQDKuQXhveHtayIQvTSQ3AeoNOSSu9w0EGYWyYY4ZNX6Cwbk2vxqg==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-elixir/-/dict-elixir-1.0.23.tgz#1d341626467a2ca109b72c5368645af1f12417a4"
+ integrity sha512-UKDgNSZ36o31IX4NjCF/lCuOAoLEEsjSB2KwMD2ucT66MSFEPLk1womGY+iWblISeeBmB9EehfL1hjgoRwGlUw==
"@cspell/dict-en-gb@^1.1.27":
version "1.1.27"
resolved "https://registry.yarnpkg.com/@cspell/dict-en-gb/-/dict-en-gb-1.1.27.tgz#5c567fcc0f737e9ac8dc8fa76eb39928a6a2b35b"
integrity sha512-0tY939q0vzmsUotKQe/i8mDGqiiw4V3Kv/nkTvxFfVQAd6JRfpWBKlMbVV5Oy37nQkQiwkDLY4v90AbyqOvG8Q==
-"@cspell/dict-en_us@^1.2.37":
- version "1.2.37"
- resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-1.2.37.tgz#3e45e4c43bd3cbacdddadec449e565eb0b51749c"
- integrity sha512-03QYjVBsjCYzDOkK0GKAF0YmshPwXp56efgN1uYd1BS5t5lMOFix/5hH8UYuBK2o2db0o/Kuw5GWMgKtBkO/5Q==
+"@cspell/dict-en_us@^1.2.39":
+ version "1.2.39"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-1.2.39.tgz#44e30abee9a20ec3cbddd2c91f21de7e3b4ca4ea"
+ integrity sha512-rMn5pIm3bl+t3Qxdf3WMkLZ2kzs/FDHSCDR9ha+JOtCJ1yrJTLdlZvokGDLwMScztbgooEvabsN8AUqPutOSog==
-"@cspell/dict-filetypes@^1.1.4":
- version "1.1.4"
- resolved "https://registry.yarnpkg.com/@cspell/dict-filetypes/-/dict-filetypes-1.1.4.tgz#ccfda35c3c52ce3a6493b31a7a9817de119ebb78"
- integrity sha512-X3+noNfQQr3u/oL/RkD3Vg+R+3H1lV+m8Kdn2nfCkkLaDen3/QQ8Z9NM7vbm1zwyTlIKGcM3u1IqKIwhAXQOqA==
+"@cspell/dict-filetypes@^1.1.5":
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-filetypes/-/dict-filetypes-1.1.5.tgz#d1024eb0ae3b316e3e9411e2f36e624844345563"
+ integrity sha512-yfkB37J+hL6W8qa4AknFp7u6CGECrw2ql2/y0lUKruLQYid0ApK+bH+ll+Sqgl2YS5QAOhclskc72aQHAcRJIQ==
-"@cspell/dict-fonts@^1.0.12":
+"@cspell/dict-fonts@^1.0.13":
+ version "1.0.14"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-fonts/-/dict-fonts-1.0.14.tgz#7b18129910d30bd23cd9187d0c0009dfc3fef4ba"
+ integrity sha512-VhIX+FVYAnqQrOuoFEtya6+H72J82cIicz9QddgknsTqZQ3dvgp6lmVnsQXPM3EnzA8n1peTGpLDwHzT7ociLA==
+
+"@cspell/dict-fullstack@^1.0.36":
+ version "1.0.36"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-1.0.36.tgz#47c9d1b515405751be40cc177608e1ea6d121c02"
+ integrity sha512-npScBMAoZsjVE5uC1I72vmM1FCYnqzHH1ujgiBkbKd6Dp73VZ1f6OtpSQgqq9/onb0mSmMVF2kw4gPj8BlwGHg==
+
+"@cspell/dict-golang@^1.1.24":
+ version "1.1.24"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-golang/-/dict-golang-1.1.24.tgz#3830812aec816eca46a6d793fcc7710c09d4f5b9"
+ integrity sha512-qq3Cjnx2U1jpeWAGJL1GL0ylEhUMqyaR36Xij6Y6Aq4bViCRp+HRRqk0x5/IHHbOrti45h3yy7ii1itRFo+Xkg==
+
+"@cspell/dict-haskell@^1.0.12":
version "1.0.12"
- resolved "https://registry.yarnpkg.com/@cspell/dict-fonts/-/dict-fonts-1.0.12.tgz#1a081bf5ec7bc1dbffa2f93fc01d60142097285e"
- integrity sha512-BVvU9YoXf7EhTk4m+oLWxkSAVDWS994q10YhsR5QNQ5SejuMsmBIyqph0hoBidXvhIE5B736zPLoMkqon7NNig==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-haskell/-/dict-haskell-1.0.12.tgz#cc6ec4d0466b029683e9f861dea3d0e95c514606"
+ integrity sha512-JrSSuV2oY8Z1/qYi8j1w5M3eokiFkcpRtCrxpKlHYFXFEvmqTH9D8qvzVbAkrQpefMppy8uIUzknSzhwAc/MQA==
-"@cspell/dict-fullstack@^1.0.35":
- version "1.0.35"
- resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-1.0.35.tgz#a6580fe86cf3bdcef9f650429a0e98e3c643979a"
- integrity sha512-gTnxIeZ9A3dW/qBCvl2ZuQqE+IeL5uOHmrTFw7tA+mLEgknNUwSdmoGu82pmH/sTbH223U07nSglNqhY0hH/Wg==
+"@cspell/dict-html-symbol-entities@^1.0.23":
+ version "1.0.23"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-1.0.23.tgz#0efbdbc7712c9fbe545e14acac637226ac948f2d"
+ integrity sha512-PV0UBgcBFbBLf/m1wfkVMM8w96kvfHoiCGLWO6BR3Q9v70IXoE4ae0+T+f0CkxcEkacMqEQk/I7vuE9MzrjaNw==
-"@cspell/dict-golang@^1.1.23":
- version "1.1.23"
- resolved "https://registry.yarnpkg.com/@cspell/dict-golang/-/dict-golang-1.1.23.tgz#724acc8cc8f2c212a77992c2f96849885fae98a4"
- integrity sha512-FE1IenW5vFLaRk4AFhVYRlWKQhqjFApQ76+2dDxJdDxLIWOC+EOJmIBP4asAD57NT/Dz7sKw4grtkLu4vB+s9Q==
+"@cspell/dict-html@^1.1.5":
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-html/-/dict-html-1.1.5.tgz#45e7a3e23c27f248b4fab962ce71efdc23a0d9fd"
+ integrity sha512-ecwFDcponQgLpC9VJK7SRAbLu3CAlw6KUSlLtVOiN3zxlh27MDCCMp9jCD4UImZGACe0YQ1Zj0DW7PjXkHuKHg==
-"@cspell/dict-haskell@^1.0.11":
- version "1.0.11"
- resolved "https://registry.yarnpkg.com/@cspell/dict-haskell/-/dict-haskell-1.0.11.tgz#b81553e4f34ae4276106028730cfc0e879cf3ec7"
- integrity sha512-sE0+Hnl+/iUc9rbHQHSZF9r0AP2SxnXRL7IbLDhy/zCrBMgvsYNOgRjC9tI0uxr5vRTEgBKumrUIduXiI0GICA==
-
-"@cspell/dict-html-symbol-entities@^1.0.22":
+"@cspell/dict-java@^1.0.22":
version "1.0.22"
- resolved "https://registry.yarnpkg.com/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-1.0.22.tgz#6eef114162d8d5a97b8aa04b08315ccab73c6a5f"
- integrity sha512-Ai4nho7DRRwsXeez0Lc8PPOoN5A060aAv0ICQmB4YjpA2YVvVTmz6/mI6JbTJFF3V+WKd7YK448PuccNlUgDcQ==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-java/-/dict-java-1.0.22.tgz#30e660803922755c314fb61e9c8cd58a1f4bd47e"
+ integrity sha512-CVAJ29dx1XwwutgsMgaj5eCl1Nc7X7qFhWL2KkAdu78A/NUIaS+1I9KS0hHhdZx/wLke9dH8TR7NyPQGpGxeAw==
-"@cspell/dict-html@^1.1.4":
- version "1.1.4"
- resolved "https://registry.yarnpkg.com/@cspell/dict-html/-/dict-html-1.1.4.tgz#0b61f731807bd268b2f116e5755b93bf8ee4774f"
- integrity sha512-torS96vNxwdwliAj77FGswqZlPZmTgZrtLu+5S1JRhGrNN2wVDRJvKG2KiiiFq4qP+xiRlWlpTybRGa6ldZkFQ==
+"@cspell/dict-latex@^1.0.23":
+ version "1.0.23"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-latex/-/dict-latex-1.0.23.tgz#bb216e676c66b931bdfd1c8cb93e9625b5b66d45"
+ integrity sha512-xn9VvX5+q9xxELiOl5o8W/0nKympOc9i6Bq6PqX3fxhVWV4xURT18sp14OI9dNXxOSm5TRzL96vgLYvK/FYQVw==
-"@cspell/dict-java@^1.0.21":
+"@cspell/dict-lorem-ipsum@^1.0.22":
+ version "1.0.22"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-lorem-ipsum/-/dict-lorem-ipsum-1.0.22.tgz#a89f53dadda7d5bfdb978ab61f19d74d2fb69eab"
+ integrity sha512-yqzspR+2ADeAGUxLTfZ4pXvPl7FmkENMRcGDECmddkOiuEwBCWMZdMP5fng9B0Q6j91hQ8w9CLvJKBz10TqNYg==
+
+"@cspell/dict-lua@^1.0.16":
+ version "1.0.16"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-lua/-/dict-lua-1.0.16.tgz#c0ca43628f8927fc10731fd27cd9ee0af651bf6a"
+ integrity sha512-YiHDt8kmHJ8nSBy0tHzaxiuitYp+oJ66ffCYuFWTNB3//Y0SI4OGHU3omLsQVeXIfCeVrO4DrVvRDoCls9B5zQ==
+
+"@cspell/dict-node@^1.0.10":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-node/-/dict-node-1.0.10.tgz#ed78fd80cb99087a817bc7773e64f1e8431171b5"
+ integrity sha512-MnLy0pOcd+Zo8+M8VmumrIQN5SuAduZZrYKHhvXfxdVfX5vl5BfD6Gl25hzH0DrlAVlJOWAnkMZZFMYh4nGWRA==
+
+"@cspell/dict-npm@^1.0.10":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-1.0.10.tgz#327ad3855effcfbf6d2dbb6f655ed29e729dd7a8"
+ integrity sha512-LxLjMOyELWtVBHpive60G3MJseid30M9GR5Vodo9cT6lqT1CkbdsNP9j3oTwVXHTMKB3I+IOHNapuFG1ILcEew==
+
+"@cspell/dict-php@^1.0.23":
+ version "1.0.23"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-php/-/dict-php-1.0.23.tgz#8ee85fec8416a88b71edb2a53e26a79f280c9fa7"
+ integrity sha512-rRLf/09rXDrzs0DJuNXNmFVTw2b2zLmZKNF4LIPrFHYHvdfsMvwVqxkr/SAyhF8C6zi5sW0XYC/J0S/3IE927w==
+
+"@cspell/dict-powershell@^1.0.14":
+ version "1.0.14"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-powershell/-/dict-powershell-1.0.14.tgz#f8998f2f413b3b94e69a512117de89552cfa1834"
+ integrity sha512-hisOXXi5PBXB5YKtrJQIis2FIRHgSW1U0/sd4yI36lzb3ZMEvGJwdAdyhXN3IGiqRUNxMzJiXAeXfhnia4xPtQ==
+
+"@cspell/dict-python@^1.0.32":
+ version "1.0.33"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-1.0.33.tgz#39ddf401f63ee9b0f95e606d70693e61976a073b"
+ integrity sha512-tRmE4TzHDFPs7sJ1a3XbfyFrvRHwefVz+z1wkm6tkXK9TPrCbIS+rV/T8xhj205q4lpZQ/TkNB3lT40eLB9O8A==
+
+"@cspell/dict-ruby@^1.0.12":
+ version "1.0.12"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-ruby/-/dict-ruby-1.0.12.tgz#85af4c0c7e0d03c39115d4a2d1944befe31e04f8"
+ integrity sha512-1qGZpVbfWfGLujKFyt2Nd9bc7rNXdkjYIRfpGmn/fwVDhWz/D4Q8GLMQPB2ixocSuF3pjfsRTh1D+rKK17WFjg==
+
+"@cspell/dict-rust@^1.0.22":
+ version "1.0.22"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-1.0.22.tgz#4558e528c1e1aa2b0f1677d5918fa822106013e5"
+ integrity sha512-7WOIzv0BPiU+MssZbbMk8K+HR/g9Bcvd0+jXJC3/AKT8L6l0Mx0Tr/oF7cJ4xvCYgA84nBz3PhMZkabGSz/Nkg==
+
+"@cspell/dict-scala@^1.0.21":
version "1.0.21"
- resolved "https://registry.yarnpkg.com/@cspell/dict-java/-/dict-java-1.0.21.tgz#6ef37ebf743e8070f3537b49b000e20c361bb714"
- integrity sha512-jgrJmwyOXixGbXjvIny/fptFrNzFvBnMkYKDWQYHsHK7zrv0+RFFmWIQLLBvtnnX98hT2dhGmoR/tiZnsa6Xvg==
+ resolved "https://registry.yarnpkg.com/@cspell/dict-scala/-/dict-scala-1.0.21.tgz#bfda392329061e2352fbcd33d228617742c93831"
+ integrity sha512-5V/R7PRbbminTpPS3ywgdAalI9BHzcEjEj9ug4kWYvBIGwSnS7T6QCFCiu+e9LvEGUqQC+NHgLY4zs1NaBj2vA==
-"@cspell/dict-latex@^1.0.22":
- version "1.0.22"
- resolved "https://registry.yarnpkg.com/@cspell/dict-latex/-/dict-latex-1.0.22.tgz#6989acbf1c043c6de247c42dde66a272f61acf50"
- integrity sha512-DlPbT1XE3gAla1ogIlG4BeYIT+ql2o5iYBqlj2iqhE8wyH54UGLKObmBx8K+tQqIKsQm5NfoNZ7uBcGXBwcQww==
+"@cspell/dict-software-terms@^1.0.24":
+ version "1.0.25"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.25.tgz#a42c488ebf0169727386b5ea7981ac2e40212014"
+ integrity sha512-GOHfmGT/X7QsKXFKS8riPVXI7jOTfcjSz/mzoUP8t1kOTkp+8qw+hxsQ31Z4Ctz5ZI7sh0xpFFYDNFFzG5XWgw==
-"@cspell/dict-lorem-ipsum@^1.0.21":
- version "1.0.21"
- resolved "https://registry.yarnpkg.com/@cspell/dict-lorem-ipsum/-/dict-lorem-ipsum-1.0.21.tgz#3ad60e3c82dfcfd7fc940568d46d560cd2faaed9"
- integrity sha512-1eXhTePkDpCYYmiwRFEECEjgOnvSMfEiGGd9Ku+P4p+mj2LmFdejfzWhyr9agrcbj9YD0OWwEBluiRg4QAs9kQ==
-
-"@cspell/dict-lua@^1.0.15":
- version "1.0.15"
- resolved "https://registry.yarnpkg.com/@cspell/dict-lua/-/dict-lua-1.0.15.tgz#d4830cb04510e2715cf1c8e3d811d40b428cec20"
- integrity sha512-/3L5oHxErLd4SPwgJ10SCBcidGP+obJ9V1QAhBF10ktAPD9b3larrXam01G2zn1H6lMJjuOm9Q4iJOV5rL3TsQ==
-
-"@cspell/dict-node@^1.0.8":
- version "1.0.8"
- resolved "https://registry.yarnpkg.com/@cspell/dict-node/-/dict-node-1.0.8.tgz#ff66cc2428906b4468133120edf043fa37a6097d"
- integrity sha512-3Pc2Np66BjaeNtcScrGjRTzyHe8UuFFrZGStzo1zx89MnKx6gT3XagIwmLjm6kGzUbtoAnKY2U2FugIOSQ7dLA==
-
-"@cspell/dict-npm@^1.0.9":
- version "1.0.9"
- resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-1.0.9.tgz#d5b0b7b0f2a904ca49d1a48be91dfae148064b99"
- integrity sha512-LyV/uUV8TPq7JKXRvN4Bm/be9qgXbCL2oLdZ/D01dljsRBmlgg5hmDaa8SY+msitnTyJ1MKtEsQiwlH2CbGgow==
-
-"@cspell/dict-php@^1.0.22":
- version "1.0.22"
- resolved "https://registry.yarnpkg.com/@cspell/dict-php/-/dict-php-1.0.22.tgz#577eb43d2f3965b239ddee3d3b337e7cee0dc73c"
- integrity sha512-SWkz/3EB00irqRyF7UG7bgO2oh1K1JAhKB4BHfW7HKDec6Zb6IapNvvXaS5ham/oXqjy6IigDVoY7sgVRJ2sZg==
-
-"@cspell/dict-powershell@^1.0.13":
- version "1.0.13"
- resolved "https://registry.yarnpkg.com/@cspell/dict-powershell/-/dict-powershell-1.0.13.tgz#1815a54e1634722e6f7ce4a70e6d44db0455bf79"
- integrity sha512-6dOPZiKac4ycoFUtcw/zsLrlL2uoTorgKkX0wtRlBu3rnD6FiN/2UD9rfnl/tbd6dM0SvS2Adxb3HkV2teVGbQ==
-
-"@cspell/dict-python@^1.0.30":
- version "1.0.30"
- resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-1.0.30.tgz#31ba036ee3e9ca8686a282e9ff0662376f3c4a81"
- integrity sha512-9ej3jHJxcTpGl3fQMeInZ7m1zD8tEAJU81C7C9FfxsyO0t1eMNB+q/lU72p8lfuNHFSz2Kb8Q+swMw7j1guIUg==
-
-"@cspell/dict-ruby@^1.0.11":
- version "1.0.11"
- resolved "https://registry.yarnpkg.com/@cspell/dict-ruby/-/dict-ruby-1.0.11.tgz#c064a522cdc52b0bc78ee7d77951f32f259f8219"
- integrity sha512-n/KZqm68wOemeV1vp6340yIJDclXO/p8dFvDnjR8hUJP1l7p4p/QzY1K4HFDv/744V4sqTSF0dXJia8uXiuwBA==
-
-"@cspell/dict-rust@^1.0.21":
- version "1.0.21"
- resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-1.0.21.tgz#21e416270d10425255d87bc03237f1dd6fe11d2d"
- integrity sha512-13O1Gvfc9aSK+r5kRT+Bqe2+/QYQbM0yWsD4KV8pTG1xNxDQOzS02dzjbd4MpmCjzYFO1H+Zz//iZpX4vxnawA==
-
-"@cspell/dict-scala@^1.0.20":
- version "1.0.20"
- resolved "https://registry.yarnpkg.com/@cspell/dict-scala/-/dict-scala-1.0.20.tgz#3b81522df6d402b0d54b0a125a6570486fce0df5"
- integrity sha512-JkVCjsn3lUmh5EdeoKttedN2pCXvQJzz5jtbr5Hfer7oLC6flre58yPpaC1kyfOP1lCpg31FQSUnhlB6AyJNDQ==
-
-"@cspell/dict-software-terms@^1.0.22":
- version "1.0.22"
- resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.22.tgz#6caf5850a0451fb518b592f63f487305860f15b6"
- integrity sha512-mZgKYgL6EXXeEdzc+XlRNDdTmLAvl1L+muijAiwyRxfJnP5yznoxvyN0v51dTraRYA9xxoqKzNlT5gPQkLc7hQ==
-
-"@cspell/dict-typescript@^1.0.15":
- version "1.0.15"
- resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-1.0.15.tgz#97cd4357f5715b91178a93b6c1dcab5f6d0591ec"
- integrity sha512-Guh+nN57OqbcRNH6cfbBQKfeDp0i+GBlniYvhWvaRxkSdFQJi4YgFKvQJsvtwLkwmNqYkQIXQr+8zXhuvTHLhA==
+"@cspell/dict-typescript@^1.0.16":
+ version "1.0.16"
+ resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-1.0.16.tgz#18d20a91c4caf52540c795921a50b0e4ce3bc50c"
+ integrity sha512-DEKi6vD605ebDhCC4Hrtz29k59TcijPVsmVKheTpMrL1MD/S96Ftb19gW0pEIVK9vwYZIljmGwgz4qYyuM5Liw==
"@eslint/eslintrc@^0.3.0":
version "0.3.0"
@@ -2473,10 +2473,10 @@ commander@^2.19.0, commander@^2.20.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
-commander@^6.1.0:
- version "6.2.0"
- resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
- integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==
+commander@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2"
+ integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==
comment-json@^4.0.6, comment-json@^4.1.0:
version "4.1.0"
@@ -2604,79 +2604,79 @@ cspell-io@^4.1.7:
iconv-lite "^0.6.2"
iterable-to-stream "^1.0.1"
-cspell-lib@^4.3.9:
- version "4.3.9"
- resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-4.3.9.tgz#8b0731e9340ed213164cc725ea2203837cf34783"
- integrity sha512-vyyYq2sa91iDwyNt2qvxfLgG39RGJOcpDQbL6IKPoAsliCBSzVPq4U1e1I8kQRmEcbl7oM2+GeYth5E6YY1IVg==
+cspell-lib@^4.3.12:
+ version "4.3.12"
+ resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-4.3.12.tgz#9ba30591079562534ef47e5552b86cadaf7383d8"
+ integrity sha512-yCCb6MoW1K8Tsr/WVEQoO4dfYhH9bCsjQayccb8MlyDaNNuWJHuX+gUGHsZSXSuChSh8PrTWKXJzs13/uM977g==
dependencies:
- "@cspell/dict-aws" "^1.0.12"
- "@cspell/dict-bash" "^1.0.10"
- "@cspell/dict-companies" "^1.0.34"
- "@cspell/dict-cpp" "^1.1.36"
- "@cspell/dict-cryptocurrencies" "^1.0.9"
- "@cspell/dict-csharp" "^1.0.9"
- "@cspell/dict-css" "^1.0.9"
- "@cspell/dict-django" "^1.0.24"
- "@cspell/dict-dotnet" "^1.0.23"
- "@cspell/dict-elixir" "^1.0.22"
+ "@cspell/dict-aws" "^1.0.13"
+ "@cspell/dict-bash" "^1.0.11"
+ "@cspell/dict-companies" "^1.0.35"
+ "@cspell/dict-cpp" "^1.1.37"
+ "@cspell/dict-cryptocurrencies" "^1.0.10"
+ "@cspell/dict-csharp" "^1.0.10"
+ "@cspell/dict-css" "^1.0.10"
+ "@cspell/dict-django" "^1.0.25"
+ "@cspell/dict-dotnet" "^1.0.24"
+ "@cspell/dict-elixir" "^1.0.23"
"@cspell/dict-en-gb" "^1.1.27"
- "@cspell/dict-en_us" "^1.2.37"
- "@cspell/dict-filetypes" "^1.1.4"
- "@cspell/dict-fonts" "^1.0.12"
- "@cspell/dict-fullstack" "^1.0.35"
- "@cspell/dict-golang" "^1.1.23"
- "@cspell/dict-haskell" "^1.0.11"
- "@cspell/dict-html" "^1.1.4"
- "@cspell/dict-html-symbol-entities" "^1.0.22"
- "@cspell/dict-java" "^1.0.21"
- "@cspell/dict-latex" "^1.0.22"
- "@cspell/dict-lorem-ipsum" "^1.0.21"
- "@cspell/dict-lua" "^1.0.15"
- "@cspell/dict-node" "^1.0.8"
- "@cspell/dict-npm" "^1.0.9"
- "@cspell/dict-php" "^1.0.22"
- "@cspell/dict-powershell" "^1.0.13"
- "@cspell/dict-python" "^1.0.30"
- "@cspell/dict-ruby" "^1.0.11"
- "@cspell/dict-rust" "^1.0.21"
- "@cspell/dict-scala" "^1.0.20"
- "@cspell/dict-software-terms" "^1.0.22"
- "@cspell/dict-typescript" "^1.0.15"
+ "@cspell/dict-en_us" "^1.2.39"
+ "@cspell/dict-filetypes" "^1.1.5"
+ "@cspell/dict-fonts" "^1.0.13"
+ "@cspell/dict-fullstack" "^1.0.36"
+ "@cspell/dict-golang" "^1.1.24"
+ "@cspell/dict-haskell" "^1.0.12"
+ "@cspell/dict-html" "^1.1.5"
+ "@cspell/dict-html-symbol-entities" "^1.0.23"
+ "@cspell/dict-java" "^1.0.22"
+ "@cspell/dict-latex" "^1.0.23"
+ "@cspell/dict-lorem-ipsum" "^1.0.22"
+ "@cspell/dict-lua" "^1.0.16"
+ "@cspell/dict-node" "^1.0.10"
+ "@cspell/dict-npm" "^1.0.10"
+ "@cspell/dict-php" "^1.0.23"
+ "@cspell/dict-powershell" "^1.0.14"
+ "@cspell/dict-python" "^1.0.32"
+ "@cspell/dict-ruby" "^1.0.12"
+ "@cspell/dict-rust" "^1.0.22"
+ "@cspell/dict-scala" "^1.0.21"
+ "@cspell/dict-software-terms" "^1.0.24"
+ "@cspell/dict-typescript" "^1.0.16"
comment-json "^4.1.0"
configstore "^5.0.1"
cspell-io "^4.1.7"
- cspell-trie-lib "^4.2.7"
- cspell-util-bundle "^4.1.9"
- fs-extra "^9.0.1"
+ cspell-trie-lib "^4.2.8"
+ cspell-util-bundle "^4.1.11"
+ fs-extra "^9.1.0"
gensequence "^3.1.1"
minimatch "^3.0.4"
resolve-from "^5.0.0"
resolve-global "^1.0.0"
- vscode-uri "^2.1.2"
+ vscode-uri "^3.0.2"
-cspell-trie-lib@^4.2.7:
- version "4.2.7"
- resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-4.2.7.tgz#25d5e5931979dcfdc4cfd53785bc72a5a8084558"
- integrity sha512-Iwspbgqw4lv6L0kPMTl5423Kq9/zyfPLCc0gpl4vBNJ9skc7beuMmZoyvAF1IeGWl4li35AuaTfEy0uR+h88cQ==
+cspell-trie-lib@^4.2.8:
+ version "4.2.8"
+ resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-4.2.8.tgz#50d9841945274b7c879e2ebe3caa360828355bda"
+ integrity sha512-Nt3c0gxOYXIc3/yhALDukpje1BgR6guvlUKWQO2zb0r7qRWpwUw2j2YM4dWbHQeH/3Hx5ei4Braa6cMaiJ5YBw==
dependencies:
gensequence "^3.1.1"
-cspell-util-bundle@^4.1.9:
- version "4.1.9"
- resolved "https://registry.yarnpkg.com/cspell-util-bundle/-/cspell-util-bundle-4.1.9.tgz#7a92fcf427ec67601f96e4bb4e473557dae5d906"
- integrity sha512-ytYWn+EmSuthkh+GOKqLpBXsa5mnSBvOgl58IF04zB8LvjQpzRdo1FJkiQiy+HYPMl1xUmcLDqcAhvANzNGDMg==
+cspell-util-bundle@^4.1.11:
+ version "4.1.11"
+ resolved "https://registry.yarnpkg.com/cspell-util-bundle/-/cspell-util-bundle-4.1.11.tgz#96840af030dcac5baeb3480e249e7402413015d0"
+ integrity sha512-or3OGKydZs1NwweMIgnA48k8H3F5zK4e5lonjUhpEzLYQZ2nB23decdoqZ8ogFC8pFTA40tZKDsMJ0b+65gX4Q==
-cspell@4.2.5:
- version "4.2.5"
- resolved "https://registry.yarnpkg.com/cspell/-/cspell-4.2.5.tgz#6678d480b3f63501f0c9e75447011f5236e063ce"
- integrity sha512-JAlgs1I4hrqkfLdzkfCA9ynNr4EByauH57oGstIw1onsi25Htv7rzAz0E9rjXlARr3cD4lzoTSylrPI4dfmLmA==
+cspell@4.2.8:
+ version "4.2.8"
+ resolved "https://registry.yarnpkg.com/cspell/-/cspell-4.2.8.tgz#69b4c6f4c1b628f0b51d8618738d061e497d76d3"
+ integrity sha512-eqan8+lCU9bSp8Tl4+SR/ccBnuPyMmp7evck/RlMdFTjLh/s+3vQ5hQyBzbzK8w2MMqL84CymW7BwIOKjpylSg==
dependencies:
chalk "^4.1.0"
- commander "^6.1.0"
+ commander "^7.0.0"
comment-json "^4.0.6"
cspell-glob "^0.1.25"
- cspell-lib "^4.3.9"
- fs-extra "^9.0.1"
+ cspell-lib "^4.3.12"
+ fs-extra "^9.1.0"
gensequence "^3.1.1"
get-stdin "^8.0.0"
glob "^7.1.6"
@@ -3555,15 +3555,15 @@ fragment-cache@^0.2.1:
dependencies:
map-cache "^0.2.2"
-fs-extra@^9.0.1:
- version "9.0.1"
- resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc"
- integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==
+fs-extra@^9.1.0:
+ version "9.1.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
+ integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
- universalify "^1.0.0"
+ universalify "^2.0.0"
fs.realpath@^1.0.0:
version "1.0.0"
@@ -7189,6 +7189,11 @@ universalify@^1.0.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
+universalify@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
+ integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
+
unset-value@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559"
@@ -7293,10 +7298,10 @@ vnopts@1.0.2:
leven "^2.1.0"
tslib "^1.9.3"
-vscode-uri@^2.1.2:
- version "2.1.2"
- resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.2.tgz#c8d40de93eb57af31f3c715dd650e2ca2c096f1c"
- integrity sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==
+vscode-uri@^3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.2.tgz#ecfd1d066cb8ef4c3a208decdbab9a8c23d055d0"
+ integrity sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==
w3c-hr-time@^1.0.2:
version "1.0.2"
From 24433cbbf61986d08cdc4cebe268d3d25c5e395d Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Mon, 25 Jan 2021 10:07:06 +0200
Subject: [PATCH 003/237] Use fill to print number-only arrays (#10106)
---
changelog_unreleased/javascript/10106.md | 45 ++
src/language-js/print/array.js | 84 ++-
src/language-js/utils.js | 9 +
.../arrays/__snapshots__/jsfmt.spec.js.snap | 634 +++++++++++++++++-
tests/js/arrays/numbers-in-args.js | 13 +
tests/js/arrays/numbers-in-assignment.js | 15 +
.../numbers-negative-comment-after-minus.js | 11 +
tests/js/arrays/numbers-negative.js | 11 +
tests/js/arrays/numbers-trailing-comma.js | 4 +
tests/js/arrays/numbers-with-holes.js | 29 +
.../arrays/numbers-with-trailing-comments.js | 11 +
.../js/arrays/numbers-with-tricky-comments.js | 7 +
tests/js/arrays/numbers1.js | 102 +++
tests/js/arrays/numbers2.js | 49 ++
tests/js/arrays/numbers3.js | 16 +
.../json/__snapshots__/jsfmt.spec.js.snap | 24 +-
16 files changed, 1045 insertions(+), 19 deletions(-)
create mode 100644 changelog_unreleased/javascript/10106.md
create mode 100644 tests/js/arrays/numbers-in-args.js
create mode 100644 tests/js/arrays/numbers-in-assignment.js
create mode 100644 tests/js/arrays/numbers-negative-comment-after-minus.js
create mode 100644 tests/js/arrays/numbers-negative.js
create mode 100644 tests/js/arrays/numbers-trailing-comma.js
create mode 100644 tests/js/arrays/numbers-with-holes.js
create mode 100644 tests/js/arrays/numbers-with-trailing-comments.js
create mode 100644 tests/js/arrays/numbers-with-tricky-comments.js
create mode 100644 tests/js/arrays/numbers1.js
create mode 100644 tests/js/arrays/numbers2.js
create mode 100644 tests/js/arrays/numbers3.js
diff --git a/changelog_unreleased/javascript/10106.md b/changelog_unreleased/javascript/10106.md
new file mode 100644
index 000000000..63c2da6c5
--- /dev/null
+++ b/changelog_unreleased/javascript/10106.md
@@ -0,0 +1,45 @@
+#### Concise formatting of number-only arrays (#10106 by @thorn0)
+
+While in general, Prettier avoids this kind of formatting because it's not diff-friendly, in this special case we decided that the benefits outweigh the risks.
+
+If at least one element has a trailing single-line (`// ...`) comment on the same line, the concise formatting isn't applied. On the other hand, single-line comments placed on separate lines don't have such an effect and β as well as empty lines β can be used for logical grouping.
+
+
+```jsx
+// Input
+const lazyCatererNumbers = [1, 2, 4, 7, 11, 16, 22, 29, 37, 46,
+
+// n > 10
+56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, 352, 379, 407, 436, 466,
+497, 529, 562, 596, 631, 667, 704, 742, 781,
+// n > 40
+821, 862, 904, 947, 991, 1036, 1082, 1129, 1177, 1226, 1276, 1327, 1379];
+
+// Prettier stable
+const lazyCatererNumbers = [
+ 1,
+ 2,
+ 4,
+ 7,
+ 11,
+ 16,
+ 22,
+ 29,
+ 37,
+ // ... β a lot of lines β ...
+ 1379,
+];
+
+
+// Prettier main
+const lazyCatererNumbers = [
+ 1, 2, 4, 7, 11, 16, 22, 29, 37, 46,
+
+ // n > 10
+ 56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326,
+ 352, 379, 407, 436, 466, 497, 529, 562, 596, 631, 667, 704, 742, 781,
+ // n > 40
+ 821, 862, 904, 947, 991, 1036, 1082, 1129, 1177, 1226, 1276, 1327, 1379,
+];
+
+```
diff --git a/src/language-js/print/array.js b/src/language-js/print/array.js
index d8ad213da..d503caf56 100644
--- a/src/language-js/print/array.js
+++ b/src/language-js/print/array.js
@@ -2,15 +2,18 @@
const { printDanglingComments } = require("../../main/comments");
const {
- builders: { line, softline, group, indent, ifBreak },
+ builders: { line, softline, hardline, group, indent, ifBreak, fill },
} = require("../../document");
-const { getLast } = require("../../common/util");
+const { getLast, hasNewline } = require("../../common/util");
const {
shouldPrintComma,
hasComment,
CommentCheckFlags,
isNextLineEmpty,
+ isNumericLiteral,
+ isSignedNumericLiteral,
} = require("../utils");
+const { locStart } = require("../loc");
const { printOptionalToken, printTypeAnnotation } = require("./misc");
@@ -50,7 +53,17 @@ function printArray(path, options, print) {
//
// Note that getLast returns null if the array is empty, but
// we already check for an empty array just above so we are safe
- const needsForcedTrailingComma = canHaveTrailingComma && lastElem === null;
+ const needsForcedTrailingComma = lastElem === null;
+
+ const groupId = Symbol("array");
+
+ const trailingComma = !canHaveTrailingComma
+ ? ""
+ : needsForcedTrailingComma
+ ? ","
+ : !shouldPrintComma(options)
+ ? ""
+ : ifBreak(",", "", { groupId });
const shouldBreak =
!options.__inJestEach &&
@@ -75,24 +88,42 @@ function printArray(path, options, print) {
return element[itemsKey] && element[itemsKey].length > 1;
});
+ const shouldUseConciseFormatting =
+ n.elements.length > 1 &&
+ n.elements.every(
+ (element) =>
+ element &&
+ (isNumericLiteral(element) ||
+ (isSignedNumericLiteral(element) &&
+ !hasComment(element.argument))) &&
+ !hasComment(
+ element,
+ CommentCheckFlags.Trailing | CommentCheckFlags.Line,
+ (comment) =>
+ !hasNewline(options.originalText, locStart(comment), {
+ backwards: true,
+ })
+ )
+ );
+
parts.push(
group(
[
openBracket,
- indent([softline, printArrayItems(path, options, "elements", print)]),
- needsForcedTrailingComma ? "," : "",
- ifBreak(
- canHaveTrailingComma &&
- !needsForcedTrailingComma &&
- shouldPrintComma(options)
- ? ","
- : ""
- ),
- printDanglingComments(path, options, /* sameIndent */ true),
+ indent([
+ softline,
+ shouldUseConciseFormatting
+ ? printArrayItemsConcisely(path, options, print, trailingComma)
+ : [
+ printArrayItems(path, options, "elements", print),
+ trailingComma,
+ ],
+ printDanglingComments(path, options, /* sameIndent */ true),
+ ]),
softline,
closeBracket,
],
- { shouldBreak }
+ { shouldBreak, id: groupId }
)
);
}
@@ -124,4 +155,29 @@ function printArrayItems(path, options, printPath, print) {
return printedElements;
}
+function printArrayItemsConcisely(path, options, print, trailingComma) {
+ const parts = [];
+
+ path.each((childPath, i, elements) => {
+ const isLast = i === elements.length - 1;
+
+ parts.push([print(childPath), isLast ? trailingComma : ","]);
+
+ if (!isLast) {
+ parts.push(
+ isNextLineEmpty(childPath.getValue(), options)
+ ? [hardline, hardline]
+ : hasComment(
+ elements[i + 1],
+ CommentCheckFlags.Leading | CommentCheckFlags.Line
+ )
+ ? hardline
+ : line
+ );
+ }
+ }, "elements");
+
+ return fill(parts);
+}
+
module.exports = { printArray, printArrayItems };
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index 3bade04f2..56eceef21 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -247,6 +247,14 @@ function isNumericLiteral(node) {
);
}
+function isSignedNumericLiteral(node) {
+ return (
+ node.type === "UnaryExpression" &&
+ (node.operator === "+" || node.operator === "-") &&
+ isNumericLiteral(node.argument)
+ );
+}
+
/**
* @param {Node} node
* @returns {boolean}
@@ -1362,6 +1370,7 @@ module.exports = {
isMemberExpressionChain,
isMemberish,
isNumericLiteral,
+ isSignedNumericLiteral,
isObjectType,
isObjectTypePropertyAFunction,
isSimpleType,
diff --git a/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
index 9c807266f..9d428d70d 100644
--- a/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
@@ -165,6 +165,632 @@ printWidth: 80
================================================================================
`;
+exports[`numbers-in-args.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+expect(bifornCringerMoshedPerplexSawder.getArrayOfNumbers()).toEqual(
+ [1, 2, 3, 4, 5]
+);
+
+expect(bifornCringerMoshedPerplexSawder.getLongArrayOfNumbers()).toEqual(
+ [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+ ]
+);
+
+=====================================output=====================================
+expect(bifornCringerMoshedPerplexSawder.getArrayOfNumbers()).toEqual([
+ 1, 2, 3, 4, 5,
+]);
+
+expect(bifornCringerMoshedPerplexSawder.getLongArrayOfNumbers()).toEqual([
+ 66, 57, 45, 47, 33, 53, 82, 81, 76, 78, 10, 78, 15, 98, 24, 29, 32, 27, 28,
+ 76, 41, 65, 84, 35, 97, 90, 75, 24, 88, 45, 23, 75, 63, 86, 24, 39, 9, 51, 33,
+ 40, 58, 17, 49, 86, 63, 59, 97, 91, 98, 99, 5, 69, 51, 44, 34, 69, 17, 91, 27,
+ 83, 26, 34, 93, 29, 66, 88, 49, 33, 49, 73, 9, 81, 4, 36, 5, 14, 43, 31, 86,
+ 27, 39, 75, 98, 99, 55, 19, 39, 21, 85, 86, 46, 82, 11, 44, 48, 77, 35, 48,
+ 78, 97,
+]);
+
+================================================================================
+`;
+
+exports[`numbers-in-assignment.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5
+];
+
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers2 = [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+];
+
+=====================================output=====================================
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = [
+ 1, 2, 3, 4, 5,
+];
+
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers2 = [
+ 66, 57, 45, 47, 33, 53, 82, 81, 76, 78, 10, 78, 15, 98, 24, 29, 32, 27, 28,
+ 76, 41, 65, 84, 35, 97, 90, 75, 24, 88, 45, 23, 75, 63, 86, 24, 39, 9, 51, 33,
+ 40, 58, 17, 49, 86, 63, 59, 97, 91, 98, 99, 5, 69, 51, 44, 34, 69, 17, 91, 27,
+ 83, 26, 34, 93, 29, 66, 88, 49, 33, 49, 73, 9, 81, 4, 36, 5, 14, 43, 31, 86,
+ 27, 39, 75, 98, 99, 55, 19, 39, 21, 85, 86, 46, 82, 11, 44, 48, 77, 35, 48,
+ 78, 97,
+];
+
+================================================================================
+`;
+
+exports[`numbers-negative.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const numbers1 = [-2017,-506252,-744011292,-7224,-70.4,-83353.6,-708.4,-174023963.52,-40385,
+// comment1
+-380014,
+-253951682,-728,-15.84,-2058467564.56,-43,-33,-85134845,-67092,-1,-78820379,-2371.6,-16,7,
+// comment2
+-62454,-4282239912,
+-10816495.36,0.88,-100622682,8.8,-67087.68000000001,-3758276,-25.5211,-54,-1184265243,-46073628,-280423.44,
+-41833463,-27961.12,-305.36,-199875.28];
+
+const numbers2 = [-234, -342 // comment3
+, -223, -333333.33,12345]
+
+=====================================output=====================================
+const numbers1 = [
+ -2017, -506252, -744011292, -7224, -70.4, -83353.6, -708.4, -174023963.52,
+ -40385,
+ // comment1
+ -380014, -253951682, -728, -15.84, -2058467564.56, -43, -33, -85134845,
+ -67092, -1, -78820379, -2371.6, -16, 7,
+ // comment2
+ -62454, -4282239912, -10816495.36, 0.88, -100622682, 8.8, -67087.68000000001,
+ -3758276, -25.5211, -54, -1184265243, -46073628, -280423.44, -41833463,
+ -27961.12, -305.36, -199875.28,
+];
+
+const numbers2 = [
+ -234,
+ -342, // comment3
+ -223,
+ -333333.33,
+ 12345,
+];
+
+================================================================================
+`;
+
+exports[`numbers-negative-comment-after-minus.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const numbers = [-2017,-506252,-744011292,-7224,-70.4,-83353.6,-708.4,-174023963.52,-40385,-// comment1
+380014,
+-253951682,-728,-15.84,-2058467564.56,-43,-33,-85134845,-67092,-1,-78820379,-2371.6,-16,7,
+// comment2
+-62454,-4282239912,
+-10816495.36,0.88,-100622682,8.8,-67087.68000000001,-3758276,-25.5211,-54,-1184265243,-46073628,-280423.44,
+-41833463,-27961.12,-305.36,-199875.28];
+
+c = [
+ - /**/ 66, 66, 57, 45, 47, 33, 53, 82, 81, 76, 66, 57, 45, 47, 33, 53, 82, 81, 223323
+];
+
+=====================================output=====================================
+const numbers = [
+ -2017,
+ -506252,
+ -744011292,
+ -7224,
+ -70.4,
+ -83353.6,
+ -708.4,
+ -174023963.52,
+ -40385,
+ -(
+ // comment1
+ 380014
+ ),
+ -253951682,
+ -728,
+ -15.84,
+ -2058467564.56,
+ -43,
+ -33,
+ -85134845,
+ -67092,
+ -1,
+ -78820379,
+ -2371.6,
+ -16,
+ 7,
+ // comment2
+ -62454,
+ -4282239912,
+ -10816495.36,
+ 0.88,
+ -100622682,
+ 8.8,
+ -67087.68000000001,
+ -3758276,
+ -25.5211,
+ -54,
+ -1184265243,
+ -46073628,
+ -280423.44,
+ -41833463,
+ -27961.12,
+ -305.36,
+ -199875.28,
+];
+
+c = [
+ -(/**/ 66),
+ 66,
+ 57,
+ 45,
+ 47,
+ 33,
+ 53,
+ 82,
+ 81,
+ 76,
+ 66,
+ 57,
+ 45,
+ 47,
+ 33,
+ 53,
+ 82,
+ 81,
+ 223323,
+];
+
+================================================================================
+`;
+
+exports[`numbers-trailing-comma.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+// --------------- print-width -------------------------------------------------
+c = [
+ 66, 66, 57, 45, 47, 33, 53, 82, 81, 76, 66, 57, 45, 47, 33, 53, 82, 81, 223323,
+];
+
+=====================================output=====================================
+// --------------- print-width -------------------------------------------------
+c = [
+ 66, 66, 57, 45, 47, 33, 53, 82, 81, 76, 66, 57, 45, 47, 33, 53, 82, 81,
+ 223323,
+];
+
+================================================================================
+`;
+
+exports[`numbers-with-holes.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const numberWithHoles1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ // comment before a hole 1
+ ,
+ 7234932841,
+ ,
+ 7234932843,
+ ,
+ // comment after a hole 1
+ 7234932436,
+];
+
+const numberWithHoles2 = [
+ 0x234932941,
+ 0x234932722,
+ 0x234932312,
+
+ // comment before a hole 2
+ ,
+ 0x234932841,
+ ,
+ 0x234932843,
+ ,
+
+ // comment after a hole 2
+ 0x234932436,
+];
+
+=====================================output=====================================
+const numberWithHoles1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ ,
+ // comment before a hole 1
+ 7234932841,
+ ,
+ 7234932843,
+ ,
+ // comment after a hole 1
+ 7234932436,
+];
+
+const numberWithHoles2 = [
+ 0x234932941,
+ 0x234932722,
+ 0x234932312,
+
+ ,
+ // comment before a hole 2
+ 0x234932841,
+ ,
+ 0x234932843,
+ ,
+ // comment after a hole 2
+ 0x234932436,
+];
+
+================================================================================
+`;
+
+exports[`numbers-with-trailing-comments.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+function isUnusedDiagnostic(code) {
+ return [
+ 6133, // '{0}' is declared but never used.
+ 6138, // Property '{0}' is declared but its value is never read.
+ 6192, // All imports in import declaration are unused.
+ 6196, // '{0}' is declared but its value is never read.
+ 6198,
+ 6199,
+ 6205, // All type parameters are unused.
+ ].includes(code);
+}
+
+=====================================output=====================================
+function isUnusedDiagnostic(code) {
+ return [
+ 6133, // '{0}' is declared but never used.
+ 6138, // Property '{0}' is declared but its value is never read.
+ 6192, // All imports in import declaration are unused.
+ 6196, // '{0}' is declared but its value is never read.
+ 6198,
+ 6199,
+ 6205, // All type parameters are unused.
+ ].includes(code);
+}
+
+================================================================================
+`;
+
+exports[`numbers-with-tricky-comments.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const lazyCatererNumbers = [1, 2, 4, 7, 11, 16, 22, 29, 37, 46,
+56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, 352, 379, 407, 436, 466, /*block*/
+// line
+497, 529, 562, 596, 631, 667, 704, 742, 781,
+821, 862, 904, 947, 991, 1036, 1082, 1129, 1177, 1226,
+// line 2
+1276, 1327, 1379];
+
+=====================================output=====================================
+const lazyCatererNumbers = [
+ 1, 2, 4, 7, 11, 16, 22, 29, 37, 46, 56, 67, 79, 92, 106, 121, 137, 154, 172,
+ 191, 211, 232, 254, 277, 301, 326, 352, 379, 407, 436, 466 /*block*/,
+ // line
+ 497, 529, 562, 596, 631, 667, 704, 742, 781, 821, 862, 904, 947, 991, 1036,
+ 1082, 1129, 1177, 1226,
+ // line 2
+ 1276, 1327, 1379,
+];
+
+================================================================================
+`;
+
+exports[`numbers1.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const numbers1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+ 7234932978,
+ 7234932436,
+ 7234932687,
+ 7234932269,
+ 7234932573,
+ 7234932913,
+ 7234932873,
+ 7234932748,
+ 7234932354,
+ 7234932153,
+ 7234932181,
+ 7234932947,
+ 7234932563,
+ 7234932324,
+ 7234932952,
+ 7234932885,
+ 7234932911,
+ 7234932698,
+ 7234932248,
+ 7234932764,
+ 7234932431,
+ 7234932811,
+ 7234932344,
+ 7234932855,
+ 7234932430,
+ 7234932396,
+ 7234932981,
+ 7234932594,
+ 7234932131,
+ 7234932489,
+ 7234932552,
+ 7234932116,
+ 7234932833,
+ 7234932521,
+ 7234932252,
+ 7234932503,
+ 7234932540,
+ 7234932893,
+ 7234932736,
+ 7234932969,
+ 7234932145,
+ 7234932925,
+ 7234932417,
+ 7234932344,
+ 7234932108,
+ 7234932161,
+ 7234932777,
+ 7234932971,
+ 7234932159,
+ 7234932158,
+ 7234932908,
+ 7234932511,
+ 7234932876,
+ 7234932768,
+ 7234932284,
+ 7234932640,
+ 7234932309,
+ 7234932651,
+ 7234932292,
+ 7234932898,
+ 7234932284,
+ 7234932201,
+ 7234932506,
+ 7234932654,
+ 7234932840,
+ 7234932334,
+ 7234932246,
+ 7234932376,
+ 7234932398,
+ 7234932714,
+ 7234932134,
+ 7234932435,
+ 7234932181,
+ 7234932980,
+ 7234932594,
+ 7234932396,
+ 7234932100,
+ 7234932743,
+ 7234932812,
+ 7234932583,
+ 7234932622,
+ 7234932800,
+ 7234932310,
+ 7234932111,
+ 7234932537,
+ 7234932751,
+ 7234932920,
+ 7234932872,
+ 7234932700,
+ 7234932702,
+ 7234932655,
+ 7234932515,
+ 7234932298
+];
+
+=====================================output=====================================
+const numbers1 = [
+ 7234932941, 7234932722, 7234932312, 7234932933, 7234932841, 7234932166,
+ 7234932843, 7234932978, 7234932436, 7234932687, 7234932269, 7234932573,
+ 7234932913, 7234932873, 7234932748, 7234932354, 7234932153, 7234932181,
+ 7234932947, 7234932563, 7234932324, 7234932952, 7234932885, 7234932911,
+ 7234932698, 7234932248, 7234932764, 7234932431, 7234932811, 7234932344,
+ 7234932855, 7234932430, 7234932396, 7234932981, 7234932594, 7234932131,
+ 7234932489, 7234932552, 7234932116, 7234932833, 7234932521, 7234932252,
+ 7234932503, 7234932540, 7234932893, 7234932736, 7234932969, 7234932145,
+ 7234932925, 7234932417, 7234932344, 7234932108, 7234932161, 7234932777,
+ 7234932971, 7234932159, 7234932158, 7234932908, 7234932511, 7234932876,
+ 7234932768, 7234932284, 7234932640, 7234932309, 7234932651, 7234932292,
+ 7234932898, 7234932284, 7234932201, 7234932506, 7234932654, 7234932840,
+ 7234932334, 7234932246, 7234932376, 7234932398, 7234932714, 7234932134,
+ 7234932435, 7234932181, 7234932980, 7234932594, 7234932396, 7234932100,
+ 7234932743, 7234932812, 7234932583, 7234932622, 7234932800, 7234932310,
+ 7234932111, 7234932537, 7234932751, 7234932920, 7234932872, 7234932700,
+ 7234932702, 7234932655, 7234932515, 7234932298,
+];
+
+================================================================================
+`;
+
+exports[`numbers2.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const userIds1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+];
+
+const userIds2 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+ 7234932978,
+ 7234932436,
+];
+
+const userIds3 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+
+ 7234932978,
+ 7234932436,
+];
+
+const userIds4 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ // comment 1
+ 7234932843,
+
+ 7234932978,
+
+ // comment 2
+ 7234932436,
+ // comment 3
+];
+
+
+=====================================output=====================================
+const userIds1 = [7234932941, 7234932722, 7234932312, 7234932933];
+
+const userIds2 = [
+ 7234932941, 7234932722, 7234932312, 7234932933, 7234932841, 7234932166,
+ 7234932843, 7234932978, 7234932436,
+];
+
+const userIds3 = [
+ 7234932941, 7234932722, 7234932312, 7234932933, 7234932841, 7234932166,
+ 7234932843,
+
+ 7234932978, 7234932436,
+];
+
+const userIds4 = [
+ 7234932941, 7234932722, 7234932312, 7234932933, 7234932841, 7234932166,
+ // comment 1
+ 7234932843,
+
+ 7234932978,
+
+ // comment 2
+ 7234932436,
+ // comment 3
+];
+
+================================================================================
+`;
+
+exports[`numbers3.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+let test_case = [
+ [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+ ],
+ [
+ 41,83,31,62,15,70,10,90,/*21,*/48,39,76,14,48,63,62,16,17,61,97,86,80,34,27,
+ 39,53,90,80,56,71,31,22,29,7,71,90,65,17,48,85,14,94,16,32,4,96,49,97,
+ 53,87,54,2,78,37,21,3,97,62,93,62,11,27,14,29,64,44,11,5,39,43,94,52,0,
+ 4,86,58,63,42,97,54,2,1,53,17,92,79,52,47,81,93,34,17,93,20,61,68,58,49,
+ 27,45
+ ]
+];
+
+=====================================output=====================================
+let test_case = [
+ [
+ 66, 57, 45, 47, 33, 53, 82, 81, 76, 78, 10, 78, 15, 98, 24, 29, 32, 27, 28,
+ 76, 41, 65, 84, 35, 97, 90, 75, 24, 88, 45, 23, 75, 63, 86, 24, 39, 9, 51,
+ 33, 40, 58, 17, 49, 86, 63, 59, 97, 91, 98, 99, 5, 69, 51, 44, 34, 69, 17,
+ 91, 27, 83, 26, 34, 93, 29, 66, 88, 49, 33, 49, 73, 9, 81, 4, 36, 5, 14, 43,
+ 31, 86, 27, 39, 75, 98, 99, 55, 19, 39, 21, 85, 86, 46, 82, 11, 44, 48, 77,
+ 35, 48, 78, 97,
+ ],
+ [
+ 41, 83, 31, 62, 15, 70, 10, 90, /*21,*/ 48, 39, 76, 14, 48, 63, 62, 16, 17,
+ 61, 97, 86, 80, 34, 27, 39, 53, 90, 80, 56, 71, 31, 22, 29, 7, 71, 90, 65,
+ 17, 48, 85, 14, 94, 16, 32, 4, 96, 49, 97, 53, 87, 54, 2, 78, 37, 21, 3, 97,
+ 62, 93, 62, 11, 27, 14, 29, 64, 44, 11, 5, 39, 43, 94, 52, 0, 4, 86, 58, 63,
+ 42, 97, 54, 2, 1, 53, 17, 92, 79, 52, 47, 81, 93, 34, 17, 93, 20, 61, 68,
+ 58, 49, 27, 45,
+ ],
+];
+
+================================================================================
+`;
+
exports[`preserve_empty_lines.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
@@ -185,7 +811,13 @@ a = [
]
=====================================output=====================================
-a = [1, 2, 3, 4];
+a = [
+ 1, 2,
+
+ 3,
+
+ 4,
+];
================================================================================
`;
diff --git a/tests/js/arrays/numbers-in-args.js b/tests/js/arrays/numbers-in-args.js
new file mode 100644
index 000000000..1ff69eab3
--- /dev/null
+++ b/tests/js/arrays/numbers-in-args.js
@@ -0,0 +1,13 @@
+expect(bifornCringerMoshedPerplexSawder.getArrayOfNumbers()).toEqual(
+ [1, 2, 3, 4, 5]
+);
+
+expect(bifornCringerMoshedPerplexSawder.getLongArrayOfNumbers()).toEqual(
+ [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+ ]
+);
diff --git a/tests/js/arrays/numbers-in-assignment.js b/tests/js/arrays/numbers-in-assignment.js
new file mode 100644
index 000000000..d7b6f66db
--- /dev/null
+++ b/tests/js/arrays/numbers-in-assignment.js
@@ -0,0 +1,15 @@
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5
+];
+
+bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers2 = [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+];
diff --git a/tests/js/arrays/numbers-negative-comment-after-minus.js b/tests/js/arrays/numbers-negative-comment-after-minus.js
new file mode 100644
index 000000000..2b6a54ae7
--- /dev/null
+++ b/tests/js/arrays/numbers-negative-comment-after-minus.js
@@ -0,0 +1,11 @@
+const numbers = [-2017,-506252,-744011292,-7224,-70.4,-83353.6,-708.4,-174023963.52,-40385,-// comment1
+380014,
+-253951682,-728,-15.84,-2058467564.56,-43,-33,-85134845,-67092,-1,-78820379,-2371.6,-16,7,
+// comment2
+-62454,-4282239912,
+-10816495.36,0.88,-100622682,8.8,-67087.68000000001,-3758276,-25.5211,-54,-1184265243,-46073628,-280423.44,
+-41833463,-27961.12,-305.36,-199875.28];
+
+c = [
+ - /**/ 66, 66, 57, 45, 47, 33, 53, 82, 81, 76, 66, 57, 45, 47, 33, 53, 82, 81, 223323
+];
diff --git a/tests/js/arrays/numbers-negative.js b/tests/js/arrays/numbers-negative.js
new file mode 100644
index 000000000..968d3c4c8
--- /dev/null
+++ b/tests/js/arrays/numbers-negative.js
@@ -0,0 +1,11 @@
+const numbers1 = [-2017,-506252,-744011292,-7224,-70.4,-83353.6,-708.4,-174023963.52,-40385,
+// comment1
+-380014,
+-253951682,-728,-15.84,-2058467564.56,-43,-33,-85134845,-67092,-1,-78820379,-2371.6,-16,7,
+// comment2
+-62454,-4282239912,
+-10816495.36,0.88,-100622682,8.8,-67087.68000000001,-3758276,-25.5211,-54,-1184265243,-46073628,-280423.44,
+-41833463,-27961.12,-305.36,-199875.28];
+
+const numbers2 = [-234, -342 // comment3
+, -223, -333333.33,12345]
diff --git a/tests/js/arrays/numbers-trailing-comma.js b/tests/js/arrays/numbers-trailing-comma.js
new file mode 100644
index 000000000..80e5ba984
--- /dev/null
+++ b/tests/js/arrays/numbers-trailing-comma.js
@@ -0,0 +1,4 @@
+// --------------- print-width -------------------------------------------------
+c = [
+ 66, 66, 57, 45, 47, 33, 53, 82, 81, 76, 66, 57, 45, 47, 33, 53, 82, 81, 223323,
+];
diff --git a/tests/js/arrays/numbers-with-holes.js b/tests/js/arrays/numbers-with-holes.js
new file mode 100644
index 000000000..101734233
--- /dev/null
+++ b/tests/js/arrays/numbers-with-holes.js
@@ -0,0 +1,29 @@
+const numberWithHoles1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ // comment before a hole 1
+ ,
+ 7234932841,
+ ,
+ 7234932843,
+ ,
+ // comment after a hole 1
+ 7234932436,
+];
+
+const numberWithHoles2 = [
+ 0x234932941,
+ 0x234932722,
+ 0x234932312,
+
+ // comment before a hole 2
+ ,
+ 0x234932841,
+ ,
+ 0x234932843,
+ ,
+
+ // comment after a hole 2
+ 0x234932436,
+];
diff --git a/tests/js/arrays/numbers-with-trailing-comments.js b/tests/js/arrays/numbers-with-trailing-comments.js
new file mode 100644
index 000000000..cf789cea9
--- /dev/null
+++ b/tests/js/arrays/numbers-with-trailing-comments.js
@@ -0,0 +1,11 @@
+function isUnusedDiagnostic(code) {
+ return [
+ 6133, // '{0}' is declared but never used.
+ 6138, // Property '{0}' is declared but its value is never read.
+ 6192, // All imports in import declaration are unused.
+ 6196, // '{0}' is declared but its value is never read.
+ 6198,
+ 6199,
+ 6205, // All type parameters are unused.
+ ].includes(code);
+}
diff --git a/tests/js/arrays/numbers-with-tricky-comments.js b/tests/js/arrays/numbers-with-tricky-comments.js
new file mode 100644
index 000000000..6b0fb2128
--- /dev/null
+++ b/tests/js/arrays/numbers-with-tricky-comments.js
@@ -0,0 +1,7 @@
+const lazyCatererNumbers = [1, 2, 4, 7, 11, 16, 22, 29, 37, 46,
+56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, 352, 379, 407, 436, 466, /*block*/
+// line
+497, 529, 562, 596, 631, 667, 704, 742, 781,
+821, 862, 904, 947, 991, 1036, 1082, 1129, 1177, 1226,
+// line 2
+1276, 1327, 1379];
diff --git a/tests/js/arrays/numbers1.js b/tests/js/arrays/numbers1.js
new file mode 100644
index 000000000..5bb0ddc2f
--- /dev/null
+++ b/tests/js/arrays/numbers1.js
@@ -0,0 +1,102 @@
+const numbers1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+ 7234932978,
+ 7234932436,
+ 7234932687,
+ 7234932269,
+ 7234932573,
+ 7234932913,
+ 7234932873,
+ 7234932748,
+ 7234932354,
+ 7234932153,
+ 7234932181,
+ 7234932947,
+ 7234932563,
+ 7234932324,
+ 7234932952,
+ 7234932885,
+ 7234932911,
+ 7234932698,
+ 7234932248,
+ 7234932764,
+ 7234932431,
+ 7234932811,
+ 7234932344,
+ 7234932855,
+ 7234932430,
+ 7234932396,
+ 7234932981,
+ 7234932594,
+ 7234932131,
+ 7234932489,
+ 7234932552,
+ 7234932116,
+ 7234932833,
+ 7234932521,
+ 7234932252,
+ 7234932503,
+ 7234932540,
+ 7234932893,
+ 7234932736,
+ 7234932969,
+ 7234932145,
+ 7234932925,
+ 7234932417,
+ 7234932344,
+ 7234932108,
+ 7234932161,
+ 7234932777,
+ 7234932971,
+ 7234932159,
+ 7234932158,
+ 7234932908,
+ 7234932511,
+ 7234932876,
+ 7234932768,
+ 7234932284,
+ 7234932640,
+ 7234932309,
+ 7234932651,
+ 7234932292,
+ 7234932898,
+ 7234932284,
+ 7234932201,
+ 7234932506,
+ 7234932654,
+ 7234932840,
+ 7234932334,
+ 7234932246,
+ 7234932376,
+ 7234932398,
+ 7234932714,
+ 7234932134,
+ 7234932435,
+ 7234932181,
+ 7234932980,
+ 7234932594,
+ 7234932396,
+ 7234932100,
+ 7234932743,
+ 7234932812,
+ 7234932583,
+ 7234932622,
+ 7234932800,
+ 7234932310,
+ 7234932111,
+ 7234932537,
+ 7234932751,
+ 7234932920,
+ 7234932872,
+ 7234932700,
+ 7234932702,
+ 7234932655,
+ 7234932515,
+ 7234932298
+];
diff --git a/tests/js/arrays/numbers2.js b/tests/js/arrays/numbers2.js
new file mode 100644
index 000000000..6501e26b1
--- /dev/null
+++ b/tests/js/arrays/numbers2.js
@@ -0,0 +1,49 @@
+const userIds1 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+];
+
+const userIds2 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+ 7234932978,
+ 7234932436,
+];
+
+const userIds3 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ 7234932843,
+
+ 7234932978,
+ 7234932436,
+];
+
+const userIds4 = [
+ 7234932941,
+ 7234932722,
+ 7234932312,
+ 7234932933,
+ 7234932841,
+ 7234932166,
+ // comment 1
+ 7234932843,
+
+ 7234932978,
+
+ // comment 2
+ 7234932436,
+ // comment 3
+];
+
diff --git a/tests/js/arrays/numbers3.js b/tests/js/arrays/numbers3.js
new file mode 100644
index 000000000..f1cec5040
--- /dev/null
+++ b/tests/js/arrays/numbers3.js
@@ -0,0 +1,16 @@
+let test_case = [
+ [
+ 66,57,45,47,33,53,82,81,76,78,10,78,15,98,24,29,32,27,28,76,41,65,84,35,
+ 97,90,75,24,88,45,23,75,63,86,24,39,9,51,33,40,58,17,49,86,63,59,97,91,
+ 98,99,5,69,51,44,34,69,17,91,27,83,26,34,93,29,66,88,49,33,49,73,9,81,4,
+ 36,5,14,43,31,86,27,39,75,98,99,55,19,39,21,85,86,46,82,11,44,48,77,35,
+ 48,78,97
+ ],
+ [
+ 41,83,31,62,15,70,10,90,/*21,*/48,39,76,14,48,63,62,16,17,61,97,86,80,34,27,
+ 39,53,90,80,56,71,31,22,29,7,71,90,65,17,48,85,14,94,16,32,4,96,49,97,
+ 53,87,54,2,78,37,21,3,97,62,93,62,11,27,14,29,64,44,11,5,39,43,94,52,0,
+ 4,86,58,63,42,97,54,2,1,53,17,92,79,52,47,81,93,34,17,93,20,61,68,58,49,
+ 27,45
+ ]
+];
diff --git a/tests/json/json/__snapshots__/jsfmt.spec.js.snap b/tests/json/json/__snapshots__/jsfmt.spec.js.snap
index ab23b450d..51c8c164f 100644
--- a/tests/json/json/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/json/json/__snapshots__/jsfmt.spec.js.snap
@@ -524,7 +524,11 @@ trailingComma: "all"
"url": "http://www.JSON.org/",
"comment": "// /* */": " ",
- " s p a c e d ": [1, 2, 3, 4, 5, 6, 7],
+ " s p a c e d ": [
+ 1, 2, 3,
+
+ 4, 5, 6, 7
+ ],
"compact": [1, 2, 3, 4, 5, 6, 7],
"jsontext": "{\\"object with 1 member\\":[\\"array with 1 element\\"]}",
"quotes": "" \\u0022 %22 0x22 034 "",
@@ -650,7 +654,11 @@ trailingComma: "all"
url: "http://www.JSON.org/",
comment: "// /* */": " ",
- " s p a c e d ": [1, 2, 3, 4, 5, 6, 7],
+ " s p a c e d ": [
+ 1, 2, 3,
+
+ 4, 5, 6, 7,
+ ],
compact: [1, 2, 3, 4, 5, 6, 7],
jsontext: '{"object with 1 member":["array with 1 element"]}',
quotes: "" \\u0022 %22 0x22 034 "",
@@ -775,7 +783,11 @@ printWidth: 80
"url": "http://www.JSON.org/",
"comment": "// /* */": " ",
- " s p a c e d ": [1, 2, 3, 4, 5, 6, 7],
+ " s p a c e d ": [
+ 1, 2, 3,
+
+ 4, 5, 6, 7
+ ],
"compact": [1, 2, 3, 4, 5, 6, 7],
"jsontext": "{\\"object with 1 member\\":[\\"array with 1 element\\"]}",
"quotes": "" \\u0022 %22 0x22 034 "",
@@ -900,7 +912,11 @@ printWidth: 80
url: "http://www.JSON.org/",
comment: "// /* */": " ",
- " s p a c e d ": [1, 2, 3, 4, 5, 6, 7],
+ " s p a c e d ": [
+ 1, 2, 3,
+
+ 4, 5, 6, 7,
+ ],
compact: [1, 2, 3, 4, 5, 6, 7],
jsontext: '{"object with 1 member":["array with 1 element"]}',
quotes: "" \\u0022 %22 0x22 034 "",
From 2b3716d5274f7048141c4316e58c7589211cbeb1 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Mon, 25 Jan 2021 14:15:24 +0200
Subject: [PATCH 004/237] Add skipped changelog entry to 2.2.0 blog post
---
website/blog/2020-11-20-2.2.0.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/website/blog/2020-11-20-2.2.0.md b/website/blog/2020-11-20-2.2.0.md
index 03f05691e..b110f0c38 100644
--- a/website/blog/2020-11-20-2.2.0.md
+++ b/website/blog/2020-11-20-2.2.0.md
@@ -1103,6 +1103,10 @@ Checking formatting...
All matched files use Prettier code style!
```
+#### Flush line suffix contents at the end of document ([#9703](https://github.com/prettier/prettier/pull/9703) by [@dangmai](https://github.com/dangmai))
+
+Prettier did not flush [line-suffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) contents at the end of the document if there was no trailing newline. This fix forces all of those contents to be flushed even without trailing newlines.
+
### CLI
#### Move [pre-commit](https://github.com/pre-commit/pre-commit) support to github.com/pre-commit/mirrors-prettier ([#8937](https://github.com/prettier/prettier/pull/8937) by [@FloChehab](https://github.com/FloChehab))
From 78fb22283b3fd0b61bff7454b4e3ab736e20069e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Jan 2021 16:24:57 +0200
Subject: [PATCH 005/237] Build(deps): Bump @angular/compiler from 11.0.9 to
11.1.0 (#10097)
Bumps [@angular/compiler](https://github.com/angular/angular/tree/HEAD/packages/compiler) from 11.0.9 to 11.1.0.
- [Release notes](https://github.com/angular/angular/releases)
- [Changelog](https://github.com/angular/angular/blob/master/CHANGELOG.md)
- [Commits](https://github.com/angular/angular/commits/11.1.0/packages/compiler)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 4b86a5910..6c8b2032e 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"bin"
],
"dependencies": {
- "@angular/compiler": "11.0.9",
+ "@angular/compiler": "11.1.0",
"@babel/code-frame": "7.12.11",
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.73.1",
diff --git a/yarn.lock b/yarn.lock
index f3ab08c39..9d7bda27d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,10 +2,10 @@
# yarn lockfile v1
-"@angular/compiler@11.0.9":
- version "11.0.9"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.0.9.tgz#524757eac7c9915605c3579f12b2a80cb9d4d783"
- integrity sha512-H2IfS6ciPWN0kmKhbwDuvS8ry5GcRFKfoyA/HGk+nQwCE2nAHC8VNwldbtoisO7XfRWr/uaTrh6z/vdfxsAiHw==
+"@angular/compiler@11.1.0":
+ version "11.1.0"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.0.tgz#0e2e18fe0cb64ec696986f12f80debcbdccc8d20"
+ integrity sha512-XW+McH/RVjpLtNkft6UYZQbjhXwX/hvLgUa9jGlTuIFM5o7W4XRPnq5sfn3+QvzdROF0j8S5sy47mGVNQOYMNg==
dependencies:
tslib "^2.0.0"
From 3dfac3d71b1276cac8212d16d60a428ba46a04c1 Mon Sep 17 00:00:00 2001
From: Mike <2266568+michaelbeaumont@users.noreply.github.com>
Date: Mon, 25 Jan 2021 16:09:22 +0100
Subject: [PATCH 006/237] Support YAML document end marker in front matter
(#9878)
---
changelog_unreleased/markdown/9878.md | 31 +++++
cspell.json | 1 +
src/utils/front-matter.js | 54 +++++++--
.../__snapshots__/jsfmt.spec.js.snap | 106 ++++++++++++++++++
.../in-markdown/front-matter-json.md | 6 +
.../in-markdown/front-matter-pandoc.md | 9 ++
6 files changed, 195 insertions(+), 12 deletions(-)
create mode 100644 changelog_unreleased/markdown/9878.md
create mode 100644 tests/misc/embedded_language_formatting/in-markdown/front-matter-json.md
create mode 100644 tests/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md
diff --git a/changelog_unreleased/markdown/9878.md b/changelog_unreleased/markdown/9878.md
new file mode 100644
index 000000000..409d2c4bb
--- /dev/null
+++ b/changelog_unreleased/markdown/9878.md
@@ -0,0 +1,31 @@
+#### Support YAML document end marker in front matter (#9878 by @michaelbeaumont)
+
+Add the ability to delimit the end of front matter with `...`.
+
+
+```markdown
+
+---
+title: Hello
+slug: home
+...
+
+Markdown
+
+
+---
+
+title: Hello
+slug: home
+...
+
+Markdown
+
+
+---
+title: Hello
+slug: home
+...
+
+Markdown
+```
diff --git a/cspell.json b/cspell.json
index ac7214924..c6c7c29d6 100644
--- a/cspell.json
+++ b/cspell.json
@@ -271,6 +271,7 @@
"overscroll",
"packagejson",
"Panasenko",
+ "Pandoc",
"Pangsakulyanont",
"paren",
"parens",
diff --git a/src/utils/front-matter.js b/src/utils/front-matter.js
index b24e86221..ac918cb43 100644
--- a/src/utils/front-matter.js
+++ b/src/utils/front-matter.js
@@ -5,18 +5,26 @@ const {
builders: { hardline, markAsRoot },
} = require("../document");
+const YAML_DELIMITER = "---";
+// In some markdown processors such as pandoc,
+// "..." can be used as the end delimiter for YAML front-matter.
+const YAML_END_DELIMITER = "...";
const DELIMITER_MAP = {
- "---": "yaml",
+ [YAML_DELIMITER]: "yaml",
"+++": "toml",
};
function parse(text) {
- const delimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
+ const startDelimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
+ const endDelimiterRegex = Object.keys(DELIMITER_MAP)
+ .concat(YAML_END_DELIMITER)
+ .map(escape)
+ .join("|");
const match = text.match(
// trailing spaces after delimiters are allowed
new RegExp(
- `^(${delimiterRegex})([^\\n]*)\\n(?:|([\\s\\S]*?)\\n)\\1[^\\n\\S]*(\\n|$)`
+ `^(${startDelimiterRegex})([^\\n]*)\\n(?:|([\\s\\S]*?)\\n)(${endDelimiterRegex})[^\\n\\S]*(\\n|$)`
)
);
@@ -24,19 +32,35 @@ function parse(text) {
return { frontMatter: null, content: text };
}
- const [raw, delimiter, language, value = ""] = match;
- let lang = DELIMITER_MAP[delimiter];
+ const [raw, startDelimiter, language, value = "", endDelimiter] = match;
+
+ let lang = DELIMITER_MAP[startDelimiter];
if (lang !== "toml" && language && language.trim()) {
lang = language.trim();
}
+ // Only allow yaml to parse with a different end delimiter
+ if (
+ startDelimiter !== endDelimiter &&
+ !(
+ lang === "yaml" &&
+ startDelimiter === YAML_DELIMITER &&
+ endDelimiter === YAML_END_DELIMITER
+ )
+ ) {
+ return { frontMatter: null, content: text };
+ }
+
+ const frontMatter = {
+ type: "front-matter",
+ lang,
+ value,
+ startDelimiter,
+ endDelimiter,
+ raw: raw.replace(/\n$/, ""),
+ };
return {
- frontMatter: {
- type: "front-matter",
- lang,
- value,
- raw: raw.replace(/\n$/, ""),
- },
+ frontMatter,
content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length),
};
}
@@ -47,7 +71,13 @@ function print(node, textToDoc) {
const doc = value
? textToDoc(value, { parser: "yaml" }, { stripTrailingHardline: true })
: "";
- return markAsRoot(["---", hardline, doc, doc ? hardline : "", "---"]);
+ return markAsRoot([
+ node.startDelimiter,
+ hardline,
+ doc,
+ doc ? hardline : "",
+ node.endDelimiter,
+ ]);
}
}
diff --git a/tests/misc/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap b/tests/misc/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap
index be316dc29..7809e8056 100644
--- a/tests/misc/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,111 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`front-matter-json.md - {"embeddedLanguageFormatting":"off"} format 1`] = `
+====================================options=====================================
+embeddedLanguageFormatting: "off"
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+---json
+{
+ "a": 1 }
+...
+
+The above should be reformatted because it isn't parsed as json front matter.
+
+=====================================output=====================================
+---json
+{
+"a": 1 }
+...
+
+The above should be reformatted because it isn't parsed as json front matter.
+
+================================================================================
+`;
+
+exports[`front-matter-json.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+---json
+{
+ "a": 1 }
+...
+
+The above should be reformatted because it isn't parsed as json front matter.
+
+=====================================output=====================================
+---json
+{
+"a": 1 }
+...
+
+The above should be reformatted because it isn't parsed as json front matter.
+
+================================================================================
+`;
+
+exports[`front-matter-pandoc.md - {"embeddedLanguageFormatting":"off"} format 1`] = `
+====================================options=====================================
+embeddedLanguageFormatting: "off"
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+---yaml
+
+title: Hello
+slug: home
+
+...
+
+Hello world!
+
+
+=====================================output=====================================
+---yaml
+
+title: Hello
+slug: home
+
+...
+
+Hello world!
+
+================================================================================
+`;
+
+exports[`front-matter-pandoc.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+---yaml
+
+title: Hello
+slug: home
+
+...
+
+Hello world!
+
+
+=====================================output=====================================
+---
+title: Hello
+slug: home
+...
+
+Hello world!
+
+================================================================================
+`;
+
exports[`test.md - {"embeddedLanguageFormatting":"off"} format 1`] = `
====================================options=====================================
embeddedLanguageFormatting: "off"
diff --git a/tests/misc/embedded_language_formatting/in-markdown/front-matter-json.md b/tests/misc/embedded_language_formatting/in-markdown/front-matter-json.md
new file mode 100644
index 000000000..e66165f10
--- /dev/null
+++ b/tests/misc/embedded_language_formatting/in-markdown/front-matter-json.md
@@ -0,0 +1,6 @@
+---json
+{
+ "a": 1 }
+...
+
+The above should be reformatted because it isn't parsed as json front matter.
diff --git a/tests/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md b/tests/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md
new file mode 100644
index 000000000..8b8fc576d
--- /dev/null
+++ b/tests/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md
@@ -0,0 +1,9 @@
+---yaml
+
+title: Hello
+slug: home
+
+...
+
+Hello world!
+
From 4d58724016186d0a3eff235db5459d1e966b1d3f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Jan 2021 17:18:47 +0200
Subject: [PATCH 007/237] Build(deps): Bump @glimmer/syntax from 0.73.1 to
0.73.2 (#10103)
Bumps [@glimmer/syntax](https://github.com/glimmerjs/glimmer-vm) from 0.73.1 to 0.73.2.
- [Release notes](https://github.com/glimmerjs/glimmer-vm/releases)
- [Changelog](https://github.com/glimmerjs/glimmer-vm/blob/master/CHANGELOG.md)
- [Commits](https://github.com/glimmerjs/glimmer-vm/compare/v0.73.1...v0.73.2)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 28 ++++++----------------------
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/package.json b/package.json
index 6c8b2032e..4504138cd 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"@angular/compiler": "11.1.0",
"@babel/code-frame": "7.12.11",
"@babel/parser": "7.12.11",
- "@glimmer/syntax": "0.73.1",
+ "@glimmer/syntax": "0.73.2",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "4.14.0",
"angular-estree-parser": "2.3.0",
diff --git a/yarn.lock b/yarn.lock
index 9d7bda27d..8594eb855 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1064,13 +1064,6 @@
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/interfaces@0.73.1":
- version "0.73.1"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.73.1.tgz#ad1dffb635c19b66230c45894e15f3a34d90e5b0"
- integrity sha512-MttMIyWGZ+IbiJJpr4q9dwMmn+7eOMdxjMiuaEYeLBN/DXe8T9VePqgapURkSL9CEmKByB/pLvcaVTSYfm0RYg==
- dependencies:
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/interfaces@0.73.2":
version "0.73.2"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.73.2.tgz#03c769208bf705760800f3f64774b074bf04f738"
@@ -1089,25 +1082,16 @@
"@glimmer/util" "0.73.2"
"@glimmer/validator" "0.73.2"
-"@glimmer/syntax@0.73.1":
- version "0.73.1"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.73.1.tgz#9e3c898ba91ddb1d4e6f413452b0b84700910c83"
- integrity sha512-TpTK9yAaoDOzdo+5itoJPRxrVWacYlGuHtJvATi96RJUTAxPz9b9M3AcVm0atcZW7WiA8X8J/weQ2KcIVgAYmw==
+"@glimmer/syntax@0.73.2":
+ version "0.73.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.73.2.tgz#76438633f26b3fccb86bd7d25390a901737aa530"
+ integrity sha512-neZvKpfJETtUxnZMdpmD9qi4E9WaKhnQt63H+0iHkz1APriIZM5rsq12oiG9MSCvEiF5iP3auwJMU22XKPtyeQ==
dependencies:
- "@glimmer/interfaces" "0.73.1"
- "@glimmer/util" "0.73.1"
+ "@glimmer/interfaces" "0.73.2"
+ "@glimmer/util" "0.73.2"
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
-"@glimmer/util@0.73.1":
- version "0.73.1"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.73.1.tgz#f89bb7adba18315e00fbdb5a7c5a4913bbdebc6e"
- integrity sha512-zFXY9OgR6wx7Cy4yYJkmgoUsdx3MQYAmZytuEDTghLXJyUoSh5Jcvner+qhFkqLSzj2pvE4btn3yUNnx3QOBtg==
- dependencies:
- "@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.73.1"
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/util@0.73.2":
version "0.73.2"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.73.2.tgz#32ca1cec339a91f12f0359711f1a86fc1dcc13ca"
From 0d1713ba811ba65330ff962010a6a631558fff28 Mon Sep 17 00:00:00 2001
From: Cyrille David
Date: Mon, 25 Jan 2021 20:27:35 +0100
Subject: [PATCH 008/237] Add changelog entry for #9885 (#10133)
---
changelog_unreleased/handlebars/9885.md | 45 +++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 changelog_unreleased/handlebars/9885.md
diff --git a/changelog_unreleased/handlebars/9885.md b/changelog_unreleased/handlebars/9885.md
new file mode 100644
index 000000000..2fe1c4e9b
--- /dev/null
+++ b/changelog_unreleased/handlebars/9885.md
@@ -0,0 +1,45 @@
+#### Add a whitespace sensitive mode (#9885 by @dcyriller)
+
+```sh
+--html-whitespace-sensitivity strict
+```
+
+
+```hbs
+{{!-- Input --}}
+123 {{mustache}}
+
+123 {{mustache}}
+123 {{mustache}}
+
+
+123 {{mustache}}
+
+
+{{!-- Prettier stable --}}
+
+ 123 {{mustache}}
+
+
+ 123 {{mustache}}
+
+
+ 123 {{mustache}}
+
+
+ 123 {{mustache}}
+
+
+{{!-- Prettier main --}}
+123 {{mustache}}
+
+ 123
+ {{mustache}}
+123
+ {{mustache}}
+
+
+ 123
+ {{mustache}}
+
+```
From 93920425015253d3be97689b368ed4088ef41da5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Jan 2021 21:28:26 +0200
Subject: [PATCH 009/237] Build(deps): Bump fast-glob from 3.2.4 to 3.2.5
(#10073)
Bumps [fast-glob](https://github.com/mrmlnc/fast-glob) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/mrmlnc/fast-glob/releases)
- [Commits](https://github.com/mrmlnc/fast-glob/compare/3.2.4...3.2.5)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 4504138cd..0bb146ddf 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
"escape-string-regexp": "4.0.0",
"espree": "7.3.1",
"esutils": "2.0.3",
- "fast-glob": "3.2.4",
+ "fast-glob": "3.2.5",
"fast-json-stable-stringify": "2.1.0",
"find-parent-dir": "0.3.0",
"flow-parser": "0.143.1",
diff --git a/yarn.lock b/yarn.lock
index 8594eb855..aa3f01fef 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3393,10 +3393,10 @@ fast-deep-equal@^3.1.1:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
-fast-glob@3.2.4, fast-glob@^3.1.1:
- version "3.2.4"
- resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3"
- integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==
+fast-glob@3.2.5, fast-glob@^3.1.1:
+ version "3.2.5"
+ resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661"
+ integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
From 743ef3de9bd463bc858f224152f47a78cd73fdde Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Tue, 26 Jan 2021 09:45:25 +0800
Subject: [PATCH 010/237] SCSS: Fix maps with keys that are lists or maps
(#10005)
---
changelog_unreleased/scss/10005.md | 17 ++
src/language-css/printer-postcss.js | 13 +-
src/language-css/utils.js | 18 +-
.../scss/map/__snapshots__/jsfmt.spec.js.snap | 261 ++++++++++++++++++
tests/scss/map/jsfmt.spec.js | 2 +
tests/scss/map/key-values.scss | 12 +
tests/scss/map/keys.scss | 12 +
7 files changed, 331 insertions(+), 4 deletions(-)
create mode 100644 changelog_unreleased/scss/10005.md
create mode 100644 tests/scss/map/__snapshots__/jsfmt.spec.js.snap
create mode 100644 tests/scss/map/jsfmt.spec.js
create mode 100644 tests/scss/map/key-values.scss
create mode 100644 tests/scss/map/keys.scss
diff --git a/changelog_unreleased/scss/10005.md b/changelog_unreleased/scss/10005.md
new file mode 100644
index 000000000..17b441df8
--- /dev/null
+++ b/changelog_unreleased/scss/10005.md
@@ -0,0 +1,17 @@
+#### Fix maps with keys that are lists or maps (#10005 by @fisker)
+
+
+```scss
+// Input
+$map: (
+ ('my list'): 'hello world',
+);
+
+// Prettier stable
+TypeError: Cannot read property 'length' of undefined
+
+// Prettier main
+$map: (
+ ("my list"): "hello world",
+);
+```
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js
index b21297d1c..10a2f0971 100644
--- a/src/language-css/printer-postcss.js
+++ b/src/language-css/printer-postcss.js
@@ -57,6 +57,7 @@ const {
hasParensAroundNode,
hasEmptyRawBefore,
isKeyValuePairNode,
+ isKeyInValuePairNode,
isDetachedRulesetCallNode,
isTemplatePlaceholderNode,
isTemplatePropNode,
@@ -856,8 +857,9 @@ function genericPrint(path, options, print) {
const lastItem = node.groups[node.groups.length - 1];
const isLastItemComment = lastItem && lastItem.type === "value-comment";
+ const isKey = isKeyInValuePairNode(node, parentNode);
- return group(
+ const printed = group(
[
node.open ? path.call(print, "open") : "",
indent([
@@ -873,6 +875,7 @@ function genericPrint(path, options, print) {
isKeyValuePairNode(node) &&
node.type === "value-comma_group" &&
node.groups &&
+ node.groups[0].type !== "value-paren_group" &&
node.groups[2] &&
node.groups[2].type === "value-paren_group"
) {
@@ -898,9 +901,11 @@ function genericPrint(path, options, print) {
node.close ? path.call(print, "close") : "",
],
{
- shouldBreak: isSCSSMapItem,
+ shouldBreak: isSCSSMapItem && !isKey,
}
);
+
+ return isKey ? dedent(printed) : printed;
}
case "value-func": {
return [
@@ -934,7 +939,9 @@ function genericPrint(path, options, print) {
return [
node.value,
// Don't add spaces on escaped colon `:`, e.g: grid-template-rows: [row-1-00\:00] auto;
- (prevNode && prevNode.value[prevNode.value.length - 1] === "\\") ||
+ (prevNode &&
+ typeof prevNode.value === "string" &&
+ prevNode.value[prevNode.value.length - 1] === "\\") ||
// Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
insideValueFunctionNode(path, "url")
? ""
diff --git a/src/language-css/utils.js b/src/language-css/utils.js
index 20e1bff38..1843cffde 100644
--- a/src/language-css/utils.js
+++ b/src/language-css/utils.js
@@ -401,7 +401,22 @@ function isWordNode(node) {
}
function isColonNode(node) {
- return node.type === "value-colon";
+ return node && node.type === "value-colon";
+}
+
+function isKeyInValuePairNode(node, parentNode) {
+ if (!isKeyValuePairNode(parentNode)) {
+ return false;
+ }
+
+ const { groups } = parentNode;
+ const index = groups.indexOf(node);
+
+ if (index === -1) {
+ return false;
+ }
+
+ return isColonNode(groups[index + 1]);
}
function isMediaAndSupportsKeywords(node) {
@@ -503,6 +518,7 @@ module.exports = {
isPostcssSimpleVarNode,
isKeyValuePairNode,
isKeyValuePairInParenGroupNode,
+ isKeyInValuePairNode,
isSCSSMapItemNode,
isInlineValueCommentNode,
isHashNode,
diff --git a/tests/scss/map/__snapshots__/jsfmt.spec.js.snap b/tests/scss/map/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..729e8d5a7
--- /dev/null
+++ b/tests/scss/map/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,261 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`key-values.scss - {"trailingComma":"none"} format 1`] = `
+====================================options=====================================
+parsers: ["scss"]
+printWidth: 80
+trailingComma: "none"
+ | printWidth
+=====================================input======================================
+$map: (
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ 1,
+);
+
+=====================================output=====================================
+$map: (
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value"
+ ):
+ (
+ "key": "value"
+ ),
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value"
+ ):
+ (
+ "list"
+ ),
+ (
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list"
+ ):
+ (
+ "list"
+ ),
+ (
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list"
+ ):
+ (
+ "key": "value"
+ ),
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value"
+ ):
+ 1
+);
+
+================================================================================
+`;
+
+exports[`key-values.scss format 1`] = `
+====================================options=====================================
+parsers: ["scss"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+$map: (
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ 1,
+);
+
+=====================================output=====================================
+$map: (
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ ):
+ (
+ "key": "value",
+ ),
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ ):
+ (
+ "list",
+ ),
+ (
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ ):
+ (
+ "list",
+ ),
+ (
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ "list",
+ ):
+ (
+ "key": "value",
+ ),
+ (
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ "key": "value",
+ ):
+ 1,
+);
+
+================================================================================
+`;
+
+exports[`keys.scss - {"trailingComma":"none"} format 1`] = `
+====================================options=====================================
+parsers: ["scss"]
+printWidth: 80
+trailingComma: "none"
+ | printWidth
+=====================================input======================================
+$map: (
+ 'string': 'hello world',
+ ('list'): 'hello world',
+ ('key': 'value'): 'hello world',
+ ('list', 'long long long long long long long long long long long long long list'): 'hello world',
+ ('key': 'value','long long long long long long long long long long long long long map': 'value',): 'hello world',
+);
+
+// #10000
+$map: (
+ ('my list'): 'hello world',
+);
+
+=====================================output=====================================
+$map: (
+ "string": "hello world",
+ ("list"): "hello world",
+ ("key": "value"): "hello world",
+ (
+ "list",
+ "long long long long long long long long long long long long long list"
+ ):
+ "hello world",
+ (
+ "key": "value",
+ "long long long long long long long long long long long long long map":
+ "value"
+ ):
+ "hello world"
+);
+
+// #10000
+$map: (
+ ("my list"): "hello world"
+);
+
+================================================================================
+`;
+
+exports[`keys.scss format 1`] = `
+====================================options=====================================
+parsers: ["scss"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+$map: (
+ 'string': 'hello world',
+ ('list'): 'hello world',
+ ('key': 'value'): 'hello world',
+ ('list', 'long long long long long long long long long long long long long list'): 'hello world',
+ ('key': 'value','long long long long long long long long long long long long long map': 'value',): 'hello world',
+);
+
+// #10000
+$map: (
+ ('my list'): 'hello world',
+);
+
+=====================================output=====================================
+$map: (
+ "string": "hello world",
+ ("list"): "hello world",
+ ("key": "value"): "hello world",
+ (
+ "list",
+ "long long long long long long long long long long long long long list",
+ ):
+ "hello world",
+ (
+ "key": "value",
+ "long long long long long long long long long long long long long map":
+ "value",
+ ):
+ "hello world",
+);
+
+// #10000
+$map: (
+ ("my list"): "hello world",
+);
+
+================================================================================
+`;
diff --git a/tests/scss/map/jsfmt.spec.js b/tests/scss/map/jsfmt.spec.js
new file mode 100644
index 000000000..f2558a4a9
--- /dev/null
+++ b/tests/scss/map/jsfmt.spec.js
@@ -0,0 +1,2 @@
+run_spec(__dirname, ["scss"], { trailingComma: "none" });
+run_spec(__dirname, ["scss"]);
diff --git a/tests/scss/map/key-values.scss b/tests/scss/map/key-values.scss
new file mode 100644
index 000000000..2041334cd
--- /dev/null
+++ b/tests/scss/map/key-values.scss
@@ -0,0 +1,12 @@
+$map: (
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('list'),
+ ('list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list', 'list'):
+ ('key': 'value',),
+ ('key': 'value', 'key': 'value','key': 'value','key': 'value','key': 'value',):
+ 1,
+);
diff --git a/tests/scss/map/keys.scss b/tests/scss/map/keys.scss
new file mode 100644
index 000000000..fe008a5d4
--- /dev/null
+++ b/tests/scss/map/keys.scss
@@ -0,0 +1,12 @@
+$map: (
+ 'string': 'hello world',
+ ('list'): 'hello world',
+ ('key': 'value'): 'hello world',
+ ('list', 'long long long long long long long long long long long long long list'): 'hello world',
+ ('key': 'value','long long long long long long long long long long long long long map': 'value',): 'hello world',
+);
+
+// #10000
+$map: (
+ ('my list'): 'hello world',
+);
From ce26805e84756953875f30a0c165bd6b09c94ea0 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Tue, 26 Jan 2021 09:46:14 +0800
Subject: [PATCH 011/237] Enable `unicorn/prefer-spread` (#10129)
---
.eslintrc.yml | 1 +
scripts/build/build.js | 4 +--
scripts/build/config.js | 2 +-
scripts/release/utils.js | 8 +++---
scripts/sync-flow-tests.js | 6 ++---
src/cli/expand-patterns.js | 7 +++---
src/cli/usage.js | 2 +-
src/common/load-plugins.js | 24 +++++++++---------
src/config/resolve-config.js | 8 +++---
src/document/doc-printer.js | 2 +-
src/language-css/parser-postcss.js | 2 +-
src/language-css/utils.js | 6 +++--
src/language-html/index.js | 5 ++--
src/language-html/print-preprocess.js | 17 +++++++------
src/language-html/printer-html.js | 26 ++++++++++----------
src/language-js/clean.js | 2 +-
src/language-js/print/angular.js | 8 +++---
src/language-js/print/binaryish.js | 9 ++++---
src/language-js/print/call-arguments.js | 10 +++++---
src/language-js/print/interface.js | 6 ++---
src/language-js/print/object.js | 6 ++---
src/language-js/printer-estree.js | 2 +-
src/language-markdown/index.js | 2 +-
src/language-markdown/parser-markdown.js | 2 +-
src/language-markdown/printer-markdown.js | 16 +++++++++---
src/language-markdown/utils.js | 7 +++---
src/language-yaml/printer-yaml.js | 2 +-
src/language-yaml/utils.js | 18 +++++++++-----
src/main/comments.js | 9 +++----
src/main/options-normalizer.js | 2 +-
src/main/support.js | 2 +-
tests_config/utils/create-snapshot.js | 30 +++++++++++------------
tests_integration/runPrettier.js | 7 +++---
website/playground/markdown.js | 8 +++---
34 files changed, 147 insertions(+), 121 deletions(-)
diff --git a/.eslintrc.yml b/.eslintrc.yml
index a7135b083..89c520c2d 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -75,6 +75,7 @@ rules:
unicorn/prefer-includes: error
unicorn/prefer-number-properties: error
unicorn/prefer-regexp-test: error
+ unicorn/prefer-spread: error
unicorn/prefer-string-slice: error
overrides:
- files:
diff --git a/scripts/build/build.js b/scripts/build/build.js
index 0c4dccc34..ccd0e6517 100644
--- a/scripts/build/build.js
+++ b/scripts/build/build.js
@@ -97,9 +97,7 @@ async function createBundle(bundleConfig, cache, options) {
const esmFile = path.join("dist/esm", output.replace(".js", ".mjs"));
sizeTexts.push(`esm ${await getSizeText(esmFile)}`);
}
- process.stdout.write(
- fitTerminal(output, sizeTexts.join(", ").concat(" "))
- );
+ process.stdout.write(fitTerminal(output, `${sizeTexts.join(", ")} `));
}
console.log(status.DONE);
diff --git a/scripts/build/config.js b/scripts/build/config.js
index c154f53d5..b99ecd2f1 100644
--- a/scripts/build/config.js
+++ b/scripts/build/config.js
@@ -168,7 +168,7 @@ function getFileOutput(bundle) {
return bundle.output || path.basename(bundle.input);
}
-module.exports = coreBundles.concat(parsers).map((bundle) => ({
+module.exports = [...coreBundles, ...parsers].map((bundle) => ({
...bundle,
output: getFileOutput(bundle),
}));
diff --git a/scripts/release/utils.js b/scripts/release/utils.js
index 22a8370e7..f19ff466c 100644
--- a/scripts/release/utils.js
+++ b/scripts/release/utils.js
@@ -34,10 +34,10 @@ function logPromise(name, promise) {
}
function runYarn(script) {
- if (typeof script === "string") {
- script = [script];
- }
- return execa("yarn", ["--silent"].concat(script)).catch((error) => {
+ return execa("yarn", [
+ "--silent",
+ ...(Array.isArray(script) ? script : [script]),
+ ]).catch((error) => {
throw new Error(`\`yarn ${script}\` failed\n${error.stdout}`);
});
}
diff --git a/scripts/sync-flow-tests.js b/scripts/sync-flow-tests.js
index 7705c78b8..68b0ef0d8 100644
--- a/scripts/sync-flow-tests.js
+++ b/scripts/sync-flow-tests.js
@@ -101,9 +101,9 @@ function run(argv) {
"but that's not interesting for Prettier's tests.",
"This is the skipped stuff:",
"",
- ]
- .concat(skipped, "")
- .join("\n")
+ ...skipped,
+ "",
+ ].join("\n")
);
}
diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js
index 7dba07ddb..424f69aa7 100644
--- a/src/cli/expand-patterns.js
+++ b/src/cli/expand-patterns.js
@@ -130,9 +130,10 @@ function* expandPatternsInternal(context) {
const filenames = flat(
context.languages.map((lang) => lang.filenames || [])
);
- supportedFilesGlob = `**/{${extensions
- .map((ext) => "*" + (ext[0] === "." ? ext : "." + ext))
- .concat(filenames)}}`;
+ supportedFilesGlob = `**/{${[
+ ...extensions.map((ext) => "*" + (ext[0] === "." ? ext : "." + ext)),
+ ...filenames,
+ ]}}`;
}
return supportedFilesGlob;
}
diff --git a/src/cli/usage.js b/src/cli/usage.js
index 2babc28e3..151de5a6a 100644
--- a/src/cli/usage.js
+++ b/src/cli/usage.js
@@ -148,7 +148,7 @@ function createUsage(context) {
return `${category} options:\n\n${indent(categoryOptions, 2)}`;
});
- return [constant.usageSummary].concat(optionsUsage, [""]).join("\n\n");
+ return [constant.usageSummary, ...optionsUsage, ""].join("\n\n");
}
function createDetailedUsage(context, flag) {
diff --git a/src/common/load-plugins.js b/src/common/load-plugins.js
index 6b1934133..e94b1884b 100644
--- a/src/common/load-plugins.js
+++ b/src/common/load-plugins.js
@@ -4,6 +4,7 @@ const fs = require("fs");
const path = require("path");
const uniqBy = require("lodash/uniqBy");
const partition = require("lodash/partition");
+const flatten = require("lodash/flatten");
const globby = require("globby");
const mem = require("mem");
const internalPlugins = require("../languages");
@@ -56,8 +57,8 @@ function load(plugins, pluginSearchDirs) {
}
);
- const externalAutoLoadPluginInfos = pluginSearchDirs
- .map((pluginSearchDir) => {
+ const externalAutoLoadPluginInfos = flatten(
+ pluginSearchDirs.map((pluginSearchDir) => {
const resolvedPluginSearchDir = path.resolve(
process.cwd(),
pluginSearchDir
@@ -85,19 +86,20 @@ function load(plugins, pluginSearchDirs) {
requirePath: resolve(pluginName, { paths: [resolvedPluginSearchDir] }),
}));
})
- .reduce((a, b) => a.concat(b), []);
+ );
- const externalPlugins = uniqBy(
- externalManualLoadPluginInfos.concat(externalAutoLoadPluginInfos),
- "requirePath"
- )
- .map((externalPluginInfo) => ({
+ const externalPlugins = [
+ ...uniqBy(
+ [...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos],
+ "requirePath"
+ ).map((externalPluginInfo) => ({
name: externalPluginInfo.name,
...eval("require")(externalPluginInfo.requirePath),
- }))
- .concat(externalPluginInstances);
+ })),
+ ...externalPluginInstances,
+ ];
- return internalPlugins.concat(externalPlugins);
+ return [...internalPlugins, ...externalPlugins];
}
function findPluginsInNodeModules(nodeModulesDir) {
diff --git a/src/config/resolve-config.js b/src/config/resolve-config.js
index a8c55977a..011fb6a50 100644
--- a/src/config/resolve-config.js
+++ b/src/config/resolve-config.js
@@ -154,9 +154,11 @@ function mergeOverrides(configResult, filePath) {
}
// Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js
-function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
- const patternList = [].concat(patterns);
- const excludedPatternList = [].concat(excludedPatterns || []);
+function pathMatchesGlobs(filePath, patterns, excludedPatterns = []) {
+ const patternList = Array.isArray(patterns) ? patterns : [patterns];
+ const excludedPatternList = Array.isArray(excludedPatterns)
+ ? excludedPatterns
+ : [excludedPatterns];
const opts = { matchBase: true, dot: true };
return (
diff --git a/src/document/doc-printer.js b/src/document/doc-printer.js
index 897fb9b11..39d8efdea 100644
--- a/src/document/doc-printer.js
+++ b/src/document/doc-printer.js
@@ -45,7 +45,7 @@ function generateInd(ind, newPart, options) {
const queue =
newPart.type === "dedent"
? ind.queue.slice(0, -1)
- : ind.queue.concat(newPart);
+ : [...ind.queue, newPart];
let value = "";
let length = 0;
diff --git a/src/language-css/parser-postcss.js b/src/language-css/parser-postcss.js
index 1dbdfcb6a..81c14991d 100644
--- a/src/language-css/parser-postcss.js
+++ b/src/language-css/parser-postcss.js
@@ -73,7 +73,7 @@ function parseValueNode(valueNode, options) {
for (let i = 0; i < groups.length; i++) {
const group = groups[i];
if (group.type === "comma_group") {
- groupList = groupList.concat(group.groups);
+ groupList = [...groupList, ...group.groups];
} else {
groupList.push(group);
}
diff --git a/src/language-css/utils.js b/src/language-css/utils.js
index 1843cffde..4174f4c1d 100644
--- a/src/language-css/utils.js
+++ b/src/language-css/utils.js
@@ -30,7 +30,7 @@ const colorAdjusterFunctions = new Set([
]);
function getAncestorCounter(path, typeOrTypes) {
- const types = [].concat(typeOrTypes);
+ const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
let counter = -1;
let ancestorNode;
@@ -149,7 +149,9 @@ function insideICSSRuleNode(path) {
}
function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
- const atRuleNames = [].concat(atRuleNameOrAtRuleNames);
+ const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames)
+ ? atRuleNameOrAtRuleNames
+ : [atRuleNameOrAtRuleNames];
const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
return (
diff --git a/src/language-html/index.js b/src/language-html/index.js
index 61882c524..1caf94c65 100644
--- a/src/language-html/index.js
+++ b/src/language-html/index.js
@@ -17,9 +17,10 @@ const languages = [
since: "1.15.0",
parsers: ["html"],
vscodeLanguageIds: ["html"],
- extensions: data.extensions.concat([
+ extensions: [
+ ...data.extensions,
".mjml", // MJML is considered XML in Linguist but it should be formatted as HTML
- ]),
+ ],
})),
createLanguage(require("linguist-languages/data/HTML.json"), () => ({
name: "Lightning Web Components",
diff --git a/src/language-html/print-preprocess.js b/src/language-html/print-preprocess.js
index 5a790780f..896d72bcd 100644
--- a/src/language-html/print-preprocess.js
+++ b/src/language-html/print-preprocess.js
@@ -331,7 +331,7 @@ function extractWhitespaces(ast /*, options*/) {
// extract whitespace nodes
.reduce((newChildren, child) => {
if (child.type !== "text" || isWhitespaceSensitive) {
- return newChildren.concat(child);
+ return [...newChildren, child];
}
const localChildren = [];
@@ -361,7 +361,7 @@ function extractWhitespaces(ast /*, options*/) {
localChildren.push({ type: TYPE_WHITESPACE });
}
- return newChildren.concat(localChildren);
+ return [...newChildren, ...localChildren];
}, [])
// set hasLeadingSpaces/hasTrailingSpaces and filter whitespace nodes
.reduce((newChildren, child, i, children) => {
@@ -375,11 +375,14 @@ function extractWhitespaces(ast /*, options*/) {
i !== children.length - 1 &&
children[i + 1].type === TYPE_WHITESPACE;
- return newChildren.concat({
- ...child,
- hasLeadingSpaces,
- hasTrailingSpaces,
- });
+ return [
+ ...newChildren,
+ {
+ ...child,
+ hasLeadingSpaces,
+ hasTrailingSpaces,
+ },
+ ];
}, []),
});
});
diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js
index d4863e233..46aec9c30 100644
--- a/src/language-html/printer-html.js
+++ b/src/language-html/printer-html.js
@@ -228,13 +228,13 @@ function genericPrint(path, options, print) {
case "element":
case "ieConditionalComment": {
if (shouldPreserveContent(node, options)) {
- return [].concat(
+ return [
printOpeningTagPrefix(node, options),
group(printOpeningTag(path, options, print)),
- replaceEndOfLineWith(getNodeContent(node, options), literalline),
- printClosingTag(node, options),
- printClosingTagSuffix(node, options)
- );
+ ...replaceEndOfLineWith(getNodeContent(node, options), literalline),
+ ...printClosingTag(node, options),
+ printClosingTagSuffix(node, options),
+ ];
}
/**
* do not break:
@@ -505,25 +505,25 @@ function printChildren(path, options, print) {
}
}
- return [].concat(
- prevParts,
+ return [
+ ...prevParts,
group([
...leadingParts,
group([printChild(childPath), ...trailingParts], {
id: groupIds[childIndex],
}),
]),
- nextParts
- );
+ ...nextParts,
+ ];
}, "children");
function printChild(childPath) {
const child = childPath.getValue();
if (hasPrettierIgnore(child)) {
- return [].concat(
+ return [
printOpeningTagPrefix(child, options),
- replaceEndOfLineWith(
+ ...replaceEndOfLineWith(
options.originalText.slice(
locStart(child) +
(child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev)
@@ -536,8 +536,8 @@ function printChildren(path, options, print) {
),
literalline
),
- printClosingTagSuffix(child, options)
- );
+ printClosingTagSuffix(child, options),
+ ];
}
return print(childPath);
diff --git a/src/language-js/clean.js b/src/language-js/clean.js
index 5604e5b7b..8da157caf 100644
--- a/src/language-js/clean.js
+++ b/src/language-js/clean.js
@@ -103,7 +103,7 @@ function clean(ast, newObj, parent) {
.map((container) => container.expression);
const quasis = templateLiterals.reduce(
- (quasis, templateLiteral) => quasis.concat(templateLiteral.quasis),
+ (quasis, templateLiteral) => [...quasis, ...templateLiteral.quasis],
[]
);
diff --git a/src/language-js/print/angular.js b/src/language-js/print/angular.js
index 166150a0f..d95da9c40 100644
--- a/src/language-js/print/angular.js
+++ b/src/language-js/print/angular.js
@@ -12,12 +12,12 @@ function printAngular(path, options, print) {
const n = path.getValue();
switch (n.type) {
case "NGRoot":
- return [].concat(
+ return [
path.call(print, "node"),
!hasComment(n.node)
- ? []
- : [" //", getComments(n.node)[0].value.trimEnd()]
- );
+ ? ""
+ : " //" + getComments(n.node)[0].value.trimEnd(),
+ ];
case "NGPipeExpression":
return printBinaryishExpression(path, options, print);
case "NGChainedExpression":
diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js
index c38235cbd..fdad81b56 100644
--- a/src/language-js/print/binaryish.js
+++ b/src/language-js/print/binaryish.js
@@ -196,8 +196,9 @@ function printBinaryishExpressions(
// which is unique in that it is right-associative.)
if (shouldFlatten(node.operator, node.left.operator)) {
// Flatten them out by recursively calling this function.
- parts = parts.concat(
- path.call(
+ parts = [
+ ...parts,
+ ...path.call(
(left) =>
printBinaryishExpressions(
left,
@@ -207,8 +208,8 @@ function printBinaryishExpressions(
isInsideParenthesis
),
"left"
- )
- );
+ ),
+ ];
} else {
parts.push(group(path.call(print, "left")));
}
diff --git a/src/language-js/print/call-arguments.js b/src/language-js/print/call-arguments.js
index 9ee644498..8121ec3a4 100644
--- a/src/language-js/print/call-arguments.js
+++ b/src/language-js/print/call-arguments.js
@@ -159,12 +159,14 @@ function printCallArguments(path, options, print) {
hasEmptyLineFollowingFirstArg ? hardline : line,
hasEmptyLineFollowingFirstArg ? hardline : "",
],
- ].concat(printedArguments.slice(1));
+ ...printedArguments.slice(1),
+ ];
}
if (shouldGroupLast && i === args.length - 1) {
- printedExpanded = printedArguments
- .slice(0, -1)
- .concat(argPath.call((p) => print(p, { expandLastArg: true })));
+ printedExpanded = [
+ ...printedArguments.slice(0, -1),
+ argPath.call((p) => print(p, { expandLastArg: true })),
+ ];
}
});
diff --git a/src/language-js/print/interface.js b/src/language-js/print/interface.js
index c6811babe..428fbd821 100644
--- a/src/language-js/print/interface.js
+++ b/src/language-js/print/interface.js
@@ -63,12 +63,10 @@ function printInterface(path, options, print) {
const printedExtends = extendsParts;
if (shouldIndentOnlyHeritageClauses) {
parts.push(
- group(
- partsGroup.concat(ifBreak(indent(printedExtends), printedExtends))
- )
+ group([...partsGroup, ifBreak(indent(printedExtends), printedExtends)])
);
} else {
- parts.push(group(indent(partsGroup.concat(printedExtends))));
+ parts.push(group(indent([...partsGroup, ...printedExtends])));
}
} else {
parts.push(...partsGroup, ...extendsParts);
diff --git a/src/language-js/print/object.js b/src/language-js/print/object.js
index e5c2b387d..c8ff9dc45 100644
--- a/src/language-js/print/object.js
+++ b/src/language-js/print/object.js
@@ -113,7 +113,7 @@ function printObject(path, options, print) {
const props = propsAndLoc
.sort((a, b) => a.loc - b.loc)
.map((prop) => {
- const result = separatorParts.concat(group(prop.printed));
+ const result = [...separatorParts, group(prop.printed)];
separatorParts = [separator, line];
if (
(prop.node.type === "TSPropertySignature" ||
@@ -147,9 +147,9 @@ function printObject(path, options, print) {
"...",
];
} else {
- printed = "...";
+ printed = ["..."];
}
- props.push(separatorParts.concat(printed));
+ props.push([...separatorParts, ...printed]);
}
const lastElem = getLast(n[propertiesField]);
diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js
index 5253a265a..a2fc6dbd5 100644
--- a/src/language-js/printer-estree.js
+++ b/src/language-js/printer-estree.js
@@ -193,7 +193,7 @@ function genericPrint(path, options, printPath, args) {
}
if (decorators.length > 0) {
- return group(decorators.concat(parts));
+ return group([...decorators, ...parts]);
}
return parts;
}
diff --git a/src/language-markdown/index.js b/src/language-markdown/index.js
index 318a691a4..994023c43 100644
--- a/src/language-markdown/index.js
+++ b/src/language-markdown/index.js
@@ -9,7 +9,7 @@ const languages = [
since: "1.8.0",
parsers: ["markdown"],
vscodeLanguageIds: ["markdown"],
- filenames: data.filenames.concat(["README"]),
+ filenames: [...data.filenames, "README"],
extensions: data.extensions.filter((extension) => extension !== ".mdx"),
})),
createLanguage(require("linguist-languages/data/Markdown.json"), () => ({
diff --git a/src/language-markdown/parser-markdown.js b/src/language-markdown/parser-markdown.js
index 67008abaf..494b77977 100644
--- a/src/language-markdown/parser-markdown.js
+++ b/src/language-markdown/parser-markdown.js
@@ -64,7 +64,7 @@ function htmlToJsx() {
function frontMatter() {
const proto = this.Parser.prototype;
- proto.blockMethods = ["frontMatter"].concat(proto.blockMethods);
+ proto.blockMethods = ["frontMatter", ...proto.blockMethods];
proto.blockTokenizers.frontMatter = tokenizer;
function tokenizer(eat, value) {
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
index 0b1b02fb1..d9db1dc3c 100644
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -522,7 +522,7 @@ function getNthSiblingIndex(node, parentNode, condition) {
}
function getAncestorCounter(path, typeOrTypes) {
- const types = [].concat(typeOrTypes);
+ const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
let counter = -1;
let ancestorNode;
@@ -840,8 +840,18 @@ function shouldRemainTheSameContent(path) {
);
}
-function printUrl(url, dangerousCharOrChars) {
- const dangerousChars = [" "].concat(dangerousCharOrChars || []);
+/**
+ * @param {string} url
+ * @param {string[] | string} [dangerousCharOrChars]
+ * @returns {string}
+ */
+function printUrl(url, dangerousCharOrChars = []) {
+ const dangerousChars = [
+ " ",
+ ...(Array.isArray(dangerousCharOrChars)
+ ? dangerousCharOrChars
+ : [dangerousCharOrChars]),
+ ];
return new RegExp(dangerousChars.map((x) => `\\${x}`).join("|")).test(url)
? `<${url}>`
: url;
diff --git a/src/language-markdown/utils.js b/src/language-markdown/utils.js
index 5520e7574..8d839260c 100644
--- a/src/language-markdown/utils.js
+++ b/src/language-markdown/utils.js
@@ -28,11 +28,12 @@ const INLINE_NODE_TYPES = [
"inlineMath",
];
-const INLINE_NODE_WRAPPER_TYPES = INLINE_NODE_TYPES.concat([
+const INLINE_NODE_WRAPPER_TYPES = [
+ ...INLINE_NODE_TYPES,
"tableCell",
"paragraph",
"heading",
-]);
+];
const kRegex = new RegExp(kPattern);
const punctuationRegex = new RegExp(punctuationPattern);
@@ -208,7 +209,7 @@ function mapAst(ast, handler) {
const newNode = { ...handler(node, index, parentStack) };
if (newNode.children) {
newNode.children = newNode.children.map((child, index) =>
- preorder(child, index, [newNode].concat(parentStack))
+ preorder(child, index, [newNode, ...parentStack])
);
}
diff --git a/src/language-yaml/printer-yaml.js b/src/language-yaml/printer-yaml.js
index bf6da30b5..3e2510d67 100644
--- a/src/language-yaml/printer-yaml.js
+++ b/src/language-yaml/printer-yaml.js
@@ -241,7 +241,7 @@ function printNode(node, parentNode, path, options, print) {
];
}
case "directive":
- return ["%", join(" ", [node.name].concat(node.parameters))];
+ return ["%", join(" ", [node.name, ...node.parameters])];
case "comment":
return ["#", node.value];
case "alias":
diff --git a/src/language-yaml/utils.js b/src/language-yaml/utils.js
index a413cbf6a..2151c65bc 100644
--- a/src/language-yaml/utils.js
+++ b/src/language-yaml/utils.js
@@ -227,8 +227,11 @@ function getFlowScalarLineContents(nodeType, content, options) {
getLast(getLast(reduced)).endsWith("\\")
)
)
- ? reduced.concat([reduced.pop().concat(lineContentWords)])
- : reduced.concat([lineContentWords]),
+ ? [
+ ...reduced.slice(0, -1),
+ [...getLast(reduced), ...lineContentWords],
+ ]
+ : [...reduced, lineContentWords],
[]
)
.map((lineContentWords) =>
@@ -281,8 +284,11 @@ function getBlockValueLineContents(
lineContentWords.length > 0 &&
!/^\s/.test(lineContentWords[0]) &&
!/^\s|\s$/.test(getLast(reduced))
- ? reduced.concat([reduced.pop().concat(lineContentWords)])
- : reduced.concat([lineContentWords]),
+ ? [
+ ...reduced.slice(0, -1),
+ [...getLast(reduced), ...lineContentWords],
+ ]
+ : [...reduced, lineContentWords],
[]
)
.map((lineContentWords) =>
@@ -290,8 +296,8 @@ function getBlockValueLineContents(
(reduced, word) =>
// disallow trailing spaces
reduced.length > 0 && /\s$/.test(getLast(reduced))
- ? reduced.concat(reduced.pop() + " " + word)
- : reduced.concat(word),
+ ? [...reduced.slice(0, -1), getLast(reduced) + " " + word]
+ : [...reduced, word],
[]
)
)
diff --git a/src/main/comments.js b/src/main/comments.js
index a0476f577..0594d931e 100644
--- a/src/main/comments.js
+++ b/src/main/comments.js
@@ -581,11 +581,10 @@ function printComments(path, print, options, needsSemi) {
}
}, "comments");
- return prependCursorPlaceholder(
- path,
- options,
- leadingParts.concat(trailingParts)
- );
+ return prependCursorPlaceholder(path, options, [
+ ...leadingParts,
+ ...trailingParts,
+ ]);
}
function ensureAllCommentsPrinted(astComments) {
diff --git a/src/main/options-normalizer.js b/src/main/options-normalizer.js
index d8438aac9..4c6d0c16e 100644
--- a/src/main/options-normalizer.js
+++ b/src/main/options-normalizer.js
@@ -205,7 +205,7 @@ function optionInfoToSchema(optionInfo, { isCLI, optionInfos }) {
return optionInfo.array
? vnopts.ArraySchema.create({
- ...(isCLI ? { preprocess: (v) => [].concat(v) } : {}),
+ ...(isCLI ? { preprocess: (v) => (Array.isArray(v) ? v : [v]) } : {}),
...handlers,
valueSchema: SchemaConstructor.create(parameters),
})
diff --git a/src/main/support.js b/src/main/support.js
index 8bff0cf03..a6aa0d83f 100644
--- a/src/main/support.js
+++ b/src/main/support.js
@@ -30,7 +30,7 @@ function getSupportInfo({
const version = currentVersion.split("-", 1)[0];
const languages = plugins
- .reduce((all, plugin) => all.concat(plugin.languages || []), [])
+ .reduce((all, plugin) => [...all, ...(plugin.languages || [])], [])
.filter(filterSince);
const options = arrayify(
diff --git a/tests_config/utils/create-snapshot.js b/tests_config/utils/create-snapshot.js
index 0db847e48..0a5eb8755 100644
--- a/tests_config/utils/create-snapshot.js
+++ b/tests_config/utils/create-snapshot.js
@@ -25,23 +25,23 @@ function createSnapshot(input, output, options, { codeOffset }) {
const separatorWidth = 80;
const printWidthIndicator =
options.printWidth > 0 && Number.isFinite(options.printWidth)
- ? (codeOffset ? " ".repeat(codeOffset - 1) + "|" : "") +
- " ".repeat(options.printWidth) +
- "| printWidth"
+ ? [
+ (codeOffset ? " ".repeat(codeOffset - 1) + "|" : "") +
+ " ".repeat(options.printWidth) +
+ "| printWidth",
+ ]
: [];
return raw(
- []
- .concat(
- printSeparator(separatorWidth, "options"),
- printOptions(options),
- printWidthIndicator,
- printSeparator(separatorWidth, "input"),
- input,
- printSeparator(separatorWidth, "output"),
- output,
- printSeparator(separatorWidth)
- )
- .join("\n")
+ [
+ printSeparator(separatorWidth, "options"),
+ printOptions(options),
+ ...printWidthIndicator,
+ printSeparator(separatorWidth, "input"),
+ input,
+ printSeparator(separatorWidth, "output"),
+ output,
+ printSeparator(separatorWidth),
+ ].join("\n")
);
}
diff --git a/tests_integration/runPrettier.js b/tests_integration/runPrettier.js
index 8440f1157..7ebb7f7e7 100644
--- a/tests_integration/runPrettier.js
+++ b/tests_integration/runPrettier.js
@@ -6,9 +6,8 @@ const stripAnsi = require("strip-ansi");
const { SynchronousPromise } = require("synchronous-promise");
const { prettierCli, thirdParty } = require("./env");
-function runPrettier(dir, args, options) {
- args = args || [];
- options = options || {};
+function runPrettier(dir, args = [], options = {}) {
+ args = Array.isArray(args) ? args : [args];
let status;
let stdout = "";
@@ -66,7 +65,7 @@ function runPrettier(dir, args, options) {
process.chdir(normalizeDir(dir));
process.stdin.isTTY = !!options.isTTY;
process.stdout.isTTY = !!options.stdoutIsTTY;
- process.argv = ["path/to/node", "path/to/prettier/bin"].concat(args);
+ process.argv = ["path/to/node", "path/to/prettier/bin", ...args];
jest.resetModules();
diff --git a/website/playground/markdown.js b/website/playground/markdown.js
index e50065555..9a1214b00 100644
--- a/website/playground/markdown.js
+++ b/website/playground/markdown.js
@@ -22,11 +22,11 @@ function formatMarkdown(
"",
"**Output:**",
codeBlock(output, syntax),
+ ...(isIdempotent
+ ? []
+ : ["", "**Second Output:**", codeBlock(output2, syntax)]),
+ ...(full ? ["", "**Expected behavior:**", ""] : []),
]
- .concat(
- isIdempotent ? [] : ["", "**Second Output:**", codeBlock(output2, syntax)]
- )
- .concat(full ? ["", "**Expected behavior:**", ""] : [])
.filter((part) => part != null)
.join("\n");
}
From 89e5751b46970284b34e0848e677391300e22d5c Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Tue, 26 Jan 2021 09:48:31 +0800
Subject: [PATCH 012/237] Use `Object.{entries,values}` if possible (#10131)
---
src/cli/expand-patterns.js | 6 +++---
src/cli/option.js | 13 +++++++------
src/cli/usage.js | 7 ++-----
src/language-html/ast.js | 15 +++++++++------
src/language-html/utils.js | 4 ++--
src/language-js/utils.js | 2 +-
src/main/comments.js | 6 +++---
src/main/massage-ast.js | 6 +++---
src/main/options.js | 4 ++--
9 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js
index 424f69aa7..d37ed34f5 100644
--- a/src/cli/expand-patterns.js
+++ b/src/cli/expand-patterns.js
@@ -55,9 +55,9 @@ function* expandPatternsInternal(context) {
const globOptions = {
dot: true,
- ignore: Object.keys(silentlyIgnoredDirs)
- .filter((dir) => silentlyIgnoredDirs[dir])
- .map((dir) => "**/" + dir),
+ ignore: Object.entries(silentlyIgnoredDirs)
+ .filter(([, ignored]) => ignored)
+ .map(([dir]) => "**/" + dir),
};
let supportedFilesGlob;
diff --git a/src/cli/option.js b/src/cli/option.js
index b71726382..5533e9666 100644
--- a/src/cli/option.js
+++ b/src/cli/option.js
@@ -20,13 +20,14 @@ function getOptions(argv, detailedOptions) {
}
function cliifyOptions(object, apiDetailedOptionMap) {
- return Object.keys(object || {}).reduce((output, key) => {
- const apiOption = apiDetailedOptionMap[key];
- const cliKey = apiOption ? apiOption.name : key;
+ return fromPairs(
+ Object.entries(object || {}).map(([key, value]) => {
+ const apiOption = apiDetailedOptionMap[key];
+ const cliKey = apiOption ? apiOption.name : key;
- output[dashify(cliKey)] = object[key];
- return output;
- }, {});
+ return [dashify(cliKey), value];
+ })
+ );
}
function createApiDetailedOptionMap(detailedOptions) {
diff --git a/src/cli/usage.js b/src/cli/usage.js
index 151de5a6a..2685b3bc6 100644
--- a/src/cli/usage.js
+++ b/src/cli/usage.js
@@ -176,11 +176,8 @@ function createDetailedUsage(context, flag) {
const pluginDefaults =
option.pluginDefaults && Object.keys(option.pluginDefaults).length > 0
- ? `\nPlugin defaults:${Object.keys(option.pluginDefaults).map(
- (key) =>
- `\n* ${key}: ${createDefaultValueDisplay(
- option.pluginDefaults[key]
- )}`
+ ? `\nPlugin defaults:${Object.entries(option.pluginDefaults).map(
+ ([key, value]) => `\n* ${key}: ${createDefaultValueDisplay(value)}`
)}`
: "";
return `${header}${description}${choices}${defaults}${pluginDefaults}`;
diff --git a/src/language-html/ast.js b/src/language-html/ast.js
index f612f67be..52b709ac6 100644
--- a/src/language-html/ast.js
+++ b/src/language-html/ast.js
@@ -1,5 +1,6 @@
"use strict";
+const fromPairs = require("lodash/fromPairs");
const { isNonEmptyArray } = require("../common/util");
const NODES_KEYS = {
attrs: true,
@@ -8,8 +9,7 @@ const NODES_KEYS = {
class Node {
constructor(props = {}) {
- for (const key of Object.keys(props)) {
- const value = props[key];
+ for (const [key, value] of Object.entries(props)) {
if (key in NODES_KEYS) {
this._setNodes(key, value);
} else {
@@ -123,10 +123,13 @@ function cloneAndUpdateNodes(nodes, parent) {
}
function setNonEnumerableProperties(obj, props) {
- const descriptors = Object.keys(props).reduce((reduced, key) => {
- reduced[key] = { value: props[key], enumerable: false };
- return reduced;
- }, {});
+ const descriptors = fromPairs(
+ Object.entries(props).map(([key, value]) => [
+ key,
+ { value, enumerable: false },
+ ])
+ );
+
Object.defineProperties(obj, descriptors);
}
diff --git a/src/language-html/utils.js b/src/language-html/utils.js
index e4ac2446f..06b85e362 100644
--- a/src/language-html/utils.js
+++ b/src/language-html/utils.js
@@ -46,8 +46,8 @@ function arrayToMap(array) {
function mapObject(object, fn) {
const newObject = Object.create(null);
- for (const key of Object.keys(object)) {
- newObject[key] = fn(object[key], key);
+ for (const [key, value] of Object.entries(object)) {
+ newObject[key] = fn(value, key);
}
return newObject;
}
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index 56eceef21..744685678 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -87,7 +87,7 @@ function hasNode(node, fn) {
const result = fn(node);
return typeof result === "boolean"
? result
- : Object.keys(node).some((key) => hasNode(node[key], fn));
+ : Object.values(node).some((value) => hasNode(value, fn));
}
/**
diff --git a/src/main/comments.js b/src/main/comments.js
index 0594d931e..45bd8abfd 100644
--- a/src/main/comments.js
+++ b/src/main/comments.js
@@ -50,16 +50,16 @@ function getSortedChildNodes(node, options, resultArray) {
(printer.getCommentChildNodes &&
printer.getCommentChildNodes(node, options)) ||
(typeof node === "object" &&
- Object.keys(node)
+ Object.entries(node)
.filter(
- (n) =>
+ ([n]) =>
n !== "enclosingNode" &&
n !== "precedingNode" &&
n !== "followingNode" &&
n !== "tokens" &&
n !== "comments"
)
- .map((n) => node[n]));
+ .map(([, value]) => value));
if (!childNodes) {
return;
diff --git a/src/main/massage-ast.js b/src/main/massage-ast.js
index f2ce7beb7..784b568e9 100644
--- a/src/main/massage-ast.js
+++ b/src/main/massage-ast.js
@@ -18,9 +18,9 @@ function massageAST(ast, options, parent) {
}
const newObj = {};
- for (const key of Object.keys(ast)) {
- if (!ignoredProperties.has(key) && typeof ast[key] !== "function") {
- newObj[key] = massageAST(ast[key], options, ast);
+ for (const [key, value] of Object.entries(ast)) {
+ if (!ignoredProperties.has(key) && typeof value !== "function") {
+ newObj[key] = massageAST(value, options, ast);
}
}
diff --git a/src/main/options.js b/src/main/options.js
index 544f31e26..fecf5834d 100644
--- a/src/main/options.js
+++ b/src/main/options.js
@@ -86,9 +86,9 @@ function normalize(options, opts) {
const mixedDefaults = { ...defaults, ...pluginDefaults };
- for (const k of Object.keys(mixedDefaults)) {
+ for (const [k, value] of Object.entries(mixedDefaults)) {
if (rawOptions[k] == null) {
- rawOptions[k] = mixedDefaults[k];
+ rawOptions[k] = value;
}
}
From e8a5d867cde1d487780c7dfd93c4130b942823a3 Mon Sep 17 00:00:00 2001
From: fisker
Date: Tue, 26 Jan 2021 09:54:20 +0800
Subject: [PATCH 013/237] Use `...` instead of `.concat()`
---
src/utils/front-matter.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/utils/front-matter.js b/src/utils/front-matter.js
index ac918cb43..06e7ffc6c 100644
--- a/src/utils/front-matter.js
+++ b/src/utils/front-matter.js
@@ -16,8 +16,7 @@ const DELIMITER_MAP = {
function parse(text) {
const startDelimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
- const endDelimiterRegex = Object.keys(DELIMITER_MAP)
- .concat(YAML_END_DELIMITER)
+ const endDelimiterRegex = [...Object.keys(DELIMITER_MAP), YAML_END_DELIMITER]
.map(escape)
.join("|");
From 59dfc0f3f387f26c8eeb92c2cef3d5d3f9c4b686 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 26 Jan 2021 05:56:42 +0000
Subject: [PATCH 014/237] Build(deps): Bump
@typescript-eslint/typescript-estree (#10137)
---
package.json | 2 +-
yarn.lock | 27 ++++++++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/package.json b/package.json
index 0bb146ddf..4c564541a 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.73.2",
"@iarna/toml": "2.2.5",
- "@typescript-eslint/typescript-estree": "4.14.0",
+ "@typescript-eslint/typescript-estree": "4.14.1",
"angular-estree-parser": "2.3.0",
"angular-html-parser": "1.7.1",
"camelcase": "6.2.0",
diff --git a/yarn.lock b/yarn.lock
index aa3f01fef..f3f3d228b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1628,6 +1628,11 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.0.tgz#d8a8202d9b58831d6fd9cee2ba12f8a5a5dd44b6"
integrity sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==
+"@typescript-eslint/types@4.14.1":
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa"
+ integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==
+
"@typescript-eslint/typescript-estree@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f"
@@ -1642,13 +1647,13 @@
semver "^7.3.2"
tsutils "^3.17.1"
-"@typescript-eslint/typescript-estree@4.14.0":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz#4bcd67486e9acafc3d0c982b23a9ab8ac8911ed7"
- integrity sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==
+"@typescript-eslint/typescript-estree@4.14.1":
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b"
+ integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==
dependencies:
- "@typescript-eslint/types" "4.14.0"
- "@typescript-eslint/visitor-keys" "4.14.0"
+ "@typescript-eslint/types" "4.14.1"
+ "@typescript-eslint/visitor-keys" "4.14.1"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
@@ -1664,12 +1669,12 @@
"@typescript-eslint/types" "4.0.1"
eslint-visitor-keys "^2.0.0"
-"@typescript-eslint/visitor-keys@4.14.0":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz#b1090d9d2955b044b2ea2904a22496849acbdf54"
- integrity sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==
+"@typescript-eslint/visitor-keys@4.14.1":
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91"
+ integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==
dependencies:
- "@typescript-eslint/types" "4.14.0"
+ "@typescript-eslint/types" "4.14.1"
eslint-visitor-keys "^2.0.0"
"@webassemblyjs/ast@1.11.0":
From c5484f7a0a389d1c98839c93286150837798a1d8 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Tue, 26 Jan 2021 18:56:42 +0200
Subject: [PATCH 015/237] website: bigger font for in blog (#10142)
---
website/static/overrides.css | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/website/static/overrides.css b/website/static/overrides.css
index 01b87f2b4..114606cc4 100644
--- a/website/static/overrides.css
+++ b/website/static/overrides.css
@@ -513,6 +513,10 @@ a {
margin-top: 10px;
}
+.mainContainer .wrapper .post h5 {
+ font-size: 1.125em;
+}
+
.hljs {
padding: 16px;
overflow: auto;
From 27f91167d4069a9cd36e95efffa245a8053f9af0 Mon Sep 17 00:00:00 2001
From: xrkffgg
Date: Wed, 27 Jan 2021 01:34:23 +0800
Subject: [PATCH 016/237] CI: Add `Mark issue duplicate` job (#10140)
Co-authored-by: fisker Cheung
---
.github/workflows/mark-issue-duplicate.yml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 .github/workflows/mark-issue-duplicate.yml
diff --git a/.github/workflows/mark-issue-duplicate.yml b/.github/workflows/mark-issue-duplicate.yml
new file mode 100644
index 000000000..f181aaa47
--- /dev/null
+++ b/.github/workflows/mark-issue-duplicate.yml
@@ -0,0 +1,17 @@
+name: Mark Issue Duplicate
+
+on:
+ issue_comment:
+ types:
+ - created
+
+jobs:
+ mark-duplicate:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions-cool/issues-helper@v2.0.0
+ with:
+ actions: "mark-duplicate"
+ token: ${{ secrets.GITHUB_TOKEN }}
+ duplicate-labels: "type:duplicate"
+ close-issue: true
From cdab1d739294abc20e2be97102a4d50c98b736f3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 27 Jan 2021 02:13:26 +0800
Subject: [PATCH 017/237] Build(deps-dev): Bump @typescript-eslint/types from
4.14.0 to 4.14.1 (#10138)
Bumps [@typescript-eslint/types](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/visitor-keys) from 4.14.0 to 4.14.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/visitor-keys/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.14.1/packages/visitor-keys)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/package.json b/package.json
index 4c564541a..c28ea3b99 100644
--- a/package.json
+++ b/package.json
@@ -97,7 +97,7 @@
"@rollup/plugin-replace": "2.3.4",
"@types/estree": "0.0.46",
"@types/node": "14.14.0",
- "@typescript-eslint/types": "4.14.0",
+ "@typescript-eslint/types": "4.14.1",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"benchmark": "2.1.4",
diff --git a/yarn.lock b/yarn.lock
index f3f3d228b..9fa82137c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1623,11 +1623,6 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2"
integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==
-"@typescript-eslint/types@4.14.0":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.0.tgz#d8a8202d9b58831d6fd9cee2ba12f8a5a5dd44b6"
- integrity sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==
-
"@typescript-eslint/types@4.14.1":
version "4.14.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa"
From 343d372845d0c89ddee9627b9061d7872652f727 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Tue, 26 Jan 2021 20:17:30 +0200
Subject: [PATCH 018/237] Document that Prettier never unquotes numeric
properties in TS and Flow (#10126)
* Document that Prettier never unquotes numeric properties in TS and Flow
* Add Angular
* Mention Vue
---
docs/options.md | 7 +++++++
website/versioned_docs/version-stable/options.md | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/docs/options.md b/docs/options.md
index 5a2bae808..aad2334b8 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -89,6 +89,13 @@ Valid options:
| ------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `"as-needed"` | --quote-props | quoteProps: "" |
+Note that Prettier never unquotes numeric property names in Angular expressions, TypeScript, and Flow because the distinction between string and numeric keys is significant in these languages. See: [Angular][quote-props-angular], [TypeScript][quote-props-typescript], [Flow][quote-props-flow]. Also Prettier doesnβt unquote numeric properties for Vue (see the [issue][quote-props-vue] about that).
+
+[quote-props-angular]: https://codesandbox.io/s/hungry-morse-foj87?file=/src/app/app.component.html
+[quote-props-typescript]: https://www.typescriptlang.org/play?#code/DYUwLgBAhhC8EG8IEYBcKA0EBM7sQF8AoUSAIzkQgHJlr1ktrt6dCiiATEAY2CgBOICKWhR0AaxABPAPYAzCGGkAHEAugBuLr35CR4CGTKSZG5Wo1ltRKDHjHtQA
+[quote-props-flow]: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjOA7AzgFzAA8wBeMAb1TDAAYAuMARlQF8g
+[quote-props-vue]: https://github.com/prettier/prettier/issues/10127
+
## JSX Quotes
Use single quotes instead of double quotes in JSX.
diff --git a/website/versioned_docs/version-stable/options.md b/website/versioned_docs/version-stable/options.md
index 7fa1fa36d..38ebdad44 100644
--- a/website/versioned_docs/version-stable/options.md
+++ b/website/versioned_docs/version-stable/options.md
@@ -90,6 +90,13 @@ Valid options:
| ------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `"as-needed"` | --quote-props | quoteProps: "" |
+Note that Prettier never unquotes numeric property names in Angular expressions, TypeScript, and Flow because the distinction between string and numeric keys is significant in these languages. See: [Angular][quote-props-angular], [TypeScript][quote-props-typescript], [Flow][quote-props-flow]. Also Prettier doesnβt unquote numeric properties for Vue (see the [issue][quote-props-vue] about that).
+
+[quote-props-angular]: https://codesandbox.io/s/hungry-morse-foj87?file=/src/app/app.component.html
+[quote-props-typescript]: https://www.typescriptlang.org/play?#code/DYUwLgBAhhC8EG8IEYBcKA0EBM7sQF8AoUSAIzkQgHJlr1ktrt6dCiiATEAY2CgBOICKWhR0AaxABPAPYAzCGGkAHEAugBuLr35CR4CGTKSZG5Wo1ltRKDHjHtQA
+[quote-props-flow]: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjOA7AzgFzAA8wBeMAb1TDAAYAuMARlQF8g
+[quote-props-vue]: https://github.com/prettier/prettier/issues/10127
+
## JSX Quotes
Use single quotes instead of double quotes in JSX.
From a98292e417622f1aa5fe62579aa0f35fa0571a6b Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Wed, 27 Jan 2021 07:11:53 +0800
Subject: [PATCH 019/237] Simplify frontMatter parse (#10136)
* Simplify frontMatter parse
* Rewrite regex to @thorn0's version
---
src/utils/front-matter.js | 58 +++++++++++++++------------------------
1 file changed, 22 insertions(+), 36 deletions(-)
diff --git a/src/utils/front-matter.js b/src/utils/front-matter.js
index 06e7ffc6c..0d026924e 100644
--- a/src/utils/front-matter.js
+++ b/src/utils/front-matter.js
@@ -1,55 +1,40 @@
"use strict";
-const escape = require("escape-string-regexp");
const {
builders: { hardline, markAsRoot },
} = require("../document");
-const YAML_DELIMITER = "---";
-// In some markdown processors such as pandoc,
-// "..." can be used as the end delimiter for YAML front-matter.
-const YAML_END_DELIMITER = "...";
-const DELIMITER_MAP = {
- [YAML_DELIMITER]: "yaml",
- "+++": "toml",
-};
+const frontMatterRegex = new RegExp(
+ "^(?-{3}|\\+{3})" +
+ // trailing spaces after delimiters are allowed
+ "(?[^\\n]*)" +
+ "\\n(?:|(?[\\S\\s]*?)\\n)" +
+ // In some markdown processors such as pandoc,
+ // "..." can be used as the end delimiter for YAML front-matter.
+ // Adding `\.{3}` make the regex matches `+++\n...`, but we'll exclude it later
+ "(?\\k|\\.{3})" +
+ "[^\\S\\n]*(?:\\n|$)"
+);
function parse(text) {
- const startDelimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
- const endDelimiterRegex = [...Object.keys(DELIMITER_MAP), YAML_END_DELIMITER]
- .map(escape)
- .join("|");
-
- const match = text.match(
- // trailing spaces after delimiters are allowed
- new RegExp(
- `^(${startDelimiterRegex})([^\\n]*)\\n(?:|([\\s\\S]*?)\\n)(${endDelimiterRegex})[^\\n\\S]*(\\n|$)`
- )
- );
-
- if (match === null) {
- return { frontMatter: null, content: text };
+ const match = text.match(frontMatterRegex);
+ if (!match) {
+ return { content: text };
}
- const [raw, startDelimiter, language, value = "", endDelimiter] = match;
+ const { startDelimiter, language, value = "", endDelimiter } = match.groups;
- let lang = DELIMITER_MAP[startDelimiter];
- if (lang !== "toml" && language && language.trim()) {
- lang = language.trim();
+ let lang = language.trim() || "yaml";
+ if (startDelimiter === "+++") {
+ lang = "toml";
}
// Only allow yaml to parse with a different end delimiter
- if (
- startDelimiter !== endDelimiter &&
- !(
- lang === "yaml" &&
- startDelimiter === YAML_DELIMITER &&
- endDelimiter === YAML_END_DELIMITER
- )
- ) {
- return { frontMatter: null, content: text };
+ if (lang !== "yaml" && startDelimiter !== endDelimiter) {
+ return { content: text };
}
+ const [raw] = match;
const frontMatter = {
type: "front-matter",
lang,
@@ -58,6 +43,7 @@ function parse(text) {
endDelimiter,
raw: raw.replace(/\n$/, ""),
};
+
return {
frontMatter,
content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length),
From 1df287acc802939edfd5eed3ffabf3979a8cc3ae Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 27 Jan 2021 06:36:39 +0200
Subject: [PATCH 020/237] Use default parameters where possible and other
microrefactoring (#10135)
---
cspell.json | 1 +
src/common/util.js | 10 ++----
src/document/doc-builders.js | 8 ++---
src/language-markdown/printer-markdown.js | 6 +---
src/language-markdown/utils.js | 4 +--
src/main/core.js | 44 ++++++++++++-----------
src/main/options.js | 4 +--
src/main/parser.js | 4 +--
tests_config/utils/create-snapshot.js | 3 +-
tests_integration/runPrettier.js | 2 --
10 files changed, 35 insertions(+), 51 deletions(-)
diff --git a/cspell.json b/cspell.json
index c6c7c29d6..8edacecc9 100644
--- a/cspell.json
+++ b/cspell.json
@@ -105,6 +105,7 @@
"elektronik",
"Eneman",
"ENOENT",
+ "eqeqeq",
"Ericsburgh",
"errored",
"Esben",
diff --git a/src/common/util.js b/src/common/util.js
index ca986ee3b..fe7c180f0 100644
--- a/src/common/util.js
+++ b/src/common/util.js
@@ -164,8 +164,7 @@ function skipNewline(text, index, opts) {
* @param {SkipOptions=} opts
* @returns {boolean}
*/
-function hasNewline(text, index, opts) {
- opts = opts || {};
+function hasNewline(text, index, opts = {}) {
const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
const idx2 = skipNewline(text, idx, opts);
return idx !== idx2;
@@ -292,8 +291,7 @@ function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
* @param {SkipOptions=} opts
* @returns {boolean}
*/
-function hasSpaces(text, index, opts) {
- opts = opts || {};
+function hasSpaces(text, index, opts = {}) {
const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
return idx !== index;
}
@@ -304,9 +302,7 @@ function hasSpaces(text, index, opts) {
* @param {number=} startIndex
* @returns {number}
*/
-function getAlignmentSize(value, tabWidth, startIndex) {
- startIndex = startIndex || 0;
-
+function getAlignmentSize(value, tabWidth, startIndex = 0) {
let size = 0;
for (let i = startIndex; i < value.length; ++i) {
if (value[i] === "\t") {
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index a875f9be0..ad08e1775 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -86,9 +86,7 @@ function align(n, contents) {
* @param {object} [opts] - TBD ???
* @returns Doc
*/
-function group(contents, opts) {
- opts = opts || {};
-
+function group(contents, opts = {}) {
if (process.env.NODE_ENV !== "production") {
assertDoc(contents);
}
@@ -156,9 +154,7 @@ function fill(parts) {
* @param {object} [opts] - TBD ???
* @returns Doc
*/
-function ifBreak(breakContents, flatContents, opts) {
- opts = opts || {};
-
+function ifBreak(breakContents, flatContents, opts = {}) {
if (process.env.NODE_ENV !== "production") {
if (breakContents) {
assertDoc(breakContents);
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
index d9db1dc3c..c31e1b394 100644
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -504,8 +504,6 @@ function getNthListSiblingIndex(node, parentNode) {
}
function getNthSiblingIndex(node, parentNode, condition) {
- condition = condition || (() => true);
-
let index = -1;
for (const childNode of parentNode.children) {
@@ -698,9 +696,7 @@ function printRoot(path, options, print) {
});
}
-function printChildren(path, options, print, events) {
- events = events || {};
-
+function printChildren(path, options, print, events = {}) {
const { postprocessor } = events;
const processor = events.processor || ((childPath) => childPath.call(print));
diff --git a/src/language-markdown/utils.js b/src/language-markdown/utils.js
index 8d839260c..de21b4e60 100644
--- a/src/language-markdown/utils.js
+++ b/src/language-markdown/utils.js
@@ -204,8 +204,6 @@ function getFencedCodeBlockValue(node, originalText) {
function mapAst(ast, handler) {
return (function preorder(node, index, parentStack) {
- parentStack = parentStack || [];
-
const newNode = { ...handler(node, index, parentStack) };
if (newNode.children) {
newNode.children = newNode.children.map((child, index) =>
@@ -214,7 +212,7 @@ function mapAst(ast, handler) {
}
return newNode;
- })(ast, null, null);
+ })(ast, null, []);
}
function isAutolink(node) {
diff --git a/src/main/core.js b/src/main/core.js
index 511df6ce9..768433776 100644
--- a/src/main/core.js
+++ b/src/main/core.js
@@ -36,13 +36,11 @@ function attachComments(text, ast, opts) {
return astComments;
}
-function coreFormat(originalText, opts, addAlignmentSize) {
+function coreFormat(originalText, opts, addAlignmentSize = 0) {
if (!originalText || originalText.trim().length === 0) {
return { formatted: "", cursorOffset: -1 };
}
- addAlignmentSize = addAlignmentSize || 0;
-
const { ast, text } = parser.parse(originalText, opts);
if (opts.cursorOffset >= 0) {
@@ -181,8 +179,7 @@ function formatRange(originalText, opts) {
let { cursorOffset } = opts;
if (cursorOffset >= rangeEnd) {
// handle the case where the cursor was past the end of the range
- cursorOffset =
- opts.cursorOffset + (rangeTrimmed.length - rangeString.length);
+ cursorOffset += rangeTrimmed.length - rangeString.length;
} else if (rangeResult.cursorOffset >= 0) {
// handle the case where the cursor was in the range
cursorOffset = rangeResult.cursorOffset + rangeStart;
@@ -272,22 +269,21 @@ function normalizeInputAndOptions(text, options) {
};
}
-function format(originalText, originalOptions) {
+function hasPragma(text, options) {
+ const selectedParser = parser.resolveParser(options);
+ return !selectedParser.hasPragma || selectedParser.hasPragma(text);
+}
+
+function formatWithCursor(originalText, originalOptions) {
let { hasBOM, text, options } = normalizeInputAndOptions(
originalText,
normalizeOptions(originalOptions)
);
- if (options.rangeStart >= options.rangeEnd && text !== "") {
- return {
- formatted: originalText,
- cursorOffset: originalOptions.cursorOffset,
- };
- }
-
- const selectedParser = parser.resolveParser(options);
- const hasPragma = !selectedParser.hasPragma || selectedParser.hasPragma(text);
- if (options.requirePragma && !hasPragma) {
+ if (
+ (options.rangeStart >= options.rangeEnd && text !== "") ||
+ (options.requirePragma && !hasPragma(text, options))
+ ) {
return {
formatted: originalText,
cursorOffset: originalOptions.cursorOffset,
@@ -299,7 +295,12 @@ function format(originalText, originalOptions) {
if (options.rangeStart > 0 || options.rangeEnd < text.length) {
result = formatRange(text, options);
} else {
- if (!hasPragma && options.insertPragma && options.printer.insertPragma) {
+ if (
+ !options.requirePragma &&
+ options.insertPragma &&
+ options.printer.insertPragma &&
+ !hasPragma(text, options)
+ ) {
text = options.printer.insertPragma(text);
}
result = coreFormat(text, options);
@@ -317,7 +318,8 @@ function format(originalText, originalOptions) {
}
module.exports = {
- formatWithCursor: format,
+ formatWithCursor,
+
parse(originalText, originalOptions, massage) {
const { text, options } = normalizeInputAndOptions(
originalText,
@@ -338,8 +340,10 @@ module.exports = {
// Doesn't handle shebang for now
formatDoc(doc, options) {
- return format(printDocToDebug(doc), { ...options, parser: "babel" })
- .formatted;
+ return formatWithCursor(printDocToDebug(doc), {
+ ...options,
+ parser: "babel",
+ }).formatted;
},
printToDoc(originalText, options) {
diff --git a/src/main/options.js b/src/main/options.js
index fecf5834d..a12b5bcad 100644
--- a/src/main/options.js
+++ b/src/main/options.js
@@ -18,9 +18,7 @@ const hiddenDefaults = {
};
// Copy options and fill in default values.
-function normalize(options, opts) {
- opts = opts || {};
-
+function normalize(options, opts = {}) {
const rawOptions = { ...options };
const supportOptions = getSupportInfo({
diff --git a/src/main/parser.js b/src/main/parser.js
index ed354c653..65b31bc39 100644
--- a/src/main/parser.js
+++ b/src/main/parser.js
@@ -27,9 +27,7 @@ function getParsers(options) {
return parsers;
}
-function resolveParser(opts, parsers) {
- parsers = parsers || getParsers(opts);
-
+function resolveParser(opts, parsers = getParsers(opts)) {
if (typeof opts.parser === "function") {
// Custom parser API always works with JavaScript.
return {
diff --git a/tests_config/utils/create-snapshot.js b/tests_config/utils/create-snapshot.js
index 0a5eb8755..d700c305d 100644
--- a/tests_config/utils/create-snapshot.js
+++ b/tests_config/utils/create-snapshot.js
@@ -2,8 +2,7 @@
const raw = require("jest-snapshot-serializer-raw").wrap;
-function printSeparator(width, description) {
- description = description || "";
+function printSeparator(width, description = "") {
const leftLength = Math.floor((width - description.length) / 2);
const rightLength = width - leftLength - description.length;
return "=".repeat(leftLength) + description + "=".repeat(rightLength);
diff --git a/tests_integration/runPrettier.js b/tests_integration/runPrettier.js
index 7ebb7f7e7..50848a9bd 100644
--- a/tests_integration/runPrettier.js
+++ b/tests_integration/runPrettier.js
@@ -116,8 +116,6 @@ function runPrettier(dir, args = [], options = {}) {
const result = { status, stdout, stderr, write };
const testResult = (testOptions) => {
- testOptions = testOptions || {};
-
for (const name of Object.keys(result)) {
test(`(${name})`, () => {
const value =
From 63a771db55bcf5d81478e1cd593964118cb26f69 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 27 Jan 2021 10:06:03 +0200
Subject: [PATCH 021/237] Add parallel-prettier to "Related Projects" (#10147)
---
docs/related-projects.md | 1 +
website/versioned_docs/version-stable/related-projects.md | 1 +
2 files changed, 2 insertions(+)
diff --git a/docs/related-projects.md b/docs/related-projects.md
index 956232c3f..0f31a297f 100644
--- a/docs/related-projects.md
+++ b/docs/related-projects.md
@@ -28,6 +28,7 @@ title: Related Projects
## Misc
+- [parallel-prettier](https://github.com/microsoft/parallel-prettier) is an alternative CLI that formats files in parallel to speed up large projects
- [prettier_d](https://github.com/josephfrazier/prettier_d.js) runs Prettier as a server to avoid Node.js startup delay
- [pretty-quick](https://github.com/azz/pretty-quick) formats changed files with Prettier
- [rollup-plugin-prettier](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup
diff --git a/website/versioned_docs/version-stable/related-projects.md b/website/versioned_docs/version-stable/related-projects.md
index 2f5d185ef..30e7e663c 100644
--- a/website/versioned_docs/version-stable/related-projects.md
+++ b/website/versioned_docs/version-stable/related-projects.md
@@ -29,6 +29,7 @@ original_id: related-projects
## Misc
+- [parallel-prettier](https://github.com/microsoft/parallel-prettier) is an alternative CLI that formats files in parallel to speed up large projects
- [prettier_d](https://github.com/josephfrazier/prettier_d.js) runs Prettier as a server to avoid Node.js startup delay
- [pretty-quick](https://github.com/azz/pretty-quick) formats changed files with Prettier
- [rollup-plugin-prettier](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup
From 79d2f4a295c56f637c4d215f78e825bff817f428 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 27 Jan 2021 12:30:10 +0200
Subject: [PATCH 022/237] Add CLI flag for debugging comment attachment issues
(#10124)
---
changelog_unreleased/cli/10124.md | 3 ++
docs/plugins.md | 2 +
src/cli/constant.js | 3 ++
src/cli/format.js | 9 ++++
src/common/util.js | 18 +++++++
src/main/comments.js | 3 ++
src/main/core.js | 14 +++--
tests/js/cursor/jsfmt.spec.js | 10 ++--
.../debug-print-comments.js.snap | 51 +++++++++++++++++++
.../__tests__/debug-print-comments.js | 14 +++++
website/playground/EditorState.js | 2 +
website/playground/Playground.js | 21 +++++++-
website/playground/PrettierFormat.js | 12 ++++-
website/static/worker.js | 25 ++++++---
14 files changed, 169 insertions(+), 18 deletions(-)
create mode 100644 changelog_unreleased/cli/10124.md
create mode 100644 tests_integration/__tests__/__snapshots__/debug-print-comments.js.snap
create mode 100644 tests_integration/__tests__/debug-print-comments.js
diff --git a/changelog_unreleased/cli/10124.md b/changelog_unreleased/cli/10124.md
new file mode 100644
index 000000000..0c3f204e6
--- /dev/null
+++ b/changelog_unreleased/cli/10124.md
@@ -0,0 +1,3 @@
+#### Add CLI flag for debugging comment attachment issues (#10124 by @thorn0)
+
+A new `--debug-print-comments` CLI flag and corresponding functionality for the Playground.
diff --git a/docs/plugins.md b/docs/plugins.md
index 8795c1905..480dd79f4 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -351,6 +351,8 @@ Nodes with comments are expected to have a `comments` property containing an arr
The example above uses `util.addTrailingComment`, which automatically sets `comment.leading`/`trailing`/`printed` to appropriate values and adds the comment to the AST node's `comments` array.
+The `--debug-print-comments` CLI flag can help with debugging comment attachment issues. It prints a detailed list of comments, which includes information on how every comment was classified (`ownLine`/`endOfLine`/`remaining`, `leading`/`trailing`/`dangling`) and to which node it was attached. For Prettierβs built-in languages, this information is also available on the Playground (the 'show comments' checkbox in the Debug section).
+
### `options`
`options` is an object containing the custom options your plugin supports.
diff --git a/src/cli/constant.js b/src/cli/constant.js
index ff4321d9b..83a622863 100644
--- a/src/cli/constant.js
+++ b/src/cli/constant.js
@@ -132,6 +132,9 @@ const options = {
"debug-print-doc": {
type: "boolean",
},
+ "debug-print-comments": {
+ type: "boolean",
+ },
"debug-repeat": {
// Repeat the formatting a few times and measure the average duration.
type: "int",
diff --git a/src/cli/format.js b/src/cli/format.js
index 99e6f59d6..e54bf7cac 100644
--- a/src/cli/format.js
+++ b/src/cli/format.js
@@ -116,6 +116,15 @@ function format(context, input, opt) {
return { formatted: prettier.__debug.formatDoc(doc) };
}
+ if (context.argv["debug-print-comments"]) {
+ return {
+ formatted: prettier.format(
+ JSON.stringify(prettier.formatWithCursor(input, opt).comments || []),
+ { parser: "json" }
+ ),
+ };
+ }
+
if (context.argv["debug-check"]) {
const pp = prettier.format(input, opt);
const pppp = prettier.format(pp, opt);
diff --git a/src/common/util.js b/src/common/util.js
index fe7c180f0..30d1b2a99 100644
--- a/src/common/util.js
+++ b/src/common/util.js
@@ -557,6 +557,7 @@ function addCommentHelper(node, comment) {
const comments = node.comments || (node.comments = []);
comments.push(comment);
comment.printed = false;
+ comment.nodeDescription = describeNodeForDebugging(node);
}
function addLeadingComment(node, comment) {
@@ -638,6 +639,23 @@ function createGroupIdMapper(description) {
};
}
+function describeNodeForDebugging(node) {
+ const nodeType = node.type || node.kind || "(unknown type)";
+ let nodeName = String(
+ node.name ||
+ (node.id && (typeof node.id === "object" ? node.id.name : node.id)) ||
+ (node.key && (typeof node.key === "object" ? node.key.name : node.key)) ||
+ (node.value &&
+ (typeof node.value === "object" ? "" : String(node.value))) ||
+ node.operator ||
+ ""
+ );
+ if (nodeName.length > 20) {
+ nodeName = nodeName.slice(0, 19) + "β¦";
+ }
+ return nodeType + (nodeName ? " " + nodeName : "");
+}
+
module.exports = {
inferParserByLanguage,
replaceEndOfLineWith,
diff --git a/src/main/comments.js b/src/main/comments.js
index 45bd8abfd..3903278c3 100644
--- a/src/main/comments.js
+++ b/src/main/comments.js
@@ -224,6 +224,7 @@ function attach(comments, ast, text, options) {
}
if (isOwnLineComment(text, options, decoratedComments, index)) {
+ comment.placement = "ownLine";
// If a comment exists on its own line, prefer a leading comment.
// We also need to check if it's the first line of the file.
if (handleOwnLineComment(...args)) {
@@ -241,6 +242,7 @@ function attach(comments, ast, text, options) {
addDanglingComment(ast, comment);
}
} else if (isEndOfLineComment(text, options, decoratedComments, index)) {
+ comment.placement = "endOfLine";
if (handleEndOfLineComment(...args)) {
// We're good
} else if (precedingNode) {
@@ -257,6 +259,7 @@ function attach(comments, ast, text, options) {
addDanglingComment(ast, comment);
}
} else {
+ comment.placement = "remaining";
if (handleRemainingComment(...args)) {
// We're good
} else if (precedingNode && followingNode) {
diff --git a/src/main/core.js b/src/main/core.js
index 768433776..47f0d1e18 100644
--- a/src/main/core.js
+++ b/src/main/core.js
@@ -38,7 +38,7 @@ function attachComments(text, ast, opts) {
function coreFormat(originalText, opts, addAlignmentSize = 0) {
if (!originalText || originalText.trim().length === 0) {
- return { formatted: "", cursorOffset: -1 };
+ return { formatted: "", cursorOffset: -1, comments: [] };
}
const { ast, text } = parser.parse(originalText, opts);
@@ -102,6 +102,7 @@ function coreFormat(originalText, opts, addAlignmentSize = 0) {
return {
formatted: result.formatted,
cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
+ comments: astComments,
};
}
@@ -133,10 +134,14 @@ function coreFormat(originalText, opts, addAlignmentSize = 0) {
}
}
- return { formatted: result.formatted, cursorOffset };
+ return { formatted: result.formatted, cursorOffset, comments: astComments };
}
- return { formatted: result.formatted, cursorOffset: -1 };
+ return {
+ formatted: result.formatted,
+ cursorOffset: -1,
+ comments: astComments,
+ };
}
function formatRange(originalText, opts) {
@@ -200,7 +205,7 @@ function formatRange(originalText, opts) {
formatted = formatted.replace(/\n/g, eol);
}
- return { formatted, cursorOffset };
+ return { formatted, cursorOffset, comments: rangeResult.comments };
}
function ensureIndexInText(text, index, defaultValue) {
@@ -287,6 +292,7 @@ function formatWithCursor(originalText, originalOptions) {
return {
formatted: originalText,
cursorOffset: originalOptions.cursorOffset,
+ comments: [],
};
}
diff --git a/tests/js/cursor/jsfmt.spec.js b/tests/js/cursor/jsfmt.spec.js
index fb2b19fb7..841828427 100644
--- a/tests/js/cursor/jsfmt.spec.js
+++ b/tests/js/cursor/jsfmt.spec.js
@@ -5,7 +5,7 @@ const prettier = require("prettier-local");
test("translates cursor correctly in basic case", () => {
expect(
prettier.formatWithCursor(" 1", { parser: "babel", cursorOffset: 2 })
- ).toEqual({
+ ).toMatchObject({
formatted: "1;\n",
cursorOffset: 1,
});
@@ -15,7 +15,7 @@ test("positions cursor relative to closest node, not SourceElement", () => {
const code = "return 15";
expect(
prettier.formatWithCursor(code, { parser: "babel", cursorOffset: 15 })
- ).toEqual({
+ ).toMatchObject({
formatted: "return 15;\n",
cursorOffset: 7,
});
@@ -25,7 +25,7 @@ test("keeps cursor inside formatted node", () => {
const code = "return 15";
expect(
prettier.formatWithCursor(code, { parser: "babel", cursorOffset: 14 })
- ).toEqual({
+ ).toMatchObject({
formatted: "return 15;\n",
cursorOffset: 7,
});
@@ -38,7 +38,7 @@ foo('bar', cb => {
})`;
expect(
prettier.formatWithCursor(code, { parser: "babel", cursorOffset: 24 })
- ).toEqual({
+ ).toMatchObject({
formatted: `foo("bar", (cb) => {
console.log("stuff");
});
@@ -57,7 +57,7 @@ test("cursorOffset === rangeStart", () => {
rangeStart: 7,
rangeEnd: 8,
})
- ).toEqual({
+ ).toMatchObject({
formatted: "1.0000\n2.0;\n3.0000",
cursorOffset: 7,
});
diff --git a/tests_integration/__tests__/__snapshots__/debug-print-comments.js.snap b/tests_integration/__tests__/__snapshots__/debug-print-comments.js.snap
new file mode 100644
index 000000000..45e3f90c1
--- /dev/null
+++ b/tests_integration/__tests__/__snapshots__/debug-print-comments.js.snap
@@ -0,0 +1,51 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`prints information for debugging comment attachment with --debug-print-comments (stdout) 1`] = `
+"[
+ {
+ \\"type\\": \\"CommentBlock\\",
+ \\"value\\": \\" 1 \\",
+ \\"start\\": 0,
+ \\"end\\": 7,
+ \\"loc\\": {
+ \\"start\\": { \\"line\\": 1, \\"column\\": 0 },
+ \\"end\\": { \\"line\\": 1, \\"column\\": 7 }
+ },
+ \\"placement\\": \\"endOfLine\\",
+ \\"leading\\": true,
+ \\"trailing\\": false,
+ \\"nodeDescription\\": \\"ExpressionStatement\\"
+ },
+ {
+ \\"type\\": \\"CommentBlock\\",
+ \\"value\\": \\" 2 \\",
+ \\"start\\": 24,
+ \\"end\\": 31,
+ \\"loc\\": {
+ \\"start\\": { \\"line\\": 2, \\"column\\": 16 },
+ \\"end\\": { \\"line\\": 2, \\"column\\": 23 }
+ },
+ \\"placement\\": \\"remaining\\",
+ \\"leading\\": false,
+ \\"trailing\\": true,
+ \\"nodeDescription\\": \\"Identifier foo\\"
+ },
+ {
+ \\"type\\": \\"CommentLine\\",
+ \\"value\\": \\" 3\\",
+ \\"start\\": 34,
+ \\"end\\": 38,
+ \\"loc\\": {
+ \\"start\\": { \\"line\\": 2, \\"column\\": 26 },
+ \\"end\\": { \\"line\\": 2, \\"column\\": 30 }
+ },
+ \\"placement\\": \\"remaining\\",
+ \\"leading\\": false,
+ \\"trailing\\": true,
+ \\"nodeDescription\\": \\"ExpressionStatement\\"
+ }
+]
+"
+`;
+
+exports[`prints information for debugging comment attachment with --debug-print-comments (write) 1`] = `Array []`;
diff --git a/tests_integration/__tests__/debug-print-comments.js b/tests_integration/__tests__/debug-print-comments.js
new file mode 100644
index 000000000..73358ce26
--- /dev/null
+++ b/tests_integration/__tests__/debug-print-comments.js
@@ -0,0 +1,14 @@
+"use strict";
+
+const runPrettier = require("../runPrettier");
+
+describe("prints information for debugging comment attachment with --debug-print-comments", () => {
+ runPrettier(
+ "cli/with-shebang",
+ ["--debug-print-comments", "--parser", "babel"],
+ { input: "/* 1 */\nconsole.log(foo /* 2 */); // 3" }
+ ).test({
+ stderr: "",
+ status: 0,
+ });
+});
diff --git a/website/playground/EditorState.js b/website/playground/EditorState.js
index c56478bb6..08ad92371 100644
--- a/website/playground/EditorState.js
+++ b/website/playground/EditorState.js
@@ -10,10 +10,12 @@ export default class extends React.Component {
showSidebar: false,
showAst: false,
showDoc: false,
+ showComments: false,
showSecondFormat: false,
toggleSidebar: () => this.setState(stateToggler("showSidebar")),
toggleAst: () => this.setState(stateToggler("showAst")),
toggleDoc: () => this.setState(stateToggler("showDoc")),
+ toggleComments: () => this.setState(stateToggler("showComments")),
toggleSecondFormat: () => this.setState(stateToggler("showSecondFormat")),
...storage.get("editor_state"),
};
diff --git a/website/playground/Playground.js b/website/playground/Playground.js
index 01b41baad..16d5ad998 100644
--- a/website/playground/Playground.js
+++ b/website/playground/Playground.js
@@ -151,9 +151,14 @@ class Playground extends React.Component {
}
render() {
- const { worker } = this.props;
+ const { worker, version } = this.props;
const { content, options } = this.state;
+ // TODO: remove this when v2.3.0 is released
+ const [major, minor] = version.split(".", 2).map(Number);
+ const showShowComments =
+ Number.isNaN(major) || (major === 2 && minor >= 3) || major > 2;
+
return (
{(editorState) => (
@@ -163,6 +168,7 @@ class Playground extends React.Component {
options={options}
debugAst={editorState.showAst}
debugDoc={editorState.showDoc}
+ debugComments={showShowComments && editorState.showComments}
reformat={editorState.showSecondFormat}
>
{({ formatted, debug }) => {
@@ -223,6 +229,13 @@ class Playground extends React.Component {
checked={editorState.showDoc}
onChange={editorState.toggleDoc}
/>
+ {showShowComments && (
+
+ )}
) : null}
+ {showShowComments && editorState.showComments ? (
+
+ ) : null}
this.setState(result));
}
diff --git a/website/static/worker.js b/website/static/worker.js
index 9751137cc..8b06bd8ef 100644
--- a/website/static/worker.js
+++ b/website/static/worker.js
@@ -71,11 +71,14 @@ function handleMessage(message) {
const plugins = [{ parsers }];
options.plugins = plugins;
+ const formatResult = formatCode(message.code, options);
+
const response = {
- formatted: formatCode(message.code, options),
+ formatted: formatResult.formatted,
debug: {
ast: null,
doc: null,
+ comments: null,
reformatted: null,
},
};
@@ -92,7 +95,7 @@ function handleMessage(message) {
if (!errored) {
try {
- ast = formatCode(ast, { parser: "json", plugins });
+ ast = formatCode(ast, { parser: "json", plugins }).formatted;
} catch (e) {
ast = serializeAst(ast);
}
@@ -111,8 +114,18 @@ function handleMessage(message) {
}
}
+ if (message.debug.comments) {
+ response.debug.comments = formatCode(
+ JSON.stringify(formatResult.comments || []),
+ { parser: "json", plugins }
+ ).formatted;
+ }
+
if (message.debug.reformat) {
- response.debug.reformatted = formatCode(response.formatted, options);
+ response.debug.reformatted = formatCode(
+ response.formatted,
+ options
+ ).formatted;
}
return response;
@@ -121,14 +134,14 @@ function handleMessage(message) {
function formatCode(text, options) {
try {
- return prettier.format(text, options);
+ return prettier.formatWithCursor(text, options);
} catch (e) {
if (e.constructor && e.constructor.name === "SyntaxError") {
// Likely something wrong with the user's code
- return String(e);
+ return { formatted: String(e) };
}
// Likely a bug in Prettier
// Provide the whole stack for debugging
- return e.stack || String(e);
+ return { formatted: e.stack || String(e) };
}
}
From 9786ce2fb628ac4ad3ed5088fd8f7c66a93d9c17 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 27 Jan 2021 18:42:47 +0800
Subject: [PATCH 023/237] Build(deps-dev): Bump webpack from 5.17.0 to 5.18.0
(#10148)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index c28ea3b99..d11230482 100644
--- a/package.json
+++ b/package.json
@@ -131,7 +131,7 @@
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
- "webpack": "5.17.0"
+ "webpack": "5.18.0"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
diff --git a/yarn.lock b/yarn.lock
index 9fa82137c..bde6c8522 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7334,10 +7334,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.17.0:
- version "5.17.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.17.0.tgz#e92aebad45be25f86f788dc72fc11daacdcfd55d"
- integrity sha512-R+IdNEaYcYaACpXZOt7reyc8txBK7J06lOPkX1SbgmeoAnUbyBZivJIksrDBnmMA3wlTWvPcX7DubxELyPB8rA==
+webpack@5.18.0:
+ version "5.18.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.18.0.tgz#bbcf13094aa0da0534d513f27d7ee72d74e499c6"
+ integrity sha512-RmiP/iy6ROvVe/S+u0TrvL/oOmvP+2+Bs8MWjvBwwY/j82Q51XJyDJ75m0QAGntL1Wx6B//Xc0+4VPP/hlNHmw==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From bba719283d484f27659e2a69ff214cf287f15ab7 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Wed, 27 Jan 2021 20:36:02 +0800
Subject: [PATCH 024/237] JS: Simplify `clean` function (#10154)
---
src/language-js/clean.js | 67 +++++++++++++---------------------------
1 file changed, 22 insertions(+), 45 deletions(-)
diff --git a/src/language-js/clean.js b/src/language-js/clean.js
index 8da157caf..c96987da8 100644
--- a/src/language-js/clean.js
+++ b/src/language-js/clean.js
@@ -18,6 +18,12 @@ const ignoredProperties = new Set([
"tokens",
]);
+const removeTemplateElementsValue = (node) => {
+ for (const templateElement of node.quasis) {
+ delete templateElement.value;
+ }
+};
+
function clean(ast, newObj, parent) {
if (ast.type === "Program") {
delete newObj.sourceType;
@@ -94,21 +100,13 @@ function clean(ast, newObj, parent) {
ast.openingElement.name.name === "style" &&
ast.openingElement.attributes.some((attr) => attr.name.name === "jsx")
) {
- const templateLiterals = newObj.children
- .filter(
- (child) =>
- child.type === "JSXExpressionContainer" &&
- child.expression.type === "TemplateLiteral"
- )
- .map((container) => container.expression);
-
- const quasis = templateLiterals.reduce(
- (quasis, templateLiteral) => [...quasis, ...templateLiteral.quasis],
- []
- );
-
- for (const q of quasis) {
- delete q.value;
+ for (const { type, expression } of newObj.children) {
+ if (
+ type === "JSXExpressionContainer" &&
+ expression.type === "TemplateLiteral"
+ ) {
+ removeTemplateElementsValue(expression);
+ }
}
}
@@ -119,9 +117,7 @@ function clean(ast, newObj, parent) {
ast.value.type === "JSXExpressionContainer" &&
ast.value.expression.type === "TemplateLiteral"
) {
- for (const q of newObj.value.expression.quasis) {
- delete q.value;
- }
+ removeTemplateElementsValue(newObj.value.expression);
}
// We change quotes
@@ -147,26 +143,18 @@ function clean(ast, newObj, parent) {
index,
prop,
] of newObj.expression.arguments[0].properties.entries()) {
- let templateLiteral = null;
-
switch (astProps[index].key.name) {
case "styles":
if (prop.value.type === "ArrayExpression") {
- templateLiteral = prop.value.elements[0];
+ removeTemplateElementsValue(prop.value.elements[0]);
}
break;
case "template":
if (prop.value.type === "TemplateLiteral") {
- templateLiteral = prop.value;
+ removeTemplateElementsValue(prop.value);
}
break;
}
-
- if (templateLiteral) {
- for (const q of templateLiteral.quasis) {
- delete q.value;
- }
- }
}
}
@@ -183,9 +171,7 @@ function clean(ast, newObj, parent) {
ast.tag.name === "html")) ||
ast.tag.type === "CallExpression")
) {
- for (const quasi of newObj.quasi.quasis) {
- delete quasi.value;
- }
+ removeTemplateElementsValue(newObj.quasi);
}
if (ast.type === "TemplateLiteral") {
// This checks for a leading comment that is exactly `/* GraphQL */`
@@ -204,21 +190,12 @@ function clean(ast, newObj, parent) {
);
if (
hasLanguageComment ||
- (parent.type === "CallExpression" && parent.callee.name === "graphql")
+ (parent.type === "CallExpression" && parent.callee.name === "graphql") ||
+ // TODO: check parser
+ // `flow` and `typescript` don't have `leadingComments`
+ !ast.leadingComments
) {
- for (const quasi of newObj.quasis) {
- delete quasi.value;
- }
- }
-
- // TODO: check parser
- // `flow` and `typescript` don't have `leadingComments`
- if (!ast.leadingComments) {
- for (const quasi of newObj.quasis) {
- if (quasi.value) {
- delete quasi.value.cooked;
- }
- }
+ removeTemplateElementsValue(newObj);
}
}
From 53b59d2d39fd38079a587c7ce7e7e62cc1cbb591 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Thu, 28 Jan 2021 00:29:34 +0200
Subject: [PATCH 025/237] Fix lineSuffixBoundary (#10122)
---
changelog_unreleased/api/10122.md | 34 +++++++++++++++
src/document/doc-printer.js | 25 +++++++++--
.../__tests__/line-suffix-boundary.js | 41 +++++++++++++++++++
tests_integration/printDoc.js | 30 ++++++++++++++
4 files changed, 126 insertions(+), 4 deletions(-)
create mode 100644 changelog_unreleased/api/10122.md
create mode 100644 tests_integration/__tests__/line-suffix-boundary.js
create mode 100644 tests_integration/printDoc.js
diff --git a/changelog_unreleased/api/10122.md b/changelog_unreleased/api/10122.md
new file mode 100644
index 000000000..5cc6e6219
--- /dev/null
+++ b/changelog_unreleased/api/10122.md
@@ -0,0 +1,34 @@
+#### Fix `lineSuffixBoundary` (#10122 by @thorn0)
+
+There was a bug in the implementation of the [`lineSuffixBoundary`][lsb] command that significantly limited its usefulness: the printer algorithm didn't correctly consider it a potential line break. Now that the bug has been fixed, we urge plugin authors to give this command another try and see if it can help them simplify printing of trailing comments.
+
+[lsb]: https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary
+
+
+```jsx
+// Input
+group([
+ "let foo = [",
+ indent([
+ softline,
+ [lineSuffixBoundary, "item1,"],
+ line,
+ [lineSuffixBoundary, "item2,", lineSuffix(" // comment")],
+ line,
+ [lineSuffixBoundary, "item3"],
+ ]),
+ softline,
+ "];",
+])
+
+// Prettier stable
+let foo = [item1, item2, // comment
+ item3];
+
+// Prettier main
+let foo = [
+ item1,
+ item2, // comment
+ item3
+];
+```
diff --git a/src/document/doc-printer.js b/src/document/doc-printer.js
index 39d8efdea..5e2558f1a 100644
--- a/src/document/doc-printer.js
+++ b/src/document/doc-printer.js
@@ -144,7 +144,7 @@ function trim(out) {
return trimCount;
}
-function fits(next, restCommands, width, options, mustBeFlat) {
+function fits(next, restCommands, width, options, hasLineSuffix, mustBeFlat) {
let restIdx = restCommands.length;
const cmds = [next];
// `out` is only used for width counting because `trim` requires to look
@@ -237,6 +237,14 @@ function fits(next, restCommands, width, options, mustBeFlat) {
return true;
}
break;
+ case "line-suffix":
+ hasLineSuffix = true;
+ break;
+ case "line-suffix-boundary":
+ if (hasLineSuffix) {
+ return false;
+ }
+ break;
}
}
}
@@ -306,8 +314,9 @@ function printDocToString(doc, options) {
const next = [ind, MODE_FLAT, doc.contents];
const rem = width - pos;
+ const hasLineSuffix = lineSuffix.length > 0;
- if (!doc.break && fits(next, cmds, rem, options)) {
+ if (!doc.break && fits(next, cmds, rem, options, hasLineSuffix)) {
cmds.push(next);
} else {
// Expanded states are a rare case where a document
@@ -335,7 +344,7 @@ function printDocToString(doc, options) {
const state = doc.expandedStates[i];
const cmd = [ind, MODE_FLAT, state];
- if (fits(cmd, cmds, rem, options)) {
+ if (fits(cmd, cmds, rem, options, hasLineSuffix)) {
cmds.push(cmd);
break;
@@ -387,7 +396,14 @@ function printDocToString(doc, options) {
const [content, whitespace] = parts;
const contentFlatCmd = [ind, MODE_FLAT, content];
const contentBreakCmd = [ind, MODE_BREAK, content];
- const contentFits = fits(contentFlatCmd, [], rem, options, true);
+ const contentFits = fits(
+ contentFlatCmd,
+ [],
+ rem,
+ options,
+ lineSuffix.length > 0,
+ true
+ );
if (parts.length === 1) {
if (contentFits) {
@@ -430,6 +446,7 @@ function printDocToString(doc, options) {
[],
rem,
options,
+ lineSuffix.length > 0,
true
);
diff --git a/tests_integration/__tests__/line-suffix-boundary.js b/tests_integration/__tests__/line-suffix-boundary.js
new file mode 100644
index 000000000..a420c561f
--- /dev/null
+++ b/tests_integration/__tests__/line-suffix-boundary.js
@@ -0,0 +1,41 @@
+"use strict";
+
+/** @type {import('prettier')} */
+const prettier = require("prettier-local");
+
+const {
+ group,
+ indent,
+ line,
+ lineSuffix,
+ lineSuffixBoundary,
+ softline,
+} = prettier.doc.builders;
+
+const printDoc = require("../printDoc");
+
+describe("lineSuffixBoundary", () => {
+ test("should be correctly treated as a potential line break in `fits`", () => {
+ const doc = group([
+ "let foo = [",
+ indent([
+ softline,
+ [lineSuffixBoundary, "item1,"],
+ line,
+ [lineSuffixBoundary, "item2,", lineSuffix(" // comment")],
+ line,
+ [lineSuffixBoundary, "item3"],
+ ]),
+ softline,
+ "];",
+ ]);
+
+ const expected = `let foo = [
+ item1,
+ item2, // comment
+ item3
+];`;
+
+ expect(printDoc(doc)).toBe(expected);
+ });
+});
diff --git a/tests_integration/printDoc.js b/tests_integration/printDoc.js
new file mode 100644
index 000000000..08e58b2f4
--- /dev/null
+++ b/tests_integration/printDoc.js
@@ -0,0 +1,30 @@
+"use strict";
+
+/** @type {import('prettier')} */
+const prettier = require("prettier-local");
+
+function printDoc(doc) {
+ // This dummy plugin ignores the input and simply returns the given doc.
+ // This is to make sure that the doc will go through all the stages a real doc
+ // returned by a real plugin would go (e.g. `propagateBreaks`).
+ const dummyPlugin = {
+ parsers: {
+ dummy: {
+ parse: () => ({}),
+ astFormat: "dummy",
+ },
+ },
+ printers: {
+ dummy: {
+ print: () => doc,
+ },
+ },
+ };
+
+ return prettier.format("_", {
+ plugins: [dummyPlugin],
+ parser: "dummy",
+ });
+}
+
+module.exports = printDoc;
From 3d9f102301b71a2e197792823bd6e7ad2e212cc4 Mon Sep 17 00:00:00 2001
From: Daron McIntosh
Date: Wed, 27 Jan 2021 17:30:16 -0500
Subject: [PATCH 026/237] Add CLI option to prevent errors on unmatched
patterns (#10058)
---
.gitignore | 1 +
changelog_unreleased/cli/8233.md | 16 +++++++
docs/cli.md | 4 ++
src/cli/constant.js | 4 ++
src/cli/expand-patterns.js | 6 ++-
.../__snapshots__/early-exit.js.snap | 4 ++
.../error-on-unmatched-pattern.js.snap | 48 +++++++++++++++++++
.../__snapshots__/help-options.js.snap | 11 +++++
.../__tests__/error-on-unmatched-pattern.js | 37 ++++++++++++++
.../cli/error-on-unmatched-pattern/some.js | 1 +
.../cli/error-on-unmatched-pattern/some.json | 3 ++
.../cli/error-on-unmatched-pattern/some.yml | 1 +
12 files changed, 134 insertions(+), 2 deletions(-)
create mode 100644 changelog_unreleased/cli/8233.md
create mode 100644 tests_integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap
create mode 100644 tests_integration/__tests__/error-on-unmatched-pattern.js
create mode 100644 tests_integration/cli/error-on-unmatched-pattern/some.js
create mode 100644 tests_integration/cli/error-on-unmatched-pattern/some.json
create mode 100644 tests_integration/cli/error-on-unmatched-pattern/some.yml
diff --git a/.gitignore b/.gitignore
index cdee460be..824eebe1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@ package-lock.json
.pnp.*
.nyc_output
/scripts/tools/eslint-plugin-prettier-internal-rules/node_modules
+.devcontainer
diff --git a/changelog_unreleased/cli/8233.md b/changelog_unreleased/cli/8233.md
new file mode 100644
index 000000000..6af568c1a
--- /dev/null
+++ b/changelog_unreleased/cli/8233.md
@@ -0,0 +1,16 @@
+#### Add CLI option to prevent errors on unmatched pattern (#8233 by @daronmcintosh)
+
+The following command will not throw an error when it doesn't find a YAML file.
+
+```sh
+// Prettier stable
+$ npx prettier --check "prettier/docs/*.yaml"
+Checking formatting...
+[error] No files matching the pattern were found: "prettier/docs/*.yaml".
+All matched files use Prettier code style!
+
+// Prettier master
+$ npx prettier --check --no-error-on-unmatched-pattern "prettier/docs/*.yaml"
+Checking formatting...
+All matched files use Prettier code style!
+```
diff --git a/docs/cli.md b/docs/cli.md
index 2e88f0fb9..86422e854 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -212,3 +212,7 @@ With `--ignore-unknown` (or `-u`), prettier will ignore unknown files matched by
```console
$ prettier "**/*" --write --ignore-unknown
```
+
+## `--no-error-on-unmatched-pattern`
+
+Prevent errors when pattern is unmatched.
diff --git a/src/cli/constant.js b/src/cli/constant.js
index 83a622863..52758d2e9 100644
--- a/src/cli/constant.js
+++ b/src/cli/constant.js
@@ -148,6 +148,10 @@ const options = {
"Don't take .editorconfig into account when parsing configuration.",
default: true,
},
+ "error-on-unmatched-pattern": {
+ type: "boolean",
+ oppositeDescription: "Prevent errors when pattern is unmatched.",
+ },
"find-config-path": {
type: "path",
category: coreOptions.CATEGORY_CONFIG,
diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js
index d37ed34f5..b840ce723 100644
--- a/src/cli/expand-patterns.js
+++ b/src/cli/expand-patterns.js
@@ -33,7 +33,7 @@ function* expandPatterns(context) {
yield relativePath;
}
- if (noResults) {
+ if (noResults && context.argv["error-on-unmatched-pattern"] !== false) {
// If there was no files and no other errors, let's yield a general error.
yield {
error: `No matching files. Patterns: ${context.filePatterns.join(" ")}`,
@@ -116,7 +116,9 @@ function* expandPatternsInternal(context) {
}
if (result.length === 0) {
- yield { error: `${errorMessages.emptyResults[type]}: "${input}".` };
+ if (context.argv["error-on-unmatched-pattern"] !== false) {
+ yield { error: `${errorMessages.emptyResults[type]}: "${input}".` };
+ }
} else {
yield* sortPaths(result);
}
diff --git a/tests_integration/__tests__/__snapshots__/early-exit.js.snap b/tests_integration/__tests__/__snapshots__/early-exit.js.snap
index eb58ce63e..932fd54c1 100644
--- a/tests_integration/__tests__/__snapshots__/early-exit.js.snap
+++ b/tests_integration/__tests__/__snapshots__/early-exit.js.snap
@@ -146,6 +146,8 @@ Editor options:
Other options:
--no-color Do not colorize error messages.
+ --no-error-on-unmatched-pattern
+ Prevent errors when pattern is unmatched.
--file-info Extract the following info (as JSON) for a given file path. Reported fields:
* ignored (boolean) - true if file path is filtered by --ignore-path
* inferredParser (string | null) - name of parser inferred from file path
@@ -308,6 +310,8 @@ Editor options:
Other options:
--no-color Do not colorize error messages.
+ --no-error-on-unmatched-pattern
+ Prevent errors when pattern is unmatched.
--file-info Extract the following info (as JSON) for a given file path. Reported fields:
* ignored (boolean) - true if file path is filtered by --ignore-path
* inferredParser (string | null) - name of parser inferred from file path
diff --git a/tests_integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap b/tests_integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap
new file mode 100644
index 000000000..ddce6fcc5
--- /dev/null
+++ b/tests_integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap
@@ -0,0 +1,48 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`error on unmatched pattern (stderr) 1`] = `
+"[error] No files matching the pattern were found: \\"**/*.toml\\".
+"
+`;
+
+exports[`error on unmatched pattern (stdout) 1`] = `""`;
+
+exports[`error on unmatched pattern (write) 1`] = `Array []`;
+
+exports[`error on unmatched pattern when 2nd glob has no match (stderr) 1`] = `
+"[error] No files matching the pattern were found: \\"**/*.toml\\".
+"
+`;
+
+exports[`error on unmatched pattern when 2nd glob has no match (stdout) 1`] = `
+"const hello = \\"there\\";
+{
+ \\"hello\\": \\"there\\"
+}
+hello: there
+"
+`;
+
+exports[`error on unmatched pattern when 2nd glob has no match (write) 1`] = `Array []`;
+
+exports[`no error on unmatched pattern (stderr) 1`] = `""`;
+
+exports[`no error on unmatched pattern (stdout) 1`] = `
+"const hello = \\"there\\";
+"
+`;
+
+exports[`no error on unmatched pattern (write) 1`] = `Array []`;
+
+exports[`no error on unmatched pattern when 2nd glob has no match (stderr) 1`] = `""`;
+
+exports[`no error on unmatched pattern when 2nd glob has no match (stdout) 1`] = `
+"const hello = \\"there\\";
+{
+ \\"hello\\": \\"there\\"
+}
+hello: there
+"
+`;
+
+exports[`no error on unmatched pattern when 2nd glob has no match (write) 1`] = `Array []`;
diff --git a/tests_integration/__tests__/__snapshots__/help-options.js.snap b/tests_integration/__tests__/__snapshots__/help-options.js.snap
index 0b8f6343b..c98b0f62d 100644
--- a/tests_integration/__tests__/__snapshots__/help-options.js.snap
+++ b/tests_integration/__tests__/__snapshots__/help-options.js.snap
@@ -347,6 +347,17 @@ exports[`show detailed usage with --help no-editorconfig (stdout) 1`] = `
exports[`show detailed usage with --help no-editorconfig (write) 1`] = `Array []`;
+exports[`show detailed usage with --help no-error-on-unmatched-pattern (stderr) 1`] = `""`;
+
+exports[`show detailed usage with --help no-error-on-unmatched-pattern (stdout) 1`] = `
+"--no-error-on-unmatched-pattern
+
+ Prevent errors when pattern is unmatched.
+"
+`;
+
+exports[`show detailed usage with --help no-error-on-unmatched-pattern (write) 1`] = `Array []`;
+
exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-semi (stdout) 1`] = `
diff --git a/tests_integration/__tests__/error-on-unmatched-pattern.js b/tests_integration/__tests__/error-on-unmatched-pattern.js
new file mode 100644
index 000000000..102f61326
--- /dev/null
+++ b/tests_integration/__tests__/error-on-unmatched-pattern.js
@@ -0,0 +1,37 @@
+"use strict";
+
+const runPrettier = require("../runPrettier");
+
+describe("no error on unmatched pattern", () => {
+ runPrettier("cli/error-on-unmatched-pattern", [
+ "--no-error-on-unmatched-pattern",
+ "**/*.js",
+ ]).test({
+ status: 0,
+ });
+});
+
+describe("error on unmatched pattern", () => {
+ runPrettier("cli/error-on-unmatched-pattern", ["**/*.toml"]).test({
+ status: 2,
+ });
+});
+
+describe("no error on unmatched pattern when 2nd glob has no match", () => {
+ runPrettier("cli/error-on-unmatched-pattern", [
+ "--no-error-on-unmatched-pattern",
+ "**/*.{json,js,yml}",
+ "**/*.toml",
+ ]).test({
+ status: 0,
+ });
+});
+
+describe("error on unmatched pattern when 2nd glob has no match", () => {
+ runPrettier("cli/error-on-unmatched-pattern", [
+ "**/*.{json,js,yml}",
+ "**/*.toml",
+ ]).test({
+ status: 2,
+ });
+});
diff --git a/tests_integration/cli/error-on-unmatched-pattern/some.js b/tests_integration/cli/error-on-unmatched-pattern/some.js
new file mode 100644
index 000000000..d91ae5302
--- /dev/null
+++ b/tests_integration/cli/error-on-unmatched-pattern/some.js
@@ -0,0 +1 @@
+const hello = "there";
diff --git a/tests_integration/cli/error-on-unmatched-pattern/some.json b/tests_integration/cli/error-on-unmatched-pattern/some.json
new file mode 100644
index 000000000..f7df04e7c
--- /dev/null
+++ b/tests_integration/cli/error-on-unmatched-pattern/some.json
@@ -0,0 +1,3 @@
+{
+ "hello": "there"
+}
diff --git a/tests_integration/cli/error-on-unmatched-pattern/some.yml b/tests_integration/cli/error-on-unmatched-pattern/some.yml
new file mode 100644
index 000000000..611962cf5
--- /dev/null
+++ b/tests_integration/cli/error-on-unmatched-pattern/some.yml
@@ -0,0 +1 @@
+hello: there
From 4536fef4fe3515d99c17e3d54aef286478e7f569 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 28 Jan 2021 06:32:08 +0800
Subject: [PATCH 027/237] Simplify `printStartingTag` in glimmer printer
(#10152)
---
src/language-handlebars/printer-glimmer.js | 28 +++++++---------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js
index 50092ce7f..408c0cb4e 100644
--- a/src/language-handlebars/printer-glimmer.js
+++ b/src/language-handlebars/printer-glimmer.js
@@ -395,26 +395,14 @@ function print(path, options, print) {
function printStartingTag(path, print) {
const node = path.getValue();
- const attributesLike = [];
- if (isNonEmptyArray(node.attributes)) {
- const attributes = join(line, path.map(print, "attributes"));
- attributesLike.push(line, attributes);
- }
-
- if (isNonEmptyArray(node.modifiers)) {
- const modifiers = join(line, path.map(print, "modifiers"));
- attributesLike.push(line, modifiers);
- }
-
- if (isNonEmptyArray(node.comments)) {
- const comments = join(line, path.map(print, "comments"));
- attributesLike.push(line, comments);
- }
-
- if (isNonEmptyArray(node.blockParams)) {
- const blockParams = printBlockParams(node);
- attributesLike.push(line, blockParams);
- }
+ const attributesLike = ["attributes", "modifiers", "comments", "blockParams"]
+ .filter((property) => isNonEmptyArray(node[property]))
+ .map((property) => [
+ line,
+ property === "blockParams"
+ ? printBlockParams(node)
+ : join(line, path.map(print, property)),
+ ]);
return [
"<",
From b565b579f2111efd058723266fb0e795314c68ed Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 28 Jan 2021 00:32:29 +0200
Subject: [PATCH 028/237] Build(deps): Bump graphql from 15.4.0 to 15.5.0
(#10149)
Bumps [graphql](https://github.com/graphql/graphql-js) from 15.4.0 to 15.5.0.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v15.4.0...v15.5.0)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index d11230482..591b68959 100644
--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
"flow-parser": "0.143.1",
"get-stdin": "8.0.0",
"globby": "11.0.2",
- "graphql": "15.4.0",
+ "graphql": "15.5.0",
"html-element-attributes": "2.3.0",
"html-styles": "1.0.0",
"html-tag-names": "1.1.5",
diff --git a/yarn.lock b/yarn.lock
index bde6c8522..6b2412e62 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3685,10 +3685,10 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4:
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
-graphql@15.4.0:
- version "15.4.0"
- resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.4.0.tgz#e459dea1150da5a106486ba7276518b5295a4347"
- integrity sha512-EB3zgGchcabbsU9cFe1j+yxdzKQKAbGUWRb13DsrsMN1yyfmmIq+2+L5MqVWcDCE4V89R5AyUOi7sMOGxdsYtA==
+graphql@15.5.0:
+ version "15.5.0"
+ resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.0.tgz#39d19494dbe69d1ea719915b578bf920344a69d5"
+ integrity sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA==
growly@^1.3.0:
version "1.3.0"
From b7a0e253f67848de9951c19d688768dcc951f546 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Thu, 28 Jan 2021 00:34:39 +0200
Subject: [PATCH 029/237] Fix changelog for #8233
---
changelog_unreleased/cli/8233.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/changelog_unreleased/cli/8233.md b/changelog_unreleased/cli/8233.md
index 6af568c1a..6a7fdae12 100644
--- a/changelog_unreleased/cli/8233.md
+++ b/changelog_unreleased/cli/8233.md
@@ -9,7 +9,7 @@ Checking formatting...
[error] No files matching the pattern were found: "prettier/docs/*.yaml".
All matched files use Prettier code style!
-// Prettier master
+// Prettier main
$ npx prettier --check --no-error-on-unmatched-pattern "prettier/docs/*.yaml"
Checking formatting...
All matched files use Prettier code style!
From 7411285451b01078b7239356ab3bd3cb08363f18 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 28 Jan 2021 02:37:03 +0200
Subject: [PATCH 030/237] Build(deps): Bump node-notifier from 8.0.0 to 8.0.1
(#10161)
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
yarn.lock | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index 6b2412e62..6cc86f4eb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4035,9 +4035,9 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2:
kind-of "^6.0.2"
is-docker@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b"
- integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.1.1.tgz#4125a88e44e450d384e09047ede71adc2d144156"
+ integrity sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==
is-extendable@^0.1.0, is-extendable@^0.1.1:
version "0.1.1"
@@ -5316,9 +5316,9 @@ node-modules-regexp@^1.0.0:
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
node-notifier@^8.0.0:
- version "8.0.0"
- resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.0.tgz#a7eee2d51da6d0f7ff5094bc7108c911240c1620"
- integrity sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA==
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.1.tgz#f86e89bbc925f2b068784b31f382afdc6ca56be1"
+ integrity sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA==
dependencies:
growly "^1.3.0"
is-wsl "^2.2.0"
@@ -7209,9 +7209,9 @@ uuid@^3.3.2:
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
uuid@^8.3.0:
- version "8.3.0"
- resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea"
- integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==
+ version "8.3.2"
+ resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
+ integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
v8-compile-cache@^2.0.3:
version "2.1.1"
From 53a7e9782b87523c732f4aef14fe1fdb6609a8b3 Mon Sep 17 00:00:00 2001
From: Sosuke Suzuki
Date: Thu, 28 Jan 2021 23:03:16 +0900
Subject: [PATCH 031/237] Print trailing comma for type parameters (#10109)
* Print type parameters for TypeScript
* Add more tests
* Add changelog
* Avoid duplicates printing trailing-commas
* Fix changelog
* Address review
* Update src/language-js/print/type-parameters.js
* Update 10109.md
Co-authored-by: Georgii Dolzhykov
---
changelog_unreleased/typescript/10109.md | 43 +++
src/language-js/print/type-parameters.js | 34 +--
.../__snapshots__/jsfmt.spec.js.snap | 250 ++++++++++++++++++
.../trailing-comma/arrow-functions.tsx | 4 +
tests/typescript/trailing-comma/jsfmt.spec.js | 2 +
.../trailing-comma/type-parameters.ts | 10 +
6 files changed, 323 insertions(+), 20 deletions(-)
create mode 100644 changelog_unreleased/typescript/10109.md
create mode 100644 tests/typescript/trailing-comma/arrow-functions.tsx
create mode 100644 tests/typescript/trailing-comma/type-parameters.ts
diff --git a/changelog_unreleased/typescript/10109.md b/changelog_unreleased/typescript/10109.md
new file mode 100644
index 000000000..1a54cb3b3
--- /dev/null
+++ b/changelog_unreleased/typescript/10109.md
@@ -0,0 +1,43 @@
+#### Print trailing commas for TS type parameters (#10109 by @sosukesuzuki)
+
+Initially, Prettier printed trailing commas in TypeScript type parameters with `--trailing-comma=all`, but TypeScript did not support it at the time, so the feature was removed. However, it is supported now (since TypeScript 2.7 released in January 2018).
+
+
+```ts
+// Input
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+// Prettier stable
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+// Prettier main
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH,
+>;
+
+```
diff --git a/src/language-js/print/type-parameters.js b/src/language-js/print/type-parameters.js
index ca1ecb06c..a747967fd 100644
--- a/src/language-js/print/type-parameters.js
+++ b/src/language-js/print/type-parameters.js
@@ -52,17 +52,24 @@ function printTypeParameters(path, options, print, paramsKey) {
];
}
+ // Keep comma if the file extension is .tsx and
+ // has one type parameter that isn't extend with any types.
+ // Because, otherwise formatted result will be invalid as tsx.
+ const trailingComma =
+ getFunctionParameters(n).length === 1 &&
+ isTSXFile(options) &&
+ !n[paramsKey][0].constraint &&
+ path.getParentNode().type === "ArrowFunctionExpression"
+ ? ","
+ : shouldPrintComma(options, "all")
+ ? ifBreak(",")
+ : "";
+
return group(
[
"<",
indent([softline, join([",", line], path.map(print, paramsKey))]),
- ifBreak(
- options.parser !== "typescript" &&
- options.parser !== "babel-ts" &&
- shouldPrintComma(options, "all")
- ? ","
- : ""
- ),
+ trailingComma,
softline,
">",
],
@@ -124,19 +131,6 @@ function printTypeParameter(path, options, print) {
parts.push(" = ", path.call(print, "default"));
}
- // Keep comma if the file extension is .tsx and
- // has one type parameter that isn't extend with any types.
- // Because, otherwise formatted result will be invalid as tsx.
- const grandParent = path.getNode(2);
- if (
- getFunctionParameters(parent).length === 1 &&
- isTSXFile(options) &&
- !n.constraint &&
- grandParent.type === "ArrowFunctionExpression"
- ) {
- parts.push(",");
- }
-
return parts;
}
diff --git a/tests/typescript/trailing-comma/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/trailing-comma/__snapshots__/jsfmt.spec.js.snap
index 2728bc25f..3fe0b32a0 100644
--- a/tests/typescript/trailing-comma/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/trailing-comma/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,68 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`arrow-functions.tsx - {"trailingComma":"all"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "all"
+ | printWidth
+=====================================input======================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+=====================================output=====================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+================================================================================
+`;
+
+exports[`arrow-functions.tsx - {"trailingComma":"es5"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "es5"
+ | printWidth
+=====================================input======================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+=====================================output=====================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+================================================================================
+`;
+
+exports[`arrow-functions.tsx - {"trailingComma":"none"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "none"
+ | printWidth
+=====================================input======================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+=====================================output=====================================
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
+
+================================================================================
+`;
+
exports[`trailing.ts - {"trailingComma":"all"} format 1`] = `
====================================options=====================================
parsers: ["typescript"]
@@ -24,6 +87,50 @@ const {
...rest,
} = something;
+=====================================output=====================================
+export class BaseSingleLevelProfileTargeting<
+ T extends ValidSingleLevelProfileNode,
+> {}
+
+enum Enum {
+ x = 1,
+ y = 2,
+}
+
+const {
+ longKeySoThisWillGoOnMultipleLines,
+ longKeySoThisWillGoOnMultipleLines2,
+ longKeySoThisWillGoOnMultipleLines3,
+ ...rest
+} = something;
+
+================================================================================
+`;
+
+exports[`trailing.ts - {"trailingComma":"es5"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "es5"
+ | printWidth
+=====================================input======================================
+export class BaseSingleLevelProfileTargeting<
+ T extends ValidSingleLevelProfileNode,
+> {
+}
+
+enum Enum {
+ x = 1,
+ y = 2,
+}
+
+const {
+ longKeySoThisWillGoOnMultipleLines,
+ longKeySoThisWillGoOnMultipleLines2,
+ longKeySoThisWillGoOnMultipleLines3,
+ ...rest,
+} = something;
+
=====================================output=====================================
export class BaseSingleLevelProfileTargeting<
T extends ValidSingleLevelProfileNode
@@ -43,3 +150,146 @@ const {
================================================================================
`;
+
+exports[`trailing.ts - {"trailingComma":"none"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "none"
+ | printWidth
+=====================================input======================================
+export class BaseSingleLevelProfileTargeting<
+ T extends ValidSingleLevelProfileNode,
+> {
+}
+
+enum Enum {
+ x = 1,
+ y = 2,
+}
+
+const {
+ longKeySoThisWillGoOnMultipleLines,
+ longKeySoThisWillGoOnMultipleLines2,
+ longKeySoThisWillGoOnMultipleLines3,
+ ...rest,
+} = something;
+
+=====================================output=====================================
+export class BaseSingleLevelProfileTargeting<
+ T extends ValidSingleLevelProfileNode
+> {}
+
+enum Enum {
+ x = 1,
+ y = 2
+}
+
+const {
+ longKeySoThisWillGoOnMultipleLines,
+ longKeySoThisWillGoOnMultipleLines2,
+ longKeySoThisWillGoOnMultipleLines3,
+ ...rest
+} = something;
+
+================================================================================
+`;
+
+exports[`type-parameters.ts - {"trailingComma":"all"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "all"
+ | printWidth
+=====================================input======================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+=====================================output=====================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH,
+>;
+
+================================================================================
+`;
+
+exports[`type-parameters.ts - {"trailingComma":"es5"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "es5"
+ | printWidth
+=====================================input======================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+=====================================output=====================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+================================================================================
+`;
+
+exports[`type-parameters.ts - {"trailingComma":"none"} format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+trailingComma: "none"
+ | printWidth
+=====================================input======================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+=====================================output=====================================
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
+
+================================================================================
+`;
diff --git a/tests/typescript/trailing-comma/arrow-functions.tsx b/tests/typescript/trailing-comma/arrow-functions.tsx
new file mode 100644
index 000000000..a1555939a
--- /dev/null
+++ b/tests/typescript/trailing-comma/arrow-functions.tsx
@@ -0,0 +1,4 @@
+const f1 = () => 1;
+const f2 = <
+ Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt,
+>() => 1;
diff --git a/tests/typescript/trailing-comma/jsfmt.spec.js b/tests/typescript/trailing-comma/jsfmt.spec.js
index 8f1fcce6b..87950996e 100644
--- a/tests/typescript/trailing-comma/jsfmt.spec.js
+++ b/tests/typescript/trailing-comma/jsfmt.spec.js
@@ -1 +1,3 @@
run_spec(__dirname, ["typescript"], { trailingComma: "all" });
+run_spec(__dirname, ["typescript"], { trailingComma: "es5" });
+run_spec(__dirname, ["typescript"], { trailingComma: "none" });
diff --git a/tests/typescript/trailing-comma/type-parameters.ts b/tests/typescript/trailing-comma/type-parameters.ts
new file mode 100644
index 000000000..058c607a1
--- /dev/null
+++ b/tests/typescript/trailing-comma/type-parameters.ts
@@ -0,0 +1,10 @@
+var bar: Bar<
+ AAAAAAA,
+ BBBBBBB,
+ CCCCCCC,
+ DDDDDDD,
+ EEEEEEE,
+ FFFFFFF,
+ GGGGGGG,
+ HHHHHHH
+>;
From c881350e8caae716b5a373bbe8a5d7831cd195b8 Mon Sep 17 00:00:00 2001
From: Sosuke Suzuki
Date: Thu, 28 Jan 2021 23:06:16 +0900
Subject: [PATCH 032/237] Break assignment whose rhs is wrapped by an unary
expression (#10158)
* Break assignment whose rhs is wrapped unary expression
* Add changelog
* Recursive
* Refactor
* With loop
* Use if
* Update assignment.js
* Update assignment.js
This rewrite not totally equal, but should safe.
* Revert "Update assignment.js"
This reverts commit 14549442b7726461b0e39d0b1077cdbb00195e73.
* Try move parser check upper
* Simplify `switch`
* Simplify
* Move parser check to top
Co-authored-by: fisker Cheung
---
changelog_unreleased/javascript/10158.md | 15 +++++
src/language-js/print/assignment.js | 62 +++++++++++++------
.../__snapshots__/jsfmt.spec.js.snap | 36 +++++++++++
tests/js/assignment/unary.js | 8 +++
4 files changed, 103 insertions(+), 18 deletions(-)
create mode 100644 changelog_unreleased/javascript/10158.md
create mode 100644 tests/js/assignment/unary.js
diff --git a/changelog_unreleased/javascript/10158.md b/changelog_unreleased/javascript/10158.md
new file mode 100644
index 000000000..90c989c15
--- /dev/null
+++ b/changelog_unreleased/javascript/10158.md
@@ -0,0 +1,15 @@
+#### Break assignment whose rhs is wrapped by an unary expression (#10158 by @sosukesuzuki)
+
+
+```js
+// Input
+const loooooooooooooooooooooooooong = !looooooooooooooong.looooooooooooooong.loooooong;
+
+// Prettier stable
+const loooooooooooooooooooooooooong = !looooooooooooooong.looooooooooooooong
+ .loooooong;
+
+// Prettier main
+const loooooooooooooooooooooooooong =
+ !looooooooooooooong.looooooooooooooong.loooooong;
+```
diff --git a/src/language-js/print/assignment.js b/src/language-js/print/assignment.js
index 1a90748f1..8bdf23ce1 100644
--- a/src/language-js/print/assignment.js
+++ b/src/language-js/print/assignment.js
@@ -12,6 +12,10 @@ const {
} = require("../utils");
const { shouldInlineLogicalExpression } = require("./binaryish");
+/**
+ * @typedef {import("../types/estree").Node} Node
+ */
+
function printAssignment(
leftNode,
printedLeft,
@@ -63,30 +67,52 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
return indent([line, printedRight]);
}
- const canBreak =
- (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) ||
- (rightNode.type === "ConditionalExpression" &&
- isBinaryish(rightNode.test) &&
- !shouldInlineLogicalExpression(rightNode.test)) ||
- rightNode.type === "StringLiteralTypeAnnotation" ||
- (rightNode.type === "ClassExpression" &&
- isNonEmptyArray(rightNode.decorators)) ||
- ((leftNode.type === "Identifier" ||
- isStringLiteral(leftNode) ||
- leftNode.type === "MemberExpression") &&
- (isStringLiteral(rightNode) || isMemberExpressionChain(rightNode)) &&
- // do not put values on a separate line from the key in json
- options.parser !== "json" &&
- options.parser !== "json5") ||
- rightNode.type === "SequenceExpression";
-
- if (canBreak) {
+ if (canBreakAssignmentRight(leftNode, rightNode, options)) {
return group(indent([line, printedRight]));
}
return [" ", printedRight];
}
+function canBreakAssignmentRight(leftNode, rightNode, options) {
+ // do not put values on a separate line from the key in json
+ if (options.parser === "json5" || options.parser === "json") {
+ return false;
+ }
+
+ if (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
+ return true;
+ }
+
+ switch (rightNode.type) {
+ case "StringLiteralTypeAnnotation":
+ case "SequenceExpression":
+ return true;
+ case "ConditionalExpression": {
+ const { test } = rightNode;
+ return isBinaryish(test) && !shouldInlineLogicalExpression(test);
+ }
+ case "ClassExpression":
+ return isNonEmptyArray(rightNode.decorators);
+ }
+
+ if (
+ leftNode.type === "Identifier" ||
+ isStringLiteral(leftNode) ||
+ leftNode.type === "MemberExpression"
+ ) {
+ let node = rightNode;
+ while (node.type === "UnaryExpression") {
+ node = node.argument;
+ }
+ if (isStringLiteral(node) || isMemberExpressionChain(node)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
module.exports = {
printVariableDeclarator,
printAssignmentExpression,
diff --git a/tests/js/assignment/__snapshots__/jsfmt.spec.js.snap b/tests/js/assignment/__snapshots__/jsfmt.spec.js.snap
index 76d745f14..076339f2a 100644
--- a/tests/js/assignment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/assignment/__snapshots__/jsfmt.spec.js.snap
@@ -91,3 +91,39 @@ for (i = 0, len = arr.length; i < len; i++) {
================================================================================
`;
+
+exports[`unary.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const loooooooooooooooooooooooooong1 = void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong2 = void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong3 = !looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong4 = !"looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong5 = void void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong6 = void void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong7 = !!looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong8 = !!"looooooooooooooooooooooooooooooooooooooooooog";
+
+=====================================output=====================================
+const loooooooooooooooooooooooooong1 =
+ void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong2 =
+ void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong3 =
+ !looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong4 =
+ !"looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong5 =
+ void void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong6 =
+ void void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong7 =
+ !!looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong8 =
+ !!"looooooooooooooooooooooooooooooooooooooooooog";
+
+================================================================================
+`;
diff --git a/tests/js/assignment/unary.js b/tests/js/assignment/unary.js
new file mode 100644
index 000000000..b39d899de
--- /dev/null
+++ b/tests/js/assignment/unary.js
@@ -0,0 +1,8 @@
+const loooooooooooooooooooooooooong1 = void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong2 = void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong3 = !looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong4 = !"looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong5 = void void looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong6 = void void "looooooooooooooooooooooooooooooooooooooooooog";
+const loooooooooooooooooooooooooong7 = !!looooooooooooooong.looooooooooooooong.loooooong;
+const loooooooooooooooooooooooooong8 = !!"looooooooooooooooooooooooooooooooooooooooooog";
From 12e82a89af937099f38ad7972631f90425532747 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 29 Jan 2021 02:37:32 +0800
Subject: [PATCH 033/237] Build(deps): Bump @angular/compiler from 11.1.0 to
11.1.1 (#10167)
Bumps [@angular/compiler](https://github.com/angular/angular/tree/HEAD/packages/compiler) from 11.1.0 to 11.1.1.
- [Release notes](https://github.com/angular/angular/releases)
- [Changelog](https://github.com/angular/angular/blob/master/CHANGELOG.md)
- [Commits](https://github.com/angular/angular/commits/11.1.1/packages/compiler)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 591b68959..ecb648a3b 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"bin"
],
"dependencies": {
- "@angular/compiler": "11.1.0",
+ "@angular/compiler": "11.1.1",
"@babel/code-frame": "7.12.11",
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.73.2",
diff --git a/yarn.lock b/yarn.lock
index 6cc86f4eb..dd0030002 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,10 +2,10 @@
# yarn lockfile v1
-"@angular/compiler@11.1.0":
- version "11.1.0"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.0.tgz#0e2e18fe0cb64ec696986f12f80debcbdccc8d20"
- integrity sha512-XW+McH/RVjpLtNkft6UYZQbjhXwX/hvLgUa9jGlTuIFM5o7W4XRPnq5sfn3+QvzdROF0j8S5sy47mGVNQOYMNg==
+"@angular/compiler@11.1.1":
+ version "11.1.1"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.1.tgz#cafe43b52fb69f0b9493e597baec14fcffd13d7d"
+ integrity sha512-kybGddMBL6E2BFBOHIX39VsKVxH3yD7NA1g2mQUE9KIqLAavH0KLBr8B03R9MKb6+BElGpk/5yCyCkzkwQES7w==
dependencies:
tslib "^2.0.0"
From 8846448b85565d553013d9bbfc76bbbef21edbbe Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Thu, 28 Jan 2021 23:45:08 +0200
Subject: [PATCH 034/237] Handlebars: fix formatting of attributes (#10145)
* Handlebars: fix formatting of attributes
* Add group only for class
* Add changelog
* Update clean.js
* Simplify ConcatStatement
* Lowercase attr name in clean
* Use text instead of n.chars
---
changelog_unreleased/handlebars/10145.md | 25 +++
src/language-handlebars/clean.js | 5 +
src/language-handlebars/printer-glimmer.js | 168 ++++++++++--------
.../__snapshots__/jsfmt.spec.js.snap | 70 ++++----
tests/handlebars/attr-node/class-name.hbs | 3 +
tests/handlebars/attr-node/quotes.hbs | 2 +
.../basics/__snapshots__/jsfmt.spec.js.snap | 3 +-
.../__snapshots__/jsfmt.spec.js.snap | 44 +++--
.../escape/__snapshots__/jsfmt.spec.js.snap | 19 ++
tests/handlebars/escape/mustache.hbs | 2 +
.../__snapshots__/jsfmt.spec.js.snap | 72 ++++----
.../__snapshots__/jsfmt.spec.js.snap | 40 ++---
12 files changed, 259 insertions(+), 194 deletions(-)
create mode 100644 changelog_unreleased/handlebars/10145.md
create mode 100644 tests/handlebars/attr-node/quotes.hbs
create mode 100644 tests/handlebars/escape/mustache.hbs
diff --git a/changelog_unreleased/handlebars/10145.md b/changelog_unreleased/handlebars/10145.md
new file mode 100644
index 000000000..2ba7277f5
--- /dev/null
+++ b/changelog_unreleased/handlebars/10145.md
@@ -0,0 +1,25 @@
+#### Fix formatting of attributes (#10145 by @thorn0)
+
+- fix escaping of `{{` in attributes and text
+- fix the choice between `'` and `"` for attributes with interpolations
+- fix the bug with `[object Object]` printed in the `class` attribute
+- implement simple formatting for the `class` attribute, like Prettier formatted it in HTML before v2.3.0
+
+
+```html
+// Input
+
+
+
+
+// Prettier stable
+
+
+
+
+// Prettier main
+
+
+
+```
diff --git a/src/language-handlebars/clean.js b/src/language-handlebars/clean.js
index db7b843ff..2ded535ca 100644
--- a/src/language-handlebars/clean.js
+++ b/src/language-handlebars/clean.js
@@ -9,6 +9,11 @@ function clean(ast, newNode /*, parent*/) {
}
newNode.chars = trimmed;
}
+
+ // `class` is reformatted
+ if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
+ delete newNode.value;
+ }
}
clean.ignoredProperties = new Set(["loc", "selfClosing"]);
diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js
index 408c0cb4e..fccfa2dea 100644
--- a/src/language-handlebars/printer-glimmer.js
+++ b/src/language-handlebars/printer-glimmer.js
@@ -2,10 +2,10 @@
const {
builders: { dedent, group, hardline, ifBreak, indent, join, line, softline },
- utils: { getDocParts },
} = require("../document");
-const { isNonEmptyArray } = require("../common/util");
+const { isNonEmptyArray, replaceEndOfLineWith } = require("../common/util");
+const { literalline } = require("../document/doc-builders");
const { locStart, locEnd } = require("./loc");
const clean = require("./clean");
const {
@@ -152,23 +152,34 @@ function print(path, options, print) {
if (isEmptyText && locStart(n.value) === locEnd(n.value)) {
return n.name;
}
- const value = path.call(print, "value");
- const quotedValue = isText
- ? printStringLiteral(
- typeof value === "string" ? value : getDocParts(value).join(),
- options
- )
- : value;
- return [n.name, "=", quotedValue];
+
+ // Let's assume quotes inside the content of text nodes are already
+ // properly escaped with entities, otherwise the parse wouldn't have parsed them.
+ const quote = isText
+ ? chooseEnclosingQuote(options, n.value.chars).quote
+ : n.value.type === "ConcatStatement"
+ ? chooseEnclosingQuote(
+ options,
+ n.value.parts
+ .filter((part) => part.type === "TextNode")
+ .map((part) => part.chars)
+ .join("")
+ ).quote
+ : "";
+
+ const valueDoc = path.call(print, "value");
+
+ return [
+ n.name,
+ "=",
+ quote,
+ n.name === "class" && quote ? group(indent(valueDoc)) : valueDoc,
+ quote,
+ ];
}
case "ConcatStatement": {
- const quote = options.singleQuote ? "'" : '"';
- return [
- quote,
- ...path.map((partPath) => print(partPath), "parts"),
- quote,
- ];
+ return path.map(print, "parts");
}
case "Hash": {
@@ -178,18 +189,57 @@ function print(path, options, print) {
return [n.key, "=", path.call(print, "value")];
}
case "TextNode": {
- const inAttrNode = path.stack.includes("attributes");
+ /* if `{{my-component}}` (or any text containing "{{")
+ * makes it to the TextNode, it means it was escaped,
+ * so let's print it escaped, ie.; `\{{my-component}}` */
+ let text = n.chars.replace(/{{/g, "\\{{");
- if (options.htmlWhitespaceSensitivity === "strict" && !inAttrNode) {
+ const attrName = getCurrentAttributeName(path);
+
+ if (attrName) {
+ // TODO: format style and srcset attributes
+ if (attrName === "class") {
+ const formattedClasses = text.trim().split(/\s+/).join(" ");
+
+ let leadingSpace = false;
+ let trailingSpace = false;
+
+ if (isParentOfSomeType(path, ["ConcatStatement"])) {
+ if (
+ isPreviousNodeOfSomeType(path, ["MustacheStatement"]) &&
+ /^\s/.test(text)
+ ) {
+ leadingSpace = true;
+ }
+ if (
+ isNextNodeOfSomeType(path, ["MustacheStatement"]) &&
+ /\s$/.test(text) &&
+ formattedClasses !== ""
+ ) {
+ trailingSpace = true;
+ }
+ }
+
+ return [
+ leadingSpace ? line : "",
+ formattedClasses,
+ trailingSpace ? line : "",
+ ];
+ }
+
+ return replaceEndOfLineWith(text, literalline);
+ }
+
+ if (options.htmlWhitespaceSensitivity === "strict") {
// https://infra.spec.whatwg.org/#ascii-whitespace
const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
- if (whitespacesOnlyRE.test(n.chars)) {
+ if (whitespacesOnlyRE.test(text)) {
let breaks = [line];
- const newlines = countNewLines(n.chars);
+ const newlines = countNewLines(text);
if (newlines) {
breaks = generateHardlines(newlines, 2);
}
@@ -201,10 +251,8 @@ function print(path, options, print) {
return breaks;
}
- const [lead] = n.chars.match(leadingWhitespacesRE);
- const [tail] = n.chars.match(trailingWhitespacesRE);
-
- let text = n.chars;
+ const [lead] = text.match(leadingWhitespacesRE);
+ const [tail] = text.match(trailingWhitespacesRE);
let leadBreaks = [];
if (lead) {
@@ -240,11 +288,11 @@ function print(path, options, print) {
const maxLineBreaksToPreserve = 2;
const isFirstElement = !getPreviousNode(path);
const isLastElement = !getNextNode(path);
- const isWhitespaceOnly = !/\S/.test(n.chars);
- const lineBreaksCount = countNewLines(n.chars);
+ const isWhitespaceOnly = !/\S/.test(text);
+ const lineBreaksCount = countNewLines(text);
- let leadingLineBreaksCount = countLeadingNewLines(n.chars);
- let trailingLineBreaksCount = countTrailingNewLines(n.chars);
+ let leadingLineBreaksCount = countLeadingNewLines(text);
+ let trailingLineBreaksCount = countTrailingNewLines(text);
if (
(isFirstElement || isLastElement) &&
@@ -270,34 +318,6 @@ function print(path, options, print) {
}
}
- if (inAttrNode) {
- // TODO: format style and srcset attributes
- if (!isInAttributeOfName(path, "class")) {
- return n.chars;
- }
-
- let leadingSpace = "";
- let trailingSpace = "";
-
- if (isParentOfSomeType(path, ["ConcatStatement"])) {
- if (isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
- leadingSpace = " ";
- }
- if (isNextNodeOfSomeType(path, ["MustacheStatement"])) {
- trailingSpace = " ";
- }
- }
-
- return [
- ...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve),
- n.chars.replace(/^\s+/g, leadingSpace).replace(/\s+$/, trailingSpace),
- ...generateHardlines(
- trailingLineBreaksCount,
- maxLineBreaksToPreserve
- ),
- ];
- }
-
let leadingSpace = "";
let trailingSpace = "";
@@ -325,15 +345,6 @@ function print(path, options, print) {
trailingSpace = "";
}
- let text = n.chars;
- /* if `{{my-component}}` (or any text starting with a mustache)
- * makes it to the TextNode,
- * it means it was escaped,
- * so let's print it escaped, ie.; `\{{my-component}}` */
- if (text.startsWith("{{") && text.includes("}}")) {
- text = "\\" + text;
- }
-
return [
...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve),
text.replace(/^\s+/g, leadingSpace).replace(/\s+$/, trailingSpace),
@@ -617,13 +628,13 @@ function printInverse(path, print, options) {
/* TextNode print helpers */
-function isInAttributeOfName(path, type) {
- return (
- (isParentOfSomeType(path, ["AttrNode"]) &&
- path.getParentNode().name.toLowerCase() === type) ||
- (isParentOfSomeType(path, ["ConcatStatement"]) &&
- path.getParentNode(1).name.toLowerCase() === type)
- );
+function getCurrentAttributeName(path) {
+ for (let depth = 0; depth < 2; depth++) {
+ const parentNode = path.getParentNode(depth);
+ if (parentNode && parentNode.type === "AttrNode") {
+ return parentNode.name.toLowerCase();
+ }
+ }
}
function countNewLines(string) {
@@ -662,6 +673,11 @@ function generateHardlines(number = 0, max = 0) {
* @param {object} options - the prettier options object
*/
function printStringLiteral(stringLiteral, options) {
+ const { quote, regex } = chooseEnclosingQuote(options, stringLiteral);
+ return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
+}
+
+function chooseEnclosingQuote(options, stringLiteral) {
const double = { quote: '"', regex: /"/g };
const single = { quote: "'", regex: /'/g };
@@ -685,13 +701,7 @@ function printStringLiteral(stringLiteral, options) {
shouldUseAlternateQuote = numPreferredQuotes > numAlternateQuotes;
}
- const enclosingQuote = shouldUseAlternateQuote ? alternate : preferred;
- const escapedStringLiteral = stringLiteral.replace(
- enclosingQuote.regex,
- `\\${enclosingQuote.quote}`
- );
-
- return [enclosingQuote.quote, escapedStringLiteral, enclosingQuote.quote];
+ return shouldUseAlternateQuote ? alternate : preferred;
}
/* SubExpression print helpers */
diff --git a/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
index f5438b7a5..455724984 100644
--- a/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
@@ -41,21 +41,26 @@ printWidth: 80
'>
=====================================output=====================================
-
+ newlines"
+>
-
+ newlines"
+>
-
+"
+>
-
+"
+>
================================================================================
`;
@@ -108,38 +116,38 @@ weirdly formatted
{{this.classes}}">String
+
+
=====================================output=====================================
-
+
String
-
+
String
-
+
String
+
+
+================================================================================
+`;
+
+exports[`quotes.hbs format 1`] = `
+====================================options=====================================
+parsers: ["glimmer"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+
+
+
+=====================================output=====================================
+
+
================================================================================
`;
diff --git a/tests/handlebars/attr-node/class-name.hbs b/tests/handlebars/attr-node/class-name.hbs
index c14f0fbe9..93d5a2b96 100644
--- a/tests/handlebars/attr-node/class-name.hbs
+++ b/tests/handlebars/attr-node/class-name.hbs
@@ -22,3 +22,6 @@ weirdly formatted
{{this.classes}}">String
+
+
diff --git a/tests/handlebars/attr-node/quotes.hbs b/tests/handlebars/attr-node/quotes.hbs
new file mode 100644
index 000000000..75726267b
--- /dev/null
+++ b/tests/handlebars/attr-node/quotes.hbs
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
index 56317cf5a..33c6a0773 100644
--- a/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
@@ -68,8 +68,7 @@ printWidth: 80
Hello
-
+
================================================================================
`;
diff --git a/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
index c66778ee0..f3b990352 100644
--- a/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
@@ -33,9 +33,12 @@ singleQuote: true
Hello
@@ -51,7 +54,7 @@ singleQuote: true
-
+
================================================================================
`;
@@ -87,9 +90,12 @@ printWidth: 80
Hello
@@ -105,7 +111,7 @@ printWidth: 80
-
+
================================================================================
`;
@@ -126,9 +132,9 @@ singleQuote: true
=====================================output=====================================
hey
@@ -141,8 +147,9 @@ singleQuote: true
test
@@ -165,9 +172,9 @@ printWidth: 80
=====================================output=====================================
hey
@@ -180,8 +187,9 @@ printWidth: 80
test
diff --git a/tests/handlebars/escape/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/escape/__snapshots__/jsfmt.spec.js.snap
index 63fa6f626..53584eb01 100644
--- a/tests/handlebars/escape/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/escape/__snapshots__/jsfmt.spec.js.snap
@@ -13,3 +13,22 @@ printWidth: 80
================================================================================
`;
+
+exports[`mustache.hbs format 1`] = `
+====================================options=====================================
+parsers: ["glimmer"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+ \\{{
+\\{{
+
+=====================================output=====================================
+
+ \\{{
+
+
+ \\{{
+
+================================================================================
+`;
diff --git a/tests/handlebars/escape/mustache.hbs b/tests/handlebars/escape/mustache.hbs
new file mode 100644
index 000000000..96e7a2f8c
--- /dev/null
+++ b/tests/handlebars/escape/mustache.hbs
@@ -0,0 +1,2 @@
+ \{{
+\{{
diff --git a/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
index 7890ecc17..c5aadaabb 100644
--- a/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
@@ -99,41 +99,37 @@ singleQuote: true
/>
@@ -266,41 +262,37 @@ printWidth: 80
/>
diff --git a/tests/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap
index 379c2bf64..891b513bc 100644
--- a/tests/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap
@@ -98,24 +98,20 @@ singleQuote: false
================================================================================
`;
@@ -150,24 +146,20 @@ singleQuote: true
================================================================================
`;
From c3a59148cfa1daacd912dc36244966f63715a575 Mon Sep 17 00:00:00 2001
From: fisker Cheing
Date: Fri, 29 Jan 2021 17:59:25 +0800
Subject: [PATCH 035/237] Ignore `.nyc_output` dir
---
.prettierignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.prettierignore b/.prettierignore
index a9e368637..a51105f52 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -10,3 +10,4 @@ coverage/
/website/static/lib/
/website/static/playground.js
cspell.json
+.nyc_output
From 07b30645ec0050b28466c32722e378fb77cdbb8e Mon Sep 17 00:00:00 2001
From: Sosuke Suzuki
Date: Fri, 29 Jan 2021 20:03:11 +0900
Subject: [PATCH 036/237] style: Add new ESLint rule
`no-empty-string-for-ifbreak` (#10172)
* Add new ESLint rule for ifBreak
* Fix for third argument
* Run fix with new rule
* Address review
* Fix
* Update no-empty-flat-contents-for-if-break.js
* Fix CI config
Co-authored-by: fisker Cheung
---
.eslintrc.yml | 1 +
.github/workflows/eslint-rules.yml | 4 +-
.../index.js | 1 +
.../no-empty-flat-contents-for-if-break.js | 42 ++++++++++++++++++
.../test.js | 43 +++++++++++++++++++
src/language-css/printer-postcss.js | 2 +-
src/language-js/print/ternary.js | 4 +-
src/language-js/print/typescript.js | 2 +-
.../print/flow-mapping-sequence.js | 2 +-
9 files changed, 94 insertions(+), 7 deletions(-)
create mode 100644 scripts/tools/eslint-plugin-prettier-internal-rules/no-empty-flat-contents-for-if-break.js
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 89c520c2d..37c6964be 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -117,6 +117,7 @@ overrides:
prettier-internal-rules/no-doc-builder-concat: error
prettier-internal-rules/prefer-fast-path-each: error
prettier-internal-rules/prefer-is-non-empty-array: error
+ prettier-internal-rules/no-empty-flat-contents-for-if-break: error
- files: src/document/*.js
rules:
prettier-internal-rules/no-doc-builder-concat: off
diff --git a/.github/workflows/eslint-rules.yml b/.github/workflows/eslint-rules.yml
index 75b183a46..8f2b9db6a 100644
--- a/.github/workflows/eslint-rules.yml
+++ b/.github/workflows/eslint-rules.yml
@@ -3,11 +3,11 @@ name: Internal_ESLint_Rules_Test
on:
push:
paths:
- - "scripts/tools/eslint-plugin-prettier-internal-rules"
+ - "scripts/tools/eslint-plugin-prettier-internal-rules/**"
- ".github/workflows/eslint-rules.yml"
pull_request:
paths:
- - "scripts/tools/eslint-plugin-prettier-internal-rules"
+ - "scripts/tools/eslint-plugin-prettier-internal-rules/**"
- ".github/workflows/eslint-rules.yml"
jobs:
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
index 3bec6a3e2..a8ab40ff2 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
@@ -10,5 +10,6 @@ module.exports = {
"prefer-fast-path-each": require("./prefer-fast-path-each"),
"prefer-is-non-empty-array": require("./prefer-is-non-empty-array"),
"require-json-extensions": require("./require-json-extensions"),
+ "no-empty-flat-contents-for-if-break": require("./no-empty-flat-contents-for-if-break"),
},
};
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/no-empty-flat-contents-for-if-break.js b/scripts/tools/eslint-plugin-prettier-internal-rules/no-empty-flat-contents-for-if-break.js
new file mode 100644
index 000000000..5d9d852e0
--- /dev/null
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/no-empty-flat-contents-for-if-break.js
@@ -0,0 +1,42 @@
+"use strict";
+
+const selector = [
+ "CallExpression",
+ "[optional=false]",
+ '[callee.type="Identifier"]',
+ '[callee.name="ifBreak"]',
+ "[arguments.length=2]",
+ '[arguments.1.type="Literal"]',
+ '[arguments.1.value=""]',
+ ':not([arguments.0.type="SpreadElement"])',
+].join("");
+
+const messageId = "no-empty-flat-contents-for-if-break";
+
+module.exports = {
+ meta: {
+ type: "suggestion",
+ docs: {
+ url:
+ "https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/no-empty-flat-contents-for-if-break.js",
+ },
+ messages: {
+ [messageId]:
+ "Please don't pass an empty string to second parameter of ifBreak.",
+ },
+ fixable: "code",
+ },
+ create(context) {
+ return {
+ [selector](node) {
+ const [breakContents] = node.arguments;
+ context.report({
+ node,
+ messageId,
+ fix: (fixer) =>
+ fixer.removeRange([breakContents.range[1], node.range[1] - 1]),
+ });
+ },
+ };
+ },
+};
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
index e02c8008e..85ab03c21 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
@@ -204,3 +204,46 @@ test("require-json-extensions", {
},
],
});
+
+test("no-empty-flat-contents-for-if-break", {
+ valid: [
+ "ifBreak('foo', 'bar')",
+ "ifBreak(doc1, doc2)",
+ "ifBreak(',')",
+ "ifBreak(doc)",
+ "ifBreak('foo', '', { groupId })",
+ "ifBreak(...foo, { groupId })",
+ ],
+ invalid: [
+ {
+ code: "ifBreak('foo', '')",
+ output: "ifBreak('foo')",
+ errors: [
+ {
+ message:
+ "Please don't pass an empty string to second parameter of ifBreak.",
+ },
+ ],
+ },
+ {
+ code: "ifBreak('foo' , '' )",
+ output: "ifBreak('foo')",
+ errors: [
+ {
+ message:
+ "Please don't pass an empty string to second parameter of ifBreak.",
+ },
+ ],
+ },
+ {
+ code: "ifBreak(doc, '')",
+ output: "ifBreak(doc)",
+ errors: [
+ {
+ message:
+ "Please don't pass an empty string to second parameter of ifBreak.",
+ },
+ ],
+ },
+ ],
+});
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js
index 10a2f0971..971bd3160 100644
--- a/src/language-css/printer-postcss.js
+++ b/src/language-css/printer-postcss.js
@@ -186,7 +186,7 @@ function genericPrint(path, options, print) {
options.originalText[locEnd(node) - 1] !== ";"
? ""
: options.__isHTMLStyleAttribute && isLastNode(path, node)
- ? ifBreak(";", "")
+ ? ifBreak(";")
: ";",
];
}
diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js
index bcbf7315f..976f7b9cf 100644
--- a/src/language-js/print/ternary.js
+++ b/src/language-js/print/ternary.js
@@ -221,10 +221,10 @@ function printTernary(path, options, print) {
// parens when using ?: within JSX, because the parens are analogous to
// curly braces in an if statement.
const wrap = (doc) => [
- ifBreak("(", ""),
+ ifBreak("("),
indent([softline, doc]),
softline,
- ifBreak(")", ""),
+ ifBreak(")"),
];
// The only things we don't wrap are:
diff --git a/src/language-js/print/typescript.js b/src/language-js/print/typescript.js
index 331e4f732..a9b42d67d 100644
--- a/src/language-js/print/typescript.js
+++ b/src/language-js/print/typescript.js
@@ -348,7 +348,7 @@ function printTypescript(path, options, print) {
n.optional ? getTypeScriptMappedTypeModifier(n.optional, "?") : "",
n.typeAnnotation ? ": " : "",
path.call(print, "typeAnnotation"),
- ifBreak(semi, ""),
+ ifBreak(semi),
]),
printDanglingComments(path, options, /* sameIndent */ true),
options.bracketSpacing ? line : softline,
diff --git a/src/language-yaml/print/flow-mapping-sequence.js b/src/language-yaml/print/flow-mapping-sequence.js
index 28b87a059..b5d8152eb 100644
--- a/src/language-yaml/print/flow-mapping-sequence.js
+++ b/src/language-yaml/print/flow-mapping-sequence.js
@@ -29,7 +29,7 @@ function printFlowMapping(path, print, options) {
alignWithSpaces(options.tabWidth, [
bracketSpacing,
printChildren(path, print, options),
- options.trailingComma === "none" ? "" : ifBreak(",", ""),
+ options.trailingComma === "none" ? "" : ifBreak(","),
hasEndComments(node)
? [hardline, join(hardline, path.map(print, "endComments"))]
: "",
From a7ea77e0eff76c31e992839576e99ef1f057ad47 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Fri, 29 Jan 2021 19:58:24 +0200
Subject: [PATCH 037/237] Fix regression after pr-10106 (#10160)
---
changelog_unreleased/javascript/10106.md | 2 +-
src/language-js/print/array.js | 18 +++++-----
.../arrays/__snapshots__/jsfmt.spec.js.snap | 36 +++++++++++++++++++
tests/js/arrays/issue-10159.js | 4 +++
4 files changed, 51 insertions(+), 9 deletions(-)
create mode 100644 tests/js/arrays/issue-10159.js
diff --git a/changelog_unreleased/javascript/10106.md b/changelog_unreleased/javascript/10106.md
index 63c2da6c5..cacf58331 100644
--- a/changelog_unreleased/javascript/10106.md
+++ b/changelog_unreleased/javascript/10106.md
@@ -1,4 +1,4 @@
-#### Concise formatting of number-only arrays (#10106 by @thorn0)
+#### Concise formatting of number-only arrays (#10106, #10160 by @thorn0)
While in general, Prettier avoids this kind of formatting because it's not diff-friendly, in this special case we decided that the benefits outweigh the risks.
diff --git a/src/language-js/print/array.js b/src/language-js/print/array.js
index d503caf56..afa53aafb 100644
--- a/src/language-js/print/array.js
+++ b/src/language-js/print/array.js
@@ -57,14 +57,6 @@ function printArray(path, options, print) {
const groupId = Symbol("array");
- const trailingComma = !canHaveTrailingComma
- ? ""
- : needsForcedTrailingComma
- ? ","
- : !shouldPrintComma(options)
- ? ""
- : ifBreak(",", "", { groupId });
-
const shouldBreak =
!options.__inJestEach &&
n.elements.length > 1 &&
@@ -106,6 +98,16 @@ function printArray(path, options, print) {
)
);
+ const trailingComma = !canHaveTrailingComma
+ ? ""
+ : needsForcedTrailingComma
+ ? ","
+ : !shouldPrintComma(options)
+ ? ""
+ : shouldUseConciseFormatting
+ ? ifBreak(",", "", { groupId })
+ : ifBreak(",");
+
parts.push(
group(
[
diff --git a/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
index 9d428d70d..a5e5d3eac 100644
--- a/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrays/__snapshots__/jsfmt.spec.js.snap
@@ -35,6 +35,42 @@ new Test().test().test([, 0]).test();
================================================================================
`;
+exports[`issue-10159.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+{for (const srcPath of [src, \`\${src}.js\`, \`\${src}/index\`, \`\${src}/index.js\`]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_43]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_432]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_4321]) {}}
+
+=====================================output=====================================
+{
+ for (const srcPath of [src, \`\${src}.js\`, \`\${src}/index\`, \`\${src}/index.js\`]) {
+ }
+}
+{
+ for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_43]) {
+ }
+}
+{
+ for (const srcPath of [
+ 123, 123_123_123, 123_123_123_1, 13_123_3123_31_432,
+ ]) {
+ }
+}
+{
+ for (const srcPath of [
+ 123, 123_123_123, 123_123_123_1, 13_123_3123_31_4321,
+ ]) {
+ }
+}
+
+================================================================================
+`;
+
exports[`last.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
diff --git a/tests/js/arrays/issue-10159.js b/tests/js/arrays/issue-10159.js
new file mode 100644
index 000000000..7b86423b4
--- /dev/null
+++ b/tests/js/arrays/issue-10159.js
@@ -0,0 +1,4 @@
+{for (const srcPath of [src, `${src}.js`, `${src}/index`, `${src}/index.js`]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_43]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_432]) {}}
+{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_4321]) {}}
From 78b38d2282ab28a4638c4de0a262fcf121c05a15 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Fri, 29 Jan 2021 21:48:34 +0200
Subject: [PATCH 038/237] Round-trippable --debug-print-doc (#10169)
---
changelog_unreleased/cli/10169.md | 3 +
commands.md | 9 +
cspell.json | 1 +
src/document/doc-builders.js | 18 +-
src/document/doc-debug.js | 201 +++++++++++-------
src/document/doc-utils.js | 6 +-
src/language-markdown/printer-markdown.js | 4 +-
.../__tests__/__snapshots__/debug-api.js.snap | 1 -
tests_integration/__tests__/debug-api.js | 20 +-
.../__tests__/debug-print-doc.js | 2 +-
10 files changed, 171 insertions(+), 94 deletions(-)
create mode 100644 changelog_unreleased/cli/10169.md
diff --git a/changelog_unreleased/cli/10169.md b/changelog_unreleased/cli/10169.md
new file mode 100644
index 000000000..60abb7d50
--- /dev/null
+++ b/changelog_unreleased/cli/10169.md
@@ -0,0 +1,3 @@
+#### Round-trippable `--debug-print-doc` (#10169 by @thorn0)
+
+The idea is to make the output of `--debug-print-doc` closer to actual code for generating docs (Prettier's intermediate representation). Ideally, it should be possible for it to work without modification after copy-pasting into a JS file. That ideal hasn't probably been reached by this PR, but it's pretty close. This is going to make `--debug-print-doc` and the corresponding part of the Playground a bit more useful.
diff --git a/commands.md b/commands.md
index 0a0145418..ced50fa62 100644
--- a/commands.md
+++ b/commands.md
@@ -237,6 +237,15 @@ declare var trim: Doc;
This will trim any whitespace or tab character on the current line. This is used for preprocessor directives.
+### hardlineWithoutBreakParent and literallineWithoutBreakParent
+
+These are used very rarely, for advanced formatting tricks.
+
+Examples:
+
+- `hardlineWithoutBreakParent` is used for printing tables in Prettier's Markdown printer. With `proseWrap` set to `never`, the columns are aligned only if none of the rows exceeds `printWidth`.
+- `literallineWithoutBreakParent` (called `literalLineNoBreak` [there](https://github.com/prettier/plugin-ruby/blob/9e658db13d3f0524d816528e060b1381e0431559/src/ruby/nodes/heredocs.js)) is used in the [Ruby plugin](https://github.com/prettier/plugin-ruby) for printing heredoc syntax.
+
### cursor
```ts
diff --git a/cspell.json b/cspell.json
index 8edacecc9..81a7a1e1f 100644
--- a/cspell.json
+++ b/cspell.json
@@ -370,6 +370,7 @@
"Tomasek",
"Tradeshift",
"Transloadit",
+ "trippable",
"TSAs",
"tsep",
"TSESTree",
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index ad08e1775..3b3c90da8 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -186,13 +186,19 @@ function lineSuffix(contents) {
const lineSuffixBoundary = { type: "line-suffix-boundary" };
const breakParent = { type: "break-parent" };
const trim = { type: "trim" };
+
+const hardlineWithoutBreakParent = { type: "line", hard: true };
+const literallineWithoutBreakParent = {
+ type: "line",
+ hard: true,
+ literal: true,
+};
+
const line = { type: "line" };
const softline = { type: "line", soft: true };
-const hardline = concat([{ type: "line", hard: true }, breakParent]);
-const literalline = concat([
- { type: "line", hard: true, literal: true },
- breakParent,
-]);
+const hardline = concat([hardlineWithoutBreakParent, breakParent]);
+const literalline = concat([literallineWithoutBreakParent, breakParent]);
+
const cursor = { type: "cursor", placeholder: Symbol("cursor") };
/**
@@ -257,4 +263,6 @@ module.exports = {
markAsRoot,
dedentToRoot,
dedent,
+ hardlineWithoutBreakParent,
+ literallineWithoutBreakParent,
};
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index 0c31aa99f..11926eca1 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -5,13 +5,11 @@ const { isConcat, getDocParts } = require("./doc-utils");
function flattenDoc(doc) {
if (isConcat(doc)) {
const res = [];
- const parts = getDocParts(doc);
- for (let i = 0; i < parts.length; ++i) {
- const doc2 = parts[i];
- if (typeof doc2 !== "string" && isConcat(doc2)) {
- res.push(...flattenDoc(doc2).parts);
+ for (const part of getDocParts(doc)) {
+ if (isConcat(part)) {
+ res.push(...flattenDoc(part).parts);
} else {
- const flattened = flattenDoc(doc2);
+ const flattened = flattenDoc(part);
if (flattened !== "") {
res.push(flattened);
}
@@ -35,100 +33,149 @@ function flattenDoc(doc) {
? doc.expandedStates.map(flattenDoc)
: doc.expandedStates,
};
+ } else if (doc.type === "fill") {
+ return { type: "fill", parts: doc.parts.map(flattenDoc) };
} else if (doc.contents) {
return { ...doc, contents: flattenDoc(doc.contents) };
}
return doc;
}
-function printDoc(doc) {
- if (typeof doc === "string") {
- return JSON.stringify(doc);
- }
+function printDocToDebug(doc) {
+ /** @type Record */
+ const printedSymbols = Object.create(null);
+ /** @type Set */
+ const usedKeysForSymbols = new Set();
+ return printDoc(flattenDoc(doc));
- if (isConcat(doc)) {
- return "[" + getDocParts(doc).map(printDoc).join(", ") + "]";
- }
-
- if (doc.type === "line") {
- if (doc.literal) {
- return "literalline";
+ function printDoc(doc, index, parentParts) {
+ if (typeof doc === "string") {
+ return JSON.stringify(doc);
}
- if (doc.hard) {
- return "hardline";
+
+ if (isConcat(doc)) {
+ return `[${getDocParts(doc).map(printDoc).filter(Boolean).join(", ")}]`;
}
- if (doc.soft) {
- return "softline";
+
+ if (doc.type === "line") {
+ const withBreakParent =
+ Array.isArray(parentParts) &&
+ parentParts[index + 1] &&
+ parentParts[index + 1].type === "break-parent";
+ if (doc.literal) {
+ return withBreakParent
+ ? "literalline"
+ : "literallineWithoutBreakParent";
+ }
+ if (doc.hard) {
+ return withBreakParent ? "hardline" : "hardlineWithoutBreakParent";
+ }
+ if (doc.soft) {
+ return "softline";
+ }
+ return "line";
}
- return "line";
- }
- if (doc.type === "break-parent") {
- return "breakParent";
- }
+ if (doc.type === "break-parent") {
+ const afterHardline =
+ Array.isArray(parentParts) &&
+ parentParts[index - 1] &&
+ parentParts[index - 1].type === "line" &&
+ parentParts[index - 1].hard;
+ return afterHardline ? undefined : "breakParent";
+ }
- if (doc.type === "trim") {
- return "trim";
- }
+ if (doc.type === "trim") {
+ return "trim";
+ }
- if (doc.type === "indent") {
- return "indent(" + printDoc(doc.contents) + ")";
- }
+ if (doc.type === "indent") {
+ return "indent(" + printDoc(doc.contents) + ")";
+ }
- if (doc.type === "align") {
- return doc.n === Number.NEGATIVE_INFINITY
- ? "dedentToRoot(" + printDoc(doc.contents) + ")"
- : doc.n < 0
- ? "dedent(" + printDoc(doc.contents) + ")"
- : doc.n.type === "root"
- ? "markAsRoot(" + printDoc(doc.contents) + ")"
- : "align(" + JSON.stringify(doc.n) + ", " + printDoc(doc.contents) + ")";
- }
+ if (doc.type === "align") {
+ return doc.n === Number.NEGATIVE_INFINITY
+ ? "dedentToRoot(" + printDoc(doc.contents) + ")"
+ : doc.n < 0
+ ? "dedent(" + printDoc(doc.contents) + ")"
+ : doc.n.type === "root"
+ ? "markAsRoot(" + printDoc(doc.contents) + ")"
+ : "align(" +
+ JSON.stringify(doc.n) +
+ ", " +
+ printDoc(doc.contents) +
+ ")";
+ }
- if (doc.type === "if-break") {
- return (
- "ifBreak(" +
- printDoc(doc.breakContents) +
- (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") +
- ")"
- );
- }
-
- if (doc.type === "group") {
- if (doc.expandedStates) {
+ if (doc.type === "if-break") {
return (
- "conditionalGroup(" +
- "[" +
- doc.expandedStates.map(printDoc).join(",") +
- "])"
+ "ifBreak(" +
+ printDoc(doc.breakContents) +
+ (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") +
+ (doc.groupId
+ ? (!doc.flatContents ? ', ""' : "") +
+ `, { groupId: ${printGroupId(doc.groupId)} }`
+ : "") +
+ ")"
);
}
- return (
- (doc.break ? "wrappedGroup" : "group") +
- "(" +
- printDoc(doc.contents) +
- ")"
- );
+ if (doc.type === "group") {
+ const optionsParts = [];
+
+ if (doc.break && doc.break !== "propagated") {
+ optionsParts.push("break: true");
+ }
+
+ if (doc.id) {
+ optionsParts.push(`id: ${printGroupId(doc.id)}`);
+ }
+
+ const options =
+ optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : "";
+
+ if (doc.expandedStates) {
+ return `conditionalGroup([${doc.expandedStates
+ .map(printDoc)
+ .join(",")}]${options})`;
+ }
+
+ return `group(${printDoc(doc.contents)}${options})`;
+ }
+
+ if (doc.type === "fill") {
+ return `fill([${doc.parts.map(printDoc).join(", ")}])`;
+ }
+
+ if (doc.type === "line-suffix") {
+ return "lineSuffix(" + printDoc(doc.contents) + ")";
+ }
+
+ if (doc.type === "line-suffix-boundary") {
+ return "lineSuffixBoundary";
+ }
+
+ throw new Error("Unknown doc type " + doc.type);
}
- if (doc.type === "fill") {
- return "fill" + "(" + doc.parts.map(printDoc).join(", ") + ")";
- }
+ function printGroupId(id) {
+ if (typeof id !== "symbol") {
+ return JSON.stringify(String(id));
+ }
- if (doc.type === "line-suffix") {
- return "lineSuffix(" + printDoc(doc.contents) + ")";
- }
+ if (id in printedSymbols) {
+ return printedSymbols[id];
+ }
- if (doc.type === "line-suffix-boundary") {
- return "lineSuffixBoundary";
+ const prefix = id.description || "symbol";
+ for (let counter = 0; ; counter++) {
+ const key = prefix + (counter > 0 ? ` #${counter}` : "");
+ if (!usedKeysForSymbols.has(key)) {
+ usedKeysForSymbols.add(key);
+ return (printedSymbols[id] = `Symbol.for(${JSON.stringify(key)})`);
+ }
+ }
}
-
- throw new Error("Unknown doc type " + doc.type);
}
-module.exports = {
- printDocToDebug(doc) {
- return printDoc(flattenDoc(doc));
- },
-};
+module.exports = { printDocToDebug };
diff --git a/src/document/doc-utils.js b/src/document/doc-utils.js
index 34f1ba1f2..738527336 100644
--- a/src/document/doc-utils.js
+++ b/src/document/doc-utils.js
@@ -131,8 +131,10 @@ function breakParentGroup(groupStack) {
const parentGroup = groupStack[groupStack.length - 1];
// Breaks are not propagated through conditional groups because
// the user is expected to manually handle what breaks.
- if (!parentGroup.expandedStates) {
- parentGroup.break = true;
+ if (!parentGroup.expandedStates && !parentGroup.break) {
+ // An alternative truthy value allows to distinguish propagated group breaks
+ // and not to print them as `group(..., { break: true })` in `--debug-print-doc`.
+ parentGroup.break = "propagated";
}
}
return null;
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
index c31e1b394..179132dc2 100644
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -21,8 +21,9 @@ const {
align,
indent,
group,
+ hardlineWithoutBreakParent,
},
- utils: { normalizeDoc, getDocParts },
+ utils: { normalizeDoc },
printer: { printDocToString },
} = require("../document");
const { replaceEndOfLineWith } = require("../common/util");
@@ -557,7 +558,6 @@ function printLine(path, value, options) {
}
function printTable(path, options, print) {
- const hardlineWithoutBreakParent = getDocParts(hardline)[0];
const node = path.getValue();
const columnMaxWidths = [];
diff --git a/tests_integration/__tests__/__snapshots__/debug-api.js.snap b/tests_integration/__tests__/__snapshots__/debug-api.js.snap
index 455167804..80e57f3d6 100644
--- a/tests_integration/__tests__/__snapshots__/debug-api.js.snap
+++ b/tests_integration/__tests__/__snapshots__/debug-api.js.snap
@@ -10,7 +10,6 @@ exports[`API prettier.formatDoc 1`] = `
\\";\\",
]),
hardline,
- breakParent,
];
"
`;
diff --git a/tests_integration/__tests__/debug-api.js b/tests_integration/__tests__/debug-api.js
index bf49aafcd..6451571e4 100644
--- a/tests_integration/__tests__/debug-api.js
+++ b/tests_integration/__tests__/debug-api.js
@@ -1,12 +1,9 @@
"use strict";
const {
- parse,
- formatAST,
- formatDoc,
- printToDoc,
- printDocToString,
-} = require("prettier-local").__debug;
+ __debug: { parse, formatAST, formatDoc, printToDoc, printDocToString },
+ doc: { builders },
+} = require("prettier-local");
const { outdent } = require("outdent");
const code = outdent`
@@ -45,4 +42,15 @@ describe("API", () => {
test("prettier.printDocToString", () => {
expect(stringFromDoc).toBe(formatted);
});
+
+ const doc2 = new Function(
+ `{ ${Object.keys(builders)} }`,
+ `return ${formatResultFromDoc}`
+ )(builders);
+ const { formatted: stringFromDoc2 } = printDocToString(doc2, options);
+ const formatResultFromDoc2 = formatDoc(doc2, options);
+ test("output of prettier.formatDoc can be reused as code", () => {
+ expect(stringFromDoc2).toBe(formatted);
+ expect(formatResultFromDoc2).toBe(formatResultFromDoc);
+ });
});
diff --git a/tests_integration/__tests__/debug-print-doc.js b/tests_integration/__tests__/debug-print-doc.js
index 074cbca57..fccdb0b8a 100644
--- a/tests_integration/__tests__/debug-print-doc.js
+++ b/tests_integration/__tests__/debug-print-doc.js
@@ -6,7 +6,7 @@ describe("prints doc with --debug-print-doc", () => {
runPrettier("cli/with-shebang", ["--debug-print-doc", "--parser", "babel"], {
input: "0",
}).test({
- stdout: '["0", ";", hardline, breakParent];\n',
+ stdout: '["0", ";", hardline];\n',
stderr: "",
status: 0,
});
From 56840d4890b9b70a890cc35e7da15854d92d34dc Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Sat, 30 Jan 2021 18:25:43 +0200
Subject: [PATCH 039/237] Followup for #10169: minor tweaks (#10177)
* Followup for #10169: minor tweaks
* Add Copy doc button to Playground
---
changelog_unreleased/cli/10169.md | 2 +-
src/cli/format.js | 2 +-
src/document/doc-debug.js | 5 ++-
src/main/core.js | 2 +-
.../__tests__/__snapshots__/debug-api.js.snap | 3 +-
.../__snapshots__/debug-print-doc.js.snap | 3 --
tests_integration/__tests__/debug-api.js | 24 +++++++++++-
.../__tests__/debug-print-doc.js | 3 +-
website/playground/Playground.js | 39 ++++++++++++-------
website/playground/markdown.js | 16 ++++----
10 files changed, 66 insertions(+), 33 deletions(-)
delete mode 100644 tests_integration/__tests__/__snapshots__/debug-print-doc.js.snap
diff --git a/changelog_unreleased/cli/10169.md b/changelog_unreleased/cli/10169.md
index 60abb7d50..7a0b6249a 100644
--- a/changelog_unreleased/cli/10169.md
+++ b/changelog_unreleased/cli/10169.md
@@ -1,3 +1,3 @@
-#### Round-trippable `--debug-print-doc` (#10169 by @thorn0)
+#### Round-trippable `--debug-print-doc` (#10169, #10177 by @thorn0)
The idea is to make the output of `--debug-print-doc` closer to actual code for generating docs (Prettier's intermediate representation). Ideally, it should be possible for it to work without modification after copy-pasting into a JS file. That ideal hasn't probably been reached by this PR, but it's pretty close. This is going to make `--debug-print-doc` and the corresponding part of the Playground a bit more useful.
diff --git a/src/cli/format.js b/src/cli/format.js
index e54bf7cac..0af5fa202 100644
--- a/src/cli/format.js
+++ b/src/cli/format.js
@@ -113,7 +113,7 @@ function format(context, input, opt) {
if (context.argv["debug-print-doc"]) {
const doc = prettier.__debug.printToDoc(input, opt);
- return { formatted: prettier.__debug.formatDoc(doc) };
+ return { formatted: prettier.__debug.formatDoc(doc) + "\n" };
}
if (context.argv["debug-print-comments"]) {
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index 11926eca1..f824ceb12 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -54,7 +54,8 @@ function printDocToDebug(doc) {
}
if (isConcat(doc)) {
- return `[${getDocParts(doc).map(printDoc).filter(Boolean).join(", ")}]`;
+ const printed = getDocParts(doc).map(printDoc).filter(Boolean);
+ return printed.length === 1 ? printed[0] : `[${printed.join(", ")}]`;
}
if (doc.type === "line") {
@@ -144,7 +145,7 @@ function printDocToDebug(doc) {
}
if (doc.type === "fill") {
- return `fill([${doc.parts.map(printDoc).join(", ")}])`;
+ return `fill([${doc.parts.map((part) => printDoc(part)).join(", ")}])`;
}
if (doc.type === "line-suffix") {
diff --git a/src/main/core.js b/src/main/core.js
index 47f0d1e18..feb3f169a 100644
--- a/src/main/core.js
+++ b/src/main/core.js
@@ -348,7 +348,7 @@ module.exports = {
formatDoc(doc, options) {
return formatWithCursor(printDocToDebug(doc), {
...options,
- parser: "babel",
+ parser: "__js_expression",
}).formatted;
},
diff --git a/tests_integration/__tests__/__snapshots__/debug-api.js.snap b/tests_integration/__tests__/__snapshots__/debug-api.js.snap
index 80e57f3d6..97cbf03f8 100644
--- a/tests_integration/__tests__/__snapshots__/debug-api.js.snap
+++ b/tests_integration/__tests__/__snapshots__/debug-api.js.snap
@@ -10,6 +10,5 @@ exports[`API prettier.formatDoc 1`] = `
\\";\\",
]),
hardline,
-];
-"
+]"
`;
diff --git a/tests_integration/__tests__/__snapshots__/debug-print-doc.js.snap b/tests_integration/__tests__/__snapshots__/debug-print-doc.js.snap
deleted file mode 100644
index d4087111d..000000000
--- a/tests_integration/__tests__/__snapshots__/debug-print-doc.js.snap
+++ /dev/null
@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`prints doc with --debug-print-doc (write) 1`] = `Array []`;
diff --git a/tests_integration/__tests__/debug-api.js b/tests_integration/__tests__/debug-api.js
index 6451571e4..69c556ef5 100644
--- a/tests_integration/__tests__/debug-api.js
+++ b/tests_integration/__tests__/debug-api.js
@@ -2,7 +2,10 @@
const {
__debug: { parse, formatAST, formatDoc, printToDoc, printDocToString },
- doc: { builders },
+ doc: {
+ builders,
+ utils: { cleanDoc },
+ },
} = require("prettier-local");
const { outdent } = require("outdent");
@@ -53,4 +56,23 @@ describe("API", () => {
expect(stringFromDoc2).toBe(formatted);
expect(formatResultFromDoc2).toBe(formatResultFromDoc);
});
+
+ test("prettier.formatDoc prints things as expected", () => {
+ const { indent, hardline, literalline, fill } = builders;
+
+ expect(formatDoc([indent(hardline), indent(literalline)])).toBe(
+ "[indent(hardline), indent(literalline)]"
+ );
+
+ expect(formatDoc(fill(["foo", hardline, "bar", literalline, "baz"]))).toBe(
+ 'fill(["foo", hardline, "bar", literalline, "baz"])'
+ );
+
+ expect(
+ formatDoc(
+ // The argument of fill must not be passed to cleanDoc because it's not a doc
+ fill(cleanDoc(["foo", literalline, "bar"])) // invalid fill
+ )
+ ).toBe('fill(["foo", literallineWithoutBreakParent, breakParent, "bar"])');
+ });
});
diff --git a/tests_integration/__tests__/debug-print-doc.js b/tests_integration/__tests__/debug-print-doc.js
index fccdb0b8a..aa0995cdf 100644
--- a/tests_integration/__tests__/debug-print-doc.js
+++ b/tests_integration/__tests__/debug-print-doc.js
@@ -6,8 +6,9 @@ describe("prints doc with --debug-print-doc", () => {
runPrettier("cli/with-shebang", ["--debug-print-doc", "--parser", "babel"], {
input: "0",
}).test({
- stdout: '["0", ";", hardline];\n',
+ stdout: '["0", ";", hardline]\n',
stderr: "",
status: 0,
+ write: [],
});
});
diff --git a/website/playground/Playground.js b/website/playground/Playground.js
index 16d5ad998..2e512fb42 100644
--- a/website/playground/Playground.js
+++ b/website/playground/Playground.js
@@ -134,20 +134,21 @@ class Playground extends React.Component {
});
}
- getMarkdown(formatted, reformatted, full) {
+ getMarkdown({ formatted, reformatted, full, doc }) {
const { content, options } = this.state;
const { availableOptions, version } = this.props;
- return formatMarkdown(
- content,
- formatted,
- reformatted || "",
+ return formatMarkdown({
+ input: content,
+ output: formatted,
+ output2: reformatted,
+ doc,
version,
- window.location.href,
+ url: window.location.href,
options,
- util.buildCliArgs(availableOptions, options),
- full
- );
+ cliOptions: util.buildCliArgs(availableOptions, options),
+ full,
+ });
}
render() {
@@ -172,11 +173,11 @@ class Playground extends React.Component {
reformat={editorState.showSecondFormat}
>
{({ formatted, debug }) => {
- const fullReport = this.getMarkdown(
+ const fullReport = this.getMarkdown({
formatted,
- debug.reformatted,
- true
- );
+ reformatted: debug.reformatted,
+ full: true,
+ });
const showFullReport =
encodeURIComponent(fullReport).length < MAX_LENGTH;
return (
@@ -241,6 +242,13 @@ class Playground extends React.Component {
checked={editorState.showSecondFormat}
onChange={editorState.toggleSecondFormat}
/>
+ {editorState.showDoc && debug.doc && (
+ this.getMarkdown({ doc: debug.doc })}
+ >
+ Copy doc
+
+ )}
@@ -315,7 +323,10 @@ class Playground extends React.Component {
- this.getMarkdown(formatted, debug.reformatted)
+ this.getMarkdown({
+ formatted,
+ reformatted: debug.reformatted,
+ })
}
>
Copy markdown
diff --git a/website/playground/markdown.js b/website/playground/markdown.js
index 9a1214b00..c69de3e67 100644
--- a/website/playground/markdown.js
+++ b/website/playground/markdown.js
@@ -1,16 +1,17 @@
-function formatMarkdown(
+function formatMarkdown({
input,
output,
output2,
+ doc,
version,
url,
options,
cliOptions,
- full
-) {
+ full,
+}) {
const syntax = getMarkdownSyntax(options);
const optionsString = formatCLIOptions(cliOptions);
- const isIdempotent = output2 === "" || output === output2;
+ const isIdempotent = !output2 || output === output2;
return [
`**Prettier ${version}**`,
@@ -19,9 +20,10 @@ function formatMarkdown(
"",
"**Input:**",
codeBlock(input, syntax),
- "",
- "**Output:**",
- codeBlock(output, syntax),
+ ...(doc ? ["", "**Doc:**", codeBlock(doc, "js")] : []),
+ ...(output === undefined
+ ? []
+ : ["", "**Output:**", codeBlock(output, syntax)]),
...(isIdempotent
? []
: ["", "**Second Output:**", codeBlock(output2, syntax)]),
From 2c1b8f6fab1f9c63ab5d937908d090d8e75e8072 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 31 Jan 2021 01:01:22 +0800
Subject: [PATCH 040/237] Build(deps-dev): Bump webpack from 5.17.0 to 5.18.0
in /website (#10150)
Bumps [webpack](https://github.com/webpack/webpack) from 5.17.0 to 5.18.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.17.0...v5.18.0)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/website/package.json b/website/package.json
index 964cb66b0..0ca86fe7f 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.17.0",
+ "webpack": "5.18.0",
"webpack-cli": "4.4.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index 59b0662a1..dc0d428c0 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -7439,10 +7439,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.17.0:
- version "5.17.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.17.0.tgz#e92aebad45be25f86f788dc72fc11daacdcfd55d"
- integrity sha512-R+IdNEaYcYaACpXZOt7reyc8txBK7J06lOPkX1SbgmeoAnUbyBZivJIksrDBnmMA3wlTWvPcX7DubxELyPB8rA==
+webpack@5.18.0:
+ version "5.18.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.18.0.tgz#bbcf13094aa0da0534d513f27d7ee72d74e499c6"
+ integrity sha512-RmiP/iy6ROvVe/S+u0TrvL/oOmvP+2+Bs8MWjvBwwY/j82Q51XJyDJ75m0QAGntL1Wx6B//Xc0+4VPP/hlNHmw==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From f04b2b991c48c626789a19eb9339a10925f5f399 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Mon, 1 Feb 2021 13:14:04 +0800
Subject: [PATCH 041/237] Enable `no-implicit-coercion` rule (#10186)
---
.eslintrc.yml | 1 +
jest.config.js | 2 +-
src/cli/format.js | 7 +++----
src/config/resolve-config.js | 6 +++---
src/document/doc-builders.js | 2 +-
src/language-css/utils.js | 2 +-
src/language-graphql/printer-graphql.js | 2 +-
src/language-js/embed/html.js | 2 +-
src/language-js/needs-parens.js | 2 +-
src/language-js/print/class.js | 4 ++--
src/language-js/print/jsx.js | 2 +-
src/language-js/printer-estree.js | 4 ++--
src/language-js/utils.js | 2 +-
src/language-markdown/printer-markdown.js | 2 +-
src/main/multiparser.js | 10 +++++-----
tests_integration/runPrettier.js | 6 +++---
16 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 37c6964be..538619561 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -27,6 +27,7 @@ rules:
- devDependencies: ["tests*/**", "scripts/**"]
import/order: error
no-else-return: error
+ no-implicit-coercion: error
no-inner-declarations: error
no-unneeded-ternary: error
no-useless-return: error
diff --git a/jest.config.js b/jest.config.js
index 2ac2c033e..24e278d81 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -3,7 +3,7 @@
const installPrettier = require("./scripts/install-prettier");
const isProduction = process.env.NODE_ENV === "production";
-const ENABLE_CODE_COVERAGE = !!process.env.ENABLE_CODE_COVERAGE;
+const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
if (isProduction || process.env.INSTALL_PACKAGE) {
process.env.PRETTIER_DIR = installPrettier();
}
diff --git a/src/cli/format.js b/src/cli/format.js
index 0af5fa202..d9fcc8d12 100644
--- a/src/cli/format.js
+++ b/src/cli/format.js
@@ -197,13 +197,12 @@ function format(context, input, opt) {
repeat +
" times."
);
- // should be using `performance.now()`, but only `Date` is cross-platform enough
- const now = Date.now ? () => Date.now() : () => +new Date();
let totalMs = 0;
for (let i = 0; i < repeat; ++i) {
- const startMs = now();
+ // should be using `performance.now()`, but only `Date` is cross-platform enough
+ const startMs = Date.now();
prettier.formatWithCursor(input, opt);
- totalMs += now() - startMs;
+ totalMs += Date.now() - startMs;
}
const averageMs = totalMs / repeat;
const results = {
diff --git a/src/config/resolve-config.js b/src/config/resolve-config.js
index 011fb6a50..441e6ff9c 100644
--- a/src/config/resolve-config.js
+++ b/src/config/resolve-config.js
@@ -68,9 +68,9 @@ function getExplorer(opts) {
function _resolveConfig(filePath, opts, sync) {
opts = { useCache: true, ...opts };
const loadOpts = {
- cache: !!opts.useCache,
- sync: !!sync,
- editorconfig: !!opts.editorconfig,
+ cache: Boolean(opts.useCache),
+ sync: Boolean(sync),
+ editorconfig: Boolean(opts.editorconfig),
};
const { load, search } = getExplorer(loadOpts);
const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index 3b3c90da8..31bff43cd 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -95,7 +95,7 @@ function group(contents, opts = {}) {
type: "group",
id: opts.id,
contents,
- break: !!opts.shouldBreak,
+ break: Boolean(opts.shouldBreak),
expandedStates: opts.expandedStates,
};
}
diff --git a/src/language-css/utils.js b/src/language-css/utils.js
index 4174f4c1d..62e38a4fe 100644
--- a/src/language-css/utils.js
+++ b/src/language-css/utils.js
@@ -96,7 +96,7 @@ function isSCSS(parser, text) {
}
function isSCSSVariable(node) {
- return !!(node && node.type === "word" && node.value.startsWith("$"));
+ return Boolean(node && node.type === "word" && node.value.startsWith("$"));
}
function isWideKeywords(value) {
diff --git a/src/language-graphql/printer-graphql.js b/src/language-graphql/printer-graphql.js
index e25367de4..c39e67ae4 100644
--- a/src/language-graphql/printer-graphql.js
+++ b/src/language-graphql/printer-graphql.js
@@ -35,7 +35,7 @@ function genericPrint(path, options, print) {
}
case "OperationDefinition": {
const hasOperation = options.originalText[locStart(n)] !== "{";
- const hasName = !!n.name;
+ const hasName = Boolean(n.name);
return [
hasOperation ? n.operation : "",
hasOperation && hasName ? [" ", path.call(print, "name")] : "",
diff --git a/src/language-js/embed/html.js b/src/language-js/embed/html.js
index cb2e41306..a7a014067 100644
--- a/src/language-js/embed/html.js
+++ b/src/language-js/embed/html.js
@@ -67,7 +67,7 @@ function format(path, print, textToDoc, options, { parser }) {
continue;
}
- const placeholderIndex = +component;
+ const placeholderIndex = Number(component);
parts.push(expressionDocs[placeholderIndex]);
}
diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js
index fccf92ca4..9ecb744b9 100644
--- a/src/language-js/needs-parens.js
+++ b/src/language-js/needs-parens.js
@@ -581,7 +581,7 @@ function needsParens(path, options) {
case "ArrowFunctionExpression":
switch (parent.type) {
case "PipelineTopicExpression":
- return !!(node.extra && node.extra.parenthesized);
+ return Boolean(node.extra && node.extra.parenthesized);
case "BinaryExpression":
return (
diff --git a/src/language-js/print/class.js b/src/language-js/print/class.js
index 4f53b458c..f2d90dab8 100644
--- a/src/language-js/print/class.js
+++ b/src/language-js/print/class.js
@@ -101,8 +101,8 @@ function printHardlineAfterHeritage(node) {
function hasMultipleHeritage(node) {
return (
- ["superClass", "extends", "mixins", "implements"].filter(
- (key) => !!node[key]
+ ["superClass", "extends", "mixins", "implements"].filter((key) =>
+ Boolean(node[key])
).length > 1
);
}
diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js
index 1d619a6f6..366afb9e2 100644
--- a/src/language-js/print/jsx.js
+++ b/src/language-js/print/jsx.js
@@ -713,7 +713,7 @@ function printJsx(path, options, print) {
case "JSXAttribute":
return printJsxAttribute(path, options, print);
case "JSXIdentifier":
- return "" + n.name;
+ return String(n.name);
case "JSXNamespacedName":
return join(":", [
path.call(print, "namespace"),
diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js
index a2fc6dbd5..2222cd9a4 100644
--- a/src/language-js/printer-estree.js
+++ b/src/language-js/printer-estree.js
@@ -490,7 +490,7 @@ function printPathNoParens(path, options, print, args) {
return printNumber(n.raw);
}
if (typeof n.value !== "string") {
- return "" + n.value;
+ return String(n.value);
}
return nodeStr(n, options);
case "Directive":
@@ -873,7 +873,7 @@ function printPathNoParens(path, options, print, args) {
case "ArrayTypeAnnotation":
return [path.call(print, "elementType"), "[]"];
case "BooleanLiteralTypeAnnotation":
- return "" + n.value;
+ return String(n.value);
case "EnumDeclaration":
return ["enum ", path.call(print, "id"), " ", path.call(print, "body")];
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index 744685678..e309db064 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -1160,7 +1160,7 @@ function getLeftMost(node) {
function isBitwiseOperator(operator) {
return (
- !!bitshiftOperators[operator] ||
+ Boolean(bitshiftOperators[operator]) ||
operator === "|" ||
operator === "^" ||
operator === "&"
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
index 179132dc2..15f7edd74 100644
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -892,7 +892,7 @@ function clamp(value, min, max) {
}
function hasPrettierIgnore(path) {
- const index = +path.getName();
+ const index = Number(path.getName());
if (index === 0) {
return false;
diff --git a/src/main/multiparser.js b/src/main/multiparser.js
index 5a5153f8b..50d4a440f 100644
--- a/src/main/multiparser.js
+++ b/src/main/multiparser.js
@@ -37,12 +37,12 @@ function textToDoc(
...parentOptions,
...partialNextOptions,
parentParser: parentOptions.parser,
- embeddedInHtml: !!(
+ embeddedInHtml: Boolean(
parentOptions.embeddedInHtml ||
- parentOptions.parser === "html" ||
- parentOptions.parser === "vue" ||
- parentOptions.parser === "angular" ||
- parentOptions.parser === "lwc"
+ parentOptions.parser === "html" ||
+ parentOptions.parser === "vue" ||
+ parentOptions.parser === "angular" ||
+ parentOptions.parser === "lwc"
),
originalText: text,
},
diff --git a/tests_integration/runPrettier.js b/tests_integration/runPrettier.js
index 50848a9bd..7c83ae5de 100644
--- a/tests_integration/runPrettier.js
+++ b/tests_integration/runPrettier.js
@@ -63,8 +63,8 @@ function runPrettier(dir, args = [], options = {}) {
const originalStdoutIsTTY = process.stdout.isTTY;
process.chdir(normalizeDir(dir));
- process.stdin.isTTY = !!options.isTTY;
- process.stdout.isTTY = !!options.stdoutIsTTY;
+ process.stdin.isTTY = Boolean(options.isTTY);
+ process.stdout.isTTY = Boolean(options.stdoutIsTTY);
process.argv = ["path/to/node", "path/to/prettier/bin", ...args];
jest.resetModules();
@@ -77,7 +77,7 @@ function runPrettier(dir, args = [], options = {}) {
.mockImplementation(() => SynchronousPromise.resolve(options.input || ""));
jest
.spyOn(require(thirdParty), "isCI")
- .mockImplementation(() => !!options.ci);
+ .mockImplementation(() => Boolean(options.ci));
jest
.spyOn(require(thirdParty), "cosmiconfig")
.mockImplementation((moduleName, options) =>
From a13bc4d4f33b972588aca35b34848980cc47a2ed Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 06:07:11 +0000
Subject: [PATCH 042/237] Build(deps-dev): Bump @rollup/plugin-node-resolve
from 11.1.0 to 11.1.1 (#10193)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index ecb648a3b..27fd38c2a 100644
--- a/package.json
+++ b/package.json
@@ -93,7 +93,7 @@
"@rollup/plugin-babel": "5.2.2",
"@rollup/plugin-commonjs": "16.0.0",
"@rollup/plugin-json": "4.1.0",
- "@rollup/plugin-node-resolve": "11.1.0",
+ "@rollup/plugin-node-resolve": "11.1.1",
"@rollup/plugin-replace": "2.3.4",
"@types/estree": "0.0.46",
"@types/node": "14.14.0",
diff --git a/yarn.lock b/yarn.lock
index dd0030002..9e33fd249 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1384,10 +1384,10 @@
dependencies:
"@rollup/pluginutils" "^3.0.8"
-"@rollup/plugin-node-resolve@11.1.0":
- version "11.1.0"
- resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.1.0.tgz#fa0f888297b3aebcd6534e8aba4e6fe01997649a"
- integrity sha512-ouBBppRdWJKCllDXGzJ7ZIkYbaq+5TmyP0smt1vdJCFfoZhLi31vhpmjLhyo8lreHf4RoeSNllaWrvSqHpHRog==
+"@rollup/plugin-node-resolve@11.1.1":
+ version "11.1.1"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.1.1.tgz#47bc34252914794a1b06fb50371d7520a03f91f3"
+ integrity sha512-zlBXR4eRS+2m79TsUZWhsd0slrHUYdRx4JF+aVQm+MI0wsKdlpC2vlDVjmlGvtZY1vsefOT9w3JxvmWSBei+Lg==
dependencies:
"@rollup/pluginutils" "^3.1.0"
"@types/resolve" "1.17.1"
From 815d0ab241537064a205e85a93f102026bb2f8f3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 06:08:43 +0000
Subject: [PATCH 043/237] Build(deps-dev): Bump eslint from 7.18.0 to 7.19.0
(#10191)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 27fd38c2a..a7d89dd1d 100644
--- a/package.json
+++ b/package.json
@@ -104,7 +104,7 @@
"builtin-modules": "3.2.0",
"cross-env": "7.0.3",
"cspell": "4.2.8",
- "eslint": "7.18.0",
+ "eslint": "7.19.0",
"eslint-config-prettier": "7.2.0",
"eslint-formatter-friendly": "7.0.0",
"eslint-plugin-import": "2.22.1",
diff --git a/yarn.lock b/yarn.lock
index 9e33fd249..db2c7939b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3138,10 +3138,10 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
-eslint@7.18.0:
- version "7.18.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.18.0.tgz#7fdcd2f3715a41fe6295a16234bd69aed2c75e67"
- integrity sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==
+eslint@7.19.0:
+ version "7.19.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.19.0.tgz#6719621b196b5fad72e43387981314e5d0dc3f41"
+ integrity sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==
dependencies:
"@babel/code-frame" "^7.0.0"
"@eslint/eslintrc" "^0.3.0"
From 1139ead6160c7309ea1d886a7f1ec5311337d104 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 06:17:02 +0000
Subject: [PATCH 044/237] Build(deps): Bump json5 from 2.1.3 to 2.2.0 (#10192)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index a7d89dd1d..ad8d2df76 100644
--- a/package.json
+++ b/package.json
@@ -53,7 +53,7 @@
"html-void-elements": "1.0.5",
"ignore": "4.0.6",
"jest-docblock": "26.0.0",
- "json5": "2.1.3",
+ "json5": "2.2.0",
"leven": "3.1.0",
"lines-and-columns": "1.1.6",
"linguist-languages": "7.12.2",
diff --git a/yarn.lock b/yarn.lock
index db2c7939b..85c6684fc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4910,10 +4910,10 @@ json-stringify-safe@~5.0.1:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
-json5@2.1.3, json5@^2.1.2:
- version "2.1.3"
- resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
- integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
+json5@2.2.0, json5@^2.1.2:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
+ integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
dependencies:
minimist "^1.2.5"
From 9eda168fecada17a74733e99aae6744d17aea098 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 06:30:25 +0000
Subject: [PATCH 045/237] Build(deps-dev): Bump @rollup/plugin-alias from 3.1.1
to 3.1.2 (#10196)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index ad8d2df76..f5de1e149 100644
--- a/package.json
+++ b/package.json
@@ -89,7 +89,7 @@
"@babel/preset-env": "7.12.11",
"@babel/types": "7.12.12",
"@glimmer/reference": "0.73.2",
- "@rollup/plugin-alias": "3.1.1",
+ "@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-babel": "5.2.2",
"@rollup/plugin-commonjs": "16.0.0",
"@rollup/plugin-json": "4.1.0",
diff --git a/yarn.lock b/yarn.lock
index 85c6684fc..d7d6949e1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1349,10 +1349,10 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
-"@rollup/plugin-alias@3.1.1":
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz#bb96cf37fefeb0a953a6566c284855c7d1cd290c"
- integrity sha512-hNcQY4bpBUIvxekd26DBPgF7BT4mKVNDF5tBG4Zi+3IgwLxGYRY0itHs9D0oLVwXM5pvJDWJlBQro+au8WaUWw==
+"@rollup/plugin-alias@3.1.2":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-3.1.2.tgz#c585b05be4a7782d269c69d13def56f44e417772"
+ integrity sha512-wzDnQ6v7CcoRzS0qVwFPrFdYA4Qlr+ookA217Y2Z3DPZE1R8jrFNM3jvGgOf6o6DMjbnQIn5lCIJgHPe1Bt3uw==
dependencies:
slash "^3.0.0"
From 0d0ee3c260ff5b2f0a9db3543bfb8c2ad6c9a8ff Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 06:52:06 +0000
Subject: [PATCH 046/237] Build(deps): Bump @glimmer/syntax from 0.73.2 to
0.74.0 (#10197)
---
package.json | 2 +-
yarn.lock | 28 ++++++++++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index f5de1e149..abf6af2ff 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"@angular/compiler": "11.1.1",
"@babel/code-frame": "7.12.11",
"@babel/parser": "7.12.11",
- "@glimmer/syntax": "0.73.2",
+ "@glimmer/syntax": "0.74.0",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "4.14.1",
"angular-estree-parser": "2.3.0",
diff --git a/yarn.lock b/yarn.lock
index d7d6949e1..bd1cfafab 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1071,6 +1071,13 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
+"@glimmer/interfaces@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.0.tgz#b0d79068ee085beacf3c96593d6d69f1ba4218df"
+ integrity sha512-MBmRJ9w6hnek39+YmCQik2MTqzWJkPGtBdQSg3j+qj7J4noiTP2v6H8SAuk+eTa1zuNRd875lIoaFroiPg6EqQ==
+ dependencies:
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/reference@0.73.2":
version "0.73.2"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.73.2.tgz#85bbf60e5491b93fcc2f4d883fd277ae9f0d5ed0"
@@ -1082,13 +1089,13 @@
"@glimmer/util" "0.73.2"
"@glimmer/validator" "0.73.2"
-"@glimmer/syntax@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.73.2.tgz#76438633f26b3fccb86bd7d25390a901737aa530"
- integrity sha512-neZvKpfJETtUxnZMdpmD9qi4E9WaKhnQt63H+0iHkz1APriIZM5rsq12oiG9MSCvEiF5iP3auwJMU22XKPtyeQ==
+"@glimmer/syntax@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.74.0.tgz#4f0536c1f07c2cacd0a53056c62403e2618860b8"
+ integrity sha512-kpDEnZHx+cxE1U/MimymavIH6a2PXF5klzIIEgge5dPEgi3pP+MkimyHMe5XDGBJId75CwgKV85cotJ8Pobg1g==
dependencies:
- "@glimmer/interfaces" "0.73.2"
- "@glimmer/util" "0.73.2"
+ "@glimmer/interfaces" "0.74.0"
+ "@glimmer/util" "0.74.0"
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
@@ -1101,6 +1108,15 @@
"@glimmer/interfaces" "0.73.2"
"@simple-dom/interface" "^1.4.0"
+"@glimmer/util@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.0.tgz#bf0939db3e145d2107c35fcba1ce593982716d58"
+ integrity sha512-O6AI6vOgXOUCUZJOTQSc578Tkt9W0Qtft4wPwsxjdG6L2hm2gm+yxIJ1Mv+ZOphm2FP05dOfT18gjB5AOA4WbA==
+ dependencies:
+ "@glimmer/env" "0.1.7"
+ "@glimmer/interfaces" "0.74.0"
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/validator@0.73.2":
version "0.73.2"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.73.2.tgz#63bdeecda9904ace565063eedc7916ffb86b2981"
From 81da441ba92a9575708a734c17154631c4e95452 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 10:13:30 +0000
Subject: [PATCH 047/237] Build(deps-dev): Bump @rollup/plugin-babel from 5.2.2
to 5.2.3 (#10194)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index abf6af2ff..6049c461e 100644
--- a/package.json
+++ b/package.json
@@ -90,7 +90,7 @@
"@babel/types": "7.12.12",
"@glimmer/reference": "0.73.2",
"@rollup/plugin-alias": "3.1.2",
- "@rollup/plugin-babel": "5.2.2",
+ "@rollup/plugin-babel": "5.2.3",
"@rollup/plugin-commonjs": "16.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "11.1.1",
diff --git a/yarn.lock b/yarn.lock
index bd1cfafab..b38726751 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1372,10 +1372,10 @@
dependencies:
slash "^3.0.0"
-"@rollup/plugin-babel@5.2.2":
- version "5.2.2"
- resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.2.2.tgz#e5623a01dd8e37e004ba87f2de218c611727d9b2"
- integrity sha512-MjmH7GvFT4TW8xFdIeFS3wqIX646y5tACdxkTO+khbHvS3ZcVJL6vkAHLw2wqPmkhwCfWHoNsp15VYNwW6JEJA==
+"@rollup/plugin-babel@5.2.3":
+ version "5.2.3"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.2.3.tgz#ee8fffbaa62a6c9ccd41b1bfca32e81f847700ee"
+ integrity sha512-DOMc7nx6y5xFi86AotrFssQqCen6CxYn+zts5KSI879d4n1hggSb4TH3mjVgG17Vc3lZziWWfcXzrEmVdzPMdw==
dependencies:
"@babel/helper-module-imports" "^7.10.4"
"@rollup/pluginutils" "^3.1.0"
From c4b7b3f98b7e6a940a138aa38c8ad539398cb8e2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Feb 2021 11:00:11 +0000
Subject: [PATCH 048/237] Build(deps-dev): Bump @glimmer/reference from 0.73.2
to 0.74.0 (#10198)
---
package.json | 2 +-
yarn.lock | 50 +++++++++++++++++---------------------------------
2 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/package.json b/package.json
index 6049c461e..9246f1a94 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
"@babel/core": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/types": "7.12.12",
- "@glimmer/reference": "0.73.2",
+ "@glimmer/reference": "0.74.0",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-babel": "5.2.3",
"@rollup/plugin-commonjs": "16.0.0",
diff --git a/yarn.lock b/yarn.lock
index b38726751..db358ea9e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1057,20 +1057,13 @@
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=
-"@glimmer/global-context@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.73.2.tgz#34fc51dc5c320f067b912478e077fb3f55ff38f2"
- integrity sha512-a/q6E27JMvF5oqKRYG5RFoTH0PrHaLp/Ix6W5OZ1TqvpiiuEgd4Olb55Ehxw2jH+wvmQHQtTxFKDyv0iDJYZ1Q==
+"@glimmer/global-context@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.74.0.tgz#af7135fba958b38d0505b0e22af1d07c215ee68c"
+ integrity sha512-cR7gUiEeGuOJenVYoM3uHLIwIg+L0elvuBjeuq2y+vksaiMJy3f0LxEM3RsgPAe9AouphOF7zFec9iSxH/ploA==
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/interfaces@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.73.2.tgz#03c769208bf705760800f3f64774b074bf04f738"
- integrity sha512-SjV0/TtFiv+Sxl3WJ2I5oR6hH+EabTfk3qvllU8WAYBqf6LnNPSMjaFv2Fucn7bIvOqZ8zHl36q6HboAychD/A==
- dependencies:
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/interfaces@0.74.0":
version "0.74.0"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.0.tgz#b0d79068ee085beacf3c96593d6d69f1ba4218df"
@@ -1078,16 +1071,16 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
-"@glimmer/reference@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.73.2.tgz#85bbf60e5491b93fcc2f4d883fd277ae9f0d5ed0"
- integrity sha512-v/arQjBPvMpbVwGuCXCr7rxDteqIhnu91cu2K/7QcqmodzGC7ZhoVKWHtak3A11U1/1/6F2DznK8yHPKC/gEwg==
+"@glimmer/reference@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.0.tgz#5f14762043cfdc41ed511fca2f40ace19482de63"
+ integrity sha512-cV9+JCLXMm5RK8jSVTlsUPjFB5JwCxskFJshOKiIv11NhrYzJCzQ1vvilazfDn8xpEcQngDKr+08egYVC9aQAQ==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.73.2"
- "@glimmer/interfaces" "0.73.2"
- "@glimmer/util" "0.73.2"
- "@glimmer/validator" "0.73.2"
+ "@glimmer/global-context" "0.74.0"
+ "@glimmer/interfaces" "0.74.0"
+ "@glimmer/util" "0.74.0"
+ "@glimmer/validator" "0.74.0"
"@glimmer/syntax@0.74.0":
version "0.74.0"
@@ -1099,15 +1092,6 @@
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
-"@glimmer/util@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.73.2.tgz#32ca1cec339a91f12f0359711f1a86fc1dcc13ca"
- integrity sha512-ng726SZl/o2NKOLeHdqU9LTH4tP9FW7H1CveZGE8HMTgTDpXA7NCF7TVHqccOMmJNXqspkegtGQFGOLi10HArg==
- dependencies:
- "@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.73.2"
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/util@0.74.0":
version "0.74.0"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.0.tgz#bf0939db3e145d2107c35fcba1ce593982716d58"
@@ -1117,13 +1101,13 @@
"@glimmer/interfaces" "0.74.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/validator@0.73.2":
- version "0.73.2"
- resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.73.2.tgz#63bdeecda9904ace565063eedc7916ffb86b2981"
- integrity sha512-Bk4xLmZ6tj46yEZzeOqpPla7KHRQP2QiHLo941ieZawc8vP/tZSO0znvuA+SXbqpSjxPPyjMtsXfYiUK7rLfZg==
+"@glimmer/validator@0.74.0":
+ version "0.74.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.0.tgz#43d7ae1bcbca086dacb9d33a3f8cfb2284821810"
+ integrity sha512-Z8gyFX4fRWzVEJlWs/iolRIepOAXlJs2zORpxFO6Htb2gKOfFy1rlxH+kXBtayXt7cE59xyr1aqrHHIMMMKz2Q==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.73.2"
+ "@glimmer/global-context" "0.74.0"
"@handlebars/parser@^2.0.0":
version "2.0.0"
From 62561039aca5ee7450bf3b86f05720609a786c57 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Tue, 2 Feb 2021 02:23:16 +0200
Subject: [PATCH 049/237] Playground: show sidebar by default (#10204)
Show sidebar by default. Hide if window width < height (likely mobile)
---
website/playground/EditorState.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/playground/EditorState.js b/website/playground/EditorState.js
index 08ad92371..c1b2d0c3d 100644
--- a/website/playground/EditorState.js
+++ b/website/playground/EditorState.js
@@ -7,7 +7,7 @@ export default class extends React.Component {
constructor() {
super();
this.state = {
- showSidebar: false,
+ showSidebar: window.innerWidth > window.innerHeight,
showAst: false,
showDoc: false,
showComments: false,
From 1bc457d5dea63bbef999c795e20d864041a8e516 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Tue, 2 Feb 2021 09:25:36 +0800
Subject: [PATCH 050/237] Refactor CLI (#10168)
---
src/cli/context.js | 155 ++++++++++--------
src/cli/core.js | 5 +-
src/cli/index.js | 139 ++++++++--------
src/cli/option.js | 2 +-
.../__tests__/plugin-resolution.js | 2 +-
5 files changed, 160 insertions(+), 143 deletions(-)
diff --git a/src/cli/context.js b/src/cli/context.js
index 898946b06..8509dce77 100644
--- a/src/cli/context.js
+++ b/src/cli/context.js
@@ -4,10 +4,9 @@ const pick = require("lodash/pick");
// eslint-disable-next-line no-restricted-modules
const prettier = require("../index");
-const { createLogger } = require("./logger");
const {
optionsModule,
- optionsNormalizer,
+ optionsNormalizer: { normalizeCliOptions },
utils: { arrayify },
} = require("./prettier-internal");
const minimist = require("./minimist");
@@ -21,7 +20,7 @@ const createMinimistOptions = require("./create-minimist-options");
/**
* @typedef {Object} Context
* @property logger
- * @property {string[]} args
+ * @property {string[]} rawArguments
* @property argv
* @property {string[]} filePatterns
* @property {any[]} supportOptions
@@ -30,24 +29,35 @@ const createMinimistOptions = require("./create-minimist-options");
* @property apiDefaultOptions
* @property languages
* @property {Partial[]} stack
- * @property initContext
* @property pushContextPlugins
* @property popContextPlugins
*/
class Context {
- constructor(args) {
- this.args = args;
+ constructor({ rawArguments, logger }) {
+ this.rawArguments = rawArguments;
+ this.logger = logger;
this.stack = [];
- this._updateContextArgv();
- this._normalizeContextArgv(["loglevel", "plugin", "plugin-search-dir"]);
- this.logger = createLogger(this.argv.loglevel);
- this._updateContextArgv(this.argv.plugin, this.argv["plugin-search-dir"]);
- }
- initContext() {
- // split into 2 step so that we could wrap this in a `try..catch` in cli/index.js
- this._normalizeContextArgv();
+ const {
+ plugin: plugins,
+ "plugin-search-dir": pluginSearchDirs,
+ } = parseArgvWithoutPlugins(
+ rawArguments,
+ ["plugin", "plugin-search-dir"],
+ logger
+ );
+
+ this.pushContextPlugins(plugins, pluginSearchDirs);
+
+ const argv = parseArgv(
+ rawArguments,
+ this.detailedOptions,
+ undefined,
+ logger
+ );
+ this.argv = argv;
+ this.filePatterns = argv._.map((file) => String(file));
}
/**
@@ -64,67 +74,70 @@ class Context {
"languages",
])
);
- this._updateContextOptions(plugins, pluginSearchDirs);
+
+ Object.assign(this, getContextOptions(plugins, pluginSearchDirs));
}
popContextPlugins() {
Object.assign(this, this.stack.pop());
}
-
- _updateContextArgv(plugins, pluginSearchDirs) {
- this.pushContextPlugins(plugins, pluginSearchDirs);
- const minimistOptions = createMinimistOptions(this.detailedOptions);
- const argv = minimist(this.args, minimistOptions);
- this.argv = argv;
- this.filePatterns = argv._.map((file) => String(file));
- }
-
- _normalizeContextArgv(keys) {
- const detailedOptions = !keys
- ? this.detailedOptions
- : this.detailedOptions.filter((option) => keys.includes(option.name));
- const argv = !keys ? this.argv : pick(this.argv, keys);
- this.argv = optionsNormalizer.normalizeCliOptions(argv, detailedOptions, {
- logger: this.logger,
- });
- }
-
- /**
- * @param {string[]} plugins
- * @param {string[]=} pluginSearchDirs
- */
- _updateContextOptions(plugins, pluginSearchDirs) {
- const { options: supportOptions, languages } = prettier.getSupportInfo({
- showDeprecated: true,
- showUnreleased: true,
- showInternal: true,
- plugins,
- pluginSearchDirs,
- });
- const detailedOptionMap = normalizeDetailedOptionMap({
- ...createDetailedOptionMap(supportOptions),
- ...constant.options,
- });
-
- const detailedOptions = arrayify(detailedOptionMap, "name");
-
- const apiDefaultOptions = {
- ...optionsModule.hiddenDefaults,
- ...fromPairs(
- supportOptions
- .filter(({ deprecated }) => !deprecated)
- .map((option) => [option.name, option.default])
- ),
- };
-
- Object.assign(this, {
- supportOptions,
- detailedOptions,
- detailedOptionMap,
- apiDefaultOptions,
- languages,
- });
- }
}
-module.exports = Context;
+function getContextOptions(plugins, pluginSearchDirs) {
+ const { options: supportOptions, languages } = prettier.getSupportInfo({
+ showDeprecated: true,
+ showUnreleased: true,
+ showInternal: true,
+ plugins,
+ pluginSearchDirs,
+ });
+ const detailedOptionMap = normalizeDetailedOptionMap({
+ ...createDetailedOptionMap(supportOptions),
+ ...constant.options,
+ });
+
+ const detailedOptions = arrayify(detailedOptionMap, "name");
+
+ const apiDefaultOptions = {
+ ...optionsModule.hiddenDefaults,
+ ...fromPairs(
+ supportOptions
+ .filter(({ deprecated }) => !deprecated)
+ .map((option) => [option.name, option.default])
+ ),
+ };
+
+ return {
+ supportOptions,
+ detailedOptions,
+ detailedOptionMap,
+ apiDefaultOptions,
+ languages,
+ };
+}
+
+function parseArgv(rawArguments, detailedOptions, keys, logger) {
+ const minimistOptions = createMinimistOptions(detailedOptions);
+ let argv = minimist(rawArguments, minimistOptions);
+
+ if (keys) {
+ detailedOptions = detailedOptions.filter((option) =>
+ keys.includes(option.name)
+ );
+ argv = pick(argv, keys);
+ }
+
+ return normalizeCliOptions(argv, detailedOptions, { logger });
+}
+
+const detailedOptionsWithoutPlugins = getContextOptions().detailedOptions;
+function parseArgvWithoutPlugins(rawArguments, keys, logger) {
+ return parseArgv(
+ rawArguments,
+ detailedOptionsWithoutPlugins,
+ typeof keys === "string" ? [keys] : keys,
+ logger
+ );
+}
+
+module.exports = { Context, parseArgvWithoutPlugins };
diff --git a/src/cli/core.js b/src/cli/core.js
index d13397856..c42304e48 100644
--- a/src/cli/core.js
+++ b/src/cli/core.js
@@ -8,12 +8,13 @@ const stringify = require("fast-json-stable-stringify");
const prettier = require("../index");
const { format, formatStdin, formatFiles } = require("./format");
-const Context = require("./context");
+const { Context, parseArgvWithoutPlugins } = require("./context");
const {
normalizeDetailedOptionMap,
createDetailedOptionMap,
} = require("./option-map");
const { createDetailedUsage, createUsage } = require("./usage");
+const { createLogger } = require("./logger");
function logResolvedConfigPathOrDie(context) {
const configFile = prettier.resolveConfigFile.sync(
@@ -54,4 +55,6 @@ module.exports = {
logResolvedConfigPathOrDie,
logFileInfoOrDie,
normalizeDetailedOptionMap,
+ parseArgvWithoutPlugins,
+ createLogger,
};
diff --git a/src/cli/index.js b/src/cli/index.js
index 0ef3099ca..d1517ac9f 100644
--- a/src/cli/index.js
+++ b/src/cli/index.js
@@ -8,77 +8,78 @@ const stringify = require("fast-json-stable-stringify");
const prettier = require("../index");
const core = require("./core");
-function run(args) {
- const context = new core.Context(args);
-
+function run(rawArguments) {
+ const logLevel = core.parseArgvWithoutPlugins(rawArguments, "loglevel")
+ .loglevel;
+ const logger = core.createLogger(logLevel);
try {
- context.initContext();
-
- context.logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
-
- if (context.argv.check && context.argv["list-different"]) {
- context.logger.error("Cannot use --check and --list-different together.");
- process.exit(1);
- }
-
- if (context.argv.write && context.argv["debug-check"]) {
- context.logger.error("Cannot use --write and --debug-check together.");
- process.exit(1);
- }
-
- if (context.argv["find-config-path"] && context.filePatterns.length > 0) {
- context.logger.error("Cannot use --find-config-path with multiple files");
- process.exit(1);
- }
-
- if (context.argv["file-info"] && context.filePatterns.length > 0) {
- context.logger.error("Cannot use --file-info with multiple files");
- process.exit(1);
- }
-
- if (context.argv.version) {
- context.logger.log(prettier.version);
- process.exit(0);
- }
-
- if (context.argv.help !== undefined) {
- context.logger.log(
- typeof context.argv.help === "string" && context.argv.help !== ""
- ? core.createDetailedUsage(context, context.argv.help)
- : core.createUsage(context)
- );
- process.exit(0);
- }
-
- if (context.argv["support-info"]) {
- context.logger.log(
- prettier.format(stringify(prettier.getSupportInfo()), {
- parser: "json",
- })
- );
- process.exit(0);
- }
-
- const hasFilePatterns = context.filePatterns.length > 0;
- const useStdin =
- !hasFilePatterns &&
- (!process.stdin.isTTY || context.args["stdin-filepath"]);
-
- if (context.argv["find-config-path"]) {
- core.logResolvedConfigPathOrDie(context);
- } else if (context.argv["file-info"]) {
- core.logFileInfoOrDie(context);
- } else if (useStdin) {
- core.formatStdin(context);
- } else if (hasFilePatterns) {
- core.formatFiles(context);
- } else {
- context.logger.log(core.createUsage(context));
- process.exit(1);
- }
+ main(rawArguments, logger);
} catch (error) {
- context.logger.error(error.message);
- process.exit(1);
+ logger.error(error.message);
+ process.exitCode = 1;
+ }
+}
+
+function main(rawArguments, logger) {
+ const context = new core.Context({ rawArguments, logger });
+
+ logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
+
+ if (context.argv.check && context.argv["list-different"]) {
+ throw new Error("Cannot use --check and --list-different together.");
+ }
+
+ if (context.argv.write && context.argv["debug-check"]) {
+ throw new Error("Cannot use --write and --debug-check together.");
+ }
+
+ if (context.argv["find-config-path"] && context.filePatterns.length > 0) {
+ throw new Error("Cannot use --find-config-path with multiple files");
+ }
+
+ if (context.argv["file-info"] && context.filePatterns.length > 0) {
+ throw new Error("Cannot use --file-info with multiple files");
+ }
+
+ if (context.argv.version) {
+ logger.log(prettier.version);
+ return;
+ }
+
+ if (context.argv.help !== undefined) {
+ logger.log(
+ typeof context.argv.help === "string" && context.argv.help !== ""
+ ? core.createDetailedUsage(context, context.argv.help)
+ : core.createUsage(context)
+ );
+ return;
+ }
+
+ if (context.argv["support-info"]) {
+ logger.log(
+ prettier.format(stringify(prettier.getSupportInfo()), {
+ parser: "json",
+ })
+ );
+ return;
+ }
+
+ const hasFilePatterns = context.filePatterns.length > 0;
+ const useStdin =
+ !hasFilePatterns &&
+ (!process.stdin.isTTY || context.argv["stdin-filepath"]);
+
+ if (context.argv["find-config-path"]) {
+ core.logResolvedConfigPathOrDie(context);
+ } else if (context.argv["file-info"]) {
+ core.logFileInfoOrDie(context);
+ } else if (useStdin) {
+ core.formatStdin(context);
+ } else if (hasFilePatterns) {
+ core.formatFiles(context);
+ } else {
+ logger.log(core.createUsage(context));
+ process.exitCode = 1;
}
}
diff --git a/src/cli/option.js b/src/cli/option.js
index 5533e9666..bb5db7aa5 100644
--- a/src/cli/option.js
+++ b/src/cli/option.js
@@ -47,7 +47,7 @@ function parseArgsToOptions(context, overrideDefaults) {
);
return getOptions(
optionsNormalizer.normalizeCliOptions(
- minimist(context.args, {
+ minimist(context.rawArguments, {
string: minimistOptions.string,
boolean: minimistOptions.boolean,
default: cliifyOptions(overrideDefaults, apiDetailedOptionMap),
diff --git a/tests_integration/__tests__/plugin-resolution.js b/tests_integration/__tests__/plugin-resolution.js
index 15a330f56..bcd2ec785 100644
--- a/tests_integration/__tests__/plugin-resolution.js
+++ b/tests_integration/__tests__/plugin-resolution.js
@@ -122,7 +122,7 @@ describe("crashes when one of --plugin-search-dir does not exist", () => {
"--plugin-search-dir=.",
]).test({
stdout: "",
- stderr: "non-existing-dir does not exist or is not a directory",
+ stderr: "[error] non-existing-dir does not exist or is not a directory\n",
status: 1,
write: [],
});
From 04f4dd748f42695b1b2a142f33fd4dad13067f5d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 2 Feb 2021 05:59:44 +0000
Subject: [PATCH 051/237] Build(deps): Bump @glimmer/syntax from 0.74.0 to
0.74.2 (#10213)
---
package.json | 2 +-
yarn.lock | 28 ++++++++++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index 9246f1a94..6540e302e 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"@angular/compiler": "11.1.1",
"@babel/code-frame": "7.12.11",
"@babel/parser": "7.12.11",
- "@glimmer/syntax": "0.74.0",
+ "@glimmer/syntax": "0.74.2",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "4.14.1",
"angular-estree-parser": "2.3.0",
diff --git a/yarn.lock b/yarn.lock
index db358ea9e..eafa1686e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1071,6 +1071,13 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
+"@glimmer/interfaces@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.2.tgz#0a6571b67153d6c31b248ab8ddf59b4f16a4fec5"
+ integrity sha512-iemaya221twVsOEUD7McNWjHRQ7hij7rosgQI6hHQQyi8/R50f8ZevXo3MVWhni6Gkb9HKReP4Fkru7TpBjySw==
+ dependencies:
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/reference@0.74.0":
version "0.74.0"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.0.tgz#5f14762043cfdc41ed511fca2f40ace19482de63"
@@ -1082,13 +1089,13 @@
"@glimmer/util" "0.74.0"
"@glimmer/validator" "0.74.0"
-"@glimmer/syntax@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.74.0.tgz#4f0536c1f07c2cacd0a53056c62403e2618860b8"
- integrity sha512-kpDEnZHx+cxE1U/MimymavIH6a2PXF5klzIIEgge5dPEgi3pP+MkimyHMe5XDGBJId75CwgKV85cotJ8Pobg1g==
+"@glimmer/syntax@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.74.2.tgz#84efc2555356118a4a275bb8310e261afcf9b048"
+ integrity sha512-G+E2eL0xeo81zBMSkrfobejL/V4YjlAv6Uu8qubwYu/QIHj/UiyxHEMZzN1H88rWcu8iPLzTC4GzFr9Chiu2Jw==
dependencies:
- "@glimmer/interfaces" "0.74.0"
- "@glimmer/util" "0.74.0"
+ "@glimmer/interfaces" "0.74.2"
+ "@glimmer/util" "0.74.2"
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
@@ -1101,6 +1108,15 @@
"@glimmer/interfaces" "0.74.0"
"@simple-dom/interface" "^1.4.0"
+"@glimmer/util@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.2.tgz#11781773f17e7dfbc15b9e28966563557dd8630e"
+ integrity sha512-miWIwAPJ3i3/7qq4ycI/yJw3mKeN4woUn1ev3/ESTMmELKUNBeIXAnVjlANDTseoTCetgHVw6PFqy/WS6qdtVw==
+ dependencies:
+ "@glimmer/env" "0.1.7"
+ "@glimmer/interfaces" "0.74.2"
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/validator@0.74.0":
version "0.74.0"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.0.tgz#43d7ae1bcbca086dacb9d33a3f8cfb2284821810"
From 1e5f3922ded38855a25f83494f5f932e1bf7e04b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 2 Feb 2021 14:32:20 +0800
Subject: [PATCH 052/237] Build(deps): Bump
@typescript-eslint/typescript-estree from 4.14.1 to 4.14.2 (#10211)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 27 ++++++++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/package.json b/package.json
index 6540e302e..c55dba314 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.74.2",
"@iarna/toml": "2.2.5",
- "@typescript-eslint/typescript-estree": "4.14.1",
+ "@typescript-eslint/typescript-estree": "4.14.2",
"angular-estree-parser": "2.3.0",
"angular-html-parser": "1.7.1",
"camelcase": "6.2.0",
diff --git a/yarn.lock b/yarn.lock
index eafa1686e..f9f3d8d59 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1644,6 +1644,11 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa"
integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==
+"@typescript-eslint/types@4.14.2":
+ version "4.14.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.2.tgz#d96da62be22dc9dc6a06647f3633815350fb3174"
+ integrity sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q==
+
"@typescript-eslint/typescript-estree@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f"
@@ -1658,13 +1663,13 @@
semver "^7.3.2"
tsutils "^3.17.1"
-"@typescript-eslint/typescript-estree@4.14.1":
- version "4.14.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b"
- integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==
+"@typescript-eslint/typescript-estree@4.14.2":
+ version "4.14.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.2.tgz#9c5ebd8cae4d7b014f890acd81e8e17f309c9df9"
+ integrity sha512-ESiFl8afXxt1dNj8ENEZT12p+jl9PqRur+Y19m0Z/SPikGL6rqq4e7Me60SU9a2M28uz48/8yct97VQYaGl0Vg==
dependencies:
- "@typescript-eslint/types" "4.14.1"
- "@typescript-eslint/visitor-keys" "4.14.1"
+ "@typescript-eslint/types" "4.14.2"
+ "@typescript-eslint/visitor-keys" "4.14.2"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
@@ -1680,12 +1685,12 @@
"@typescript-eslint/types" "4.0.1"
eslint-visitor-keys "^2.0.0"
-"@typescript-eslint/visitor-keys@4.14.1":
- version "4.14.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91"
- integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==
+"@typescript-eslint/visitor-keys@4.14.2":
+ version "4.14.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.2.tgz#997cbe2cb0690e1f384a833f64794e98727c70c6"
+ integrity sha512-KBB+xLBxnBdTENs/rUgeUKO0UkPBRs2vD09oMRRIkj5BEN8PX1ToXV532desXfpQnZsYTyLLviS7JrPhdL154w==
dependencies:
- "@typescript-eslint/types" "4.14.1"
+ "@typescript-eslint/types" "4.14.2"
eslint-visitor-keys "^2.0.0"
"@webassemblyjs/ast@1.11.0":
From 588fb3a45b5311e294cd8f4413ee48d2aaae4539 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 2 Feb 2021 09:49:01 +0000
Subject: [PATCH 053/237] Build(deps-dev): Bump @glimmer/reference from 0.74.0
to 0.74.2 (#10214)
---
package.json | 2 +-
yarn.lock | 50 +++++++++++++++++---------------------------------
2 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/package.json b/package.json
index c55dba314..ed324fcb9 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
"@babel/core": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/types": "7.12.12",
- "@glimmer/reference": "0.74.0",
+ "@glimmer/reference": "0.74.2",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-babel": "5.2.3",
"@rollup/plugin-commonjs": "16.0.0",
diff --git a/yarn.lock b/yarn.lock
index f9f3d8d59..80c7c0ece 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1057,20 +1057,13 @@
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=
-"@glimmer/global-context@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.74.0.tgz#af7135fba958b38d0505b0e22af1d07c215ee68c"
- integrity sha512-cR7gUiEeGuOJenVYoM3uHLIwIg+L0elvuBjeuq2y+vksaiMJy3f0LxEM3RsgPAe9AouphOF7zFec9iSxH/ploA==
+"@glimmer/global-context@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.74.2.tgz#8005d63c47ead669f9246f516a0d68ce6e52896c"
+ integrity sha512-ecD254DqF3HWrML1YAU0WThrGfjFvJ17JFSb486zEMQk4DPFWhjEr5DaFSB/YEw6Vz7NtnC31VS0guW3ct/r7A==
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/interfaces@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.0.tgz#b0d79068ee085beacf3c96593d6d69f1ba4218df"
- integrity sha512-MBmRJ9w6hnek39+YmCQik2MTqzWJkPGtBdQSg3j+qj7J4noiTP2v6H8SAuk+eTa1zuNRd875lIoaFroiPg6EqQ==
- dependencies:
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/interfaces@0.74.2":
version "0.74.2"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.2.tgz#0a6571b67153d6c31b248ab8ddf59b4f16a4fec5"
@@ -1078,16 +1071,16 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
-"@glimmer/reference@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.0.tgz#5f14762043cfdc41ed511fca2f40ace19482de63"
- integrity sha512-cV9+JCLXMm5RK8jSVTlsUPjFB5JwCxskFJshOKiIv11NhrYzJCzQ1vvilazfDn8xpEcQngDKr+08egYVC9aQAQ==
+"@glimmer/reference@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.2.tgz#368520445b931769bf3624591b18a2680d36aacd"
+ integrity sha512-NVuI4k55SVSOcRkhM4qKPMNFaVmPnC7pIew0MufFZuPjsvCQm68ovtsJJkHo84BgtY4foy+9Q33cBhQz1BKK0Q==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.74.0"
- "@glimmer/interfaces" "0.74.0"
- "@glimmer/util" "0.74.0"
- "@glimmer/validator" "0.74.0"
+ "@glimmer/global-context" "0.74.2"
+ "@glimmer/interfaces" "0.74.2"
+ "@glimmer/util" "0.74.2"
+ "@glimmer/validator" "0.74.2"
"@glimmer/syntax@0.74.2":
version "0.74.2"
@@ -1099,15 +1092,6 @@
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
-"@glimmer/util@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.0.tgz#bf0939db3e145d2107c35fcba1ce593982716d58"
- integrity sha512-O6AI6vOgXOUCUZJOTQSc578Tkt9W0Qtft4wPwsxjdG6L2hm2gm+yxIJ1Mv+ZOphm2FP05dOfT18gjB5AOA4WbA==
- dependencies:
- "@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.74.0"
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/util@0.74.2":
version "0.74.2"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.2.tgz#11781773f17e7dfbc15b9e28966563557dd8630e"
@@ -1117,13 +1101,13 @@
"@glimmer/interfaces" "0.74.2"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/validator@0.74.0":
- version "0.74.0"
- resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.0.tgz#43d7ae1bcbca086dacb9d33a3f8cfb2284821810"
- integrity sha512-Z8gyFX4fRWzVEJlWs/iolRIepOAXlJs2zORpxFO6Htb2gKOfFy1rlxH+kXBtayXt7cE59xyr1aqrHHIMMMKz2Q==
+"@glimmer/validator@0.74.2":
+ version "0.74.2"
+ resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.2.tgz#e60f165345c7eb9e2ee3b4ed021d10ce6cbd262f"
+ integrity sha512-mRRjY5lcpD5IQvPGpAiuqS3EOOaC3xMYby70McH6lzH62tQffFDlqDV4uB6Z+OYVq0q+xUVvHTsLJ5ixo+BfAA==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.74.0"
+ "@glimmer/global-context" "0.74.2"
"@handlebars/parser@^2.0.0":
version "2.0.0"
From 7583e63d7ca89578592a523407da2ec434e3e990 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 2 Feb 2021 09:49:13 +0000
Subject: [PATCH 054/237] Build(deps-dev): Bump @typescript-eslint/types from
4.14.1 to 4.14.2 (#10212)
---
package.json | 2 +-
yarn.lock | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/package.json b/package.json
index ed324fcb9..f23f8427e 100644
--- a/package.json
+++ b/package.json
@@ -97,7 +97,7 @@
"@rollup/plugin-replace": "2.3.4",
"@types/estree": "0.0.46",
"@types/node": "14.14.0",
- "@typescript-eslint/types": "4.14.1",
+ "@typescript-eslint/types": "4.14.2",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"benchmark": "2.1.4",
diff --git a/yarn.lock b/yarn.lock
index 80c7c0ece..c012d16d3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1623,11 +1623,6 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2"
integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==
-"@typescript-eslint/types@4.14.1":
- version "4.14.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa"
- integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==
-
"@typescript-eslint/types@4.14.2":
version "4.14.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.2.tgz#d96da62be22dc9dc6a06647f3633815350fb3174"
From e024ec2d3f886cdbf35c2b5cf87877009e4d17a8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 2 Feb 2021 15:17:20 +0200
Subject: [PATCH 055/237] Build(deps-dev): Bump rollup from 2.37.1 to 2.38.4
(#10216)
Bumps [rollup](https://github.com/rollup/rollup) from 2.37.1 to 2.38.4.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.37.1...v2.38.4)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 17 +++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index f23f8427e..250556c48 100644
--- a/package.json
+++ b/package.json
@@ -122,7 +122,7 @@
"prettier": "2.2.1",
"pretty-bytes": "5.5.0",
"rimraf": "3.0.2",
- "rollup": "2.37.1",
+ "rollup": "2.38.4",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.4",
diff --git a/yarn.lock b/yarn.lock
index c012d16d3..76c2e180b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3554,11 +3554,16 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
-fsevents@^2.1.2, fsevents@~2.1.2:
+fsevents@^2.1.2:
version "2.1.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
+fsevents@~2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f"
+ integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==
+
function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
@@ -6272,12 +6277,12 @@ rollup-pluginutils@^2.3.1:
dependencies:
estree-walker "^0.6.1"
-rollup@2.37.1:
- version "2.37.1"
- resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.37.1.tgz#aa7aadffd75c80393f9314f9857e851b0ffd34e7"
- integrity sha512-V3ojEeyGeSdrMSuhP3diBb06P+qV4gKQeanbDv+Qh/BZbhdZ7kHV0xAt8Yjk4GFshq/WjO7R4c7DFM20AwTFVQ==
+rollup@2.38.4:
+ version "2.38.4"
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.38.4.tgz#1b84ea8728c73b1a00a6a6e9c630ec8c3fe48cea"
+ integrity sha512-B0LcJhjiwKkTl79aGVF/u5KdzsH8IylVfV56Ut6c9ouWLJcUK17T83aZBetNYSnZtXf2OHD4+2PbmRW+Fp5ulg==
optionalDependencies:
- fsevents "~2.1.2"
+ fsevents "~2.3.1"
rsvp@^4.8.4:
version "4.8.5"
From 58173be8b8e716def89ea2594672abfc842b681b Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Tue, 2 Feb 2021 22:43:43 +0200
Subject: [PATCH 056/237] docs: revise commands.md (#10181)
Co-authored-by: fisker Cheung
---
commands.md | 154 ++++++++++++++++++++++++++++++----------------------
1 file changed, 89 insertions(+), 65 deletions(-)
diff --git a/commands.md b/commands.md
index ced50fa62..7fe0c4833 100644
--- a/commands.md
+++ b/commands.md
@@ -1,20 +1,30 @@
-The core of the algorithm is implemented in `doc-{printer,builders,utils,debug}.js`. The printer should use the basic formatting abstractions provided to construct a format when printing a node. Parts of the API only exist to be compatible with recast's previous API to ease migration, but over time we can clean it up.
+The core of the algorithm is implemented in `src/document/doc-{printer,builders,utils}.js`. The printer uses the basic formatting abstractions provided to construct a format when printing a node.
-The following commands are available:
+## Prettier's intermediate representation: `Doc`
-### group
+A doc can be a string, an array of docs, or a command.
```ts
-type GroupOpts = {
+type Doc = string | Doc[] | DocCommand;
+```
+
+- _strings_ are printed directly as is (however for the algorithm to work properly they shouldn't contain line break characters)
+- _arrays_ are used to concatenate a list of docs to be printed sequentially into a single doc
+- `DocCommand` is any of the following:
+
+### `group`
+
+```ts
+type GroupOptions = {
shouldBreak?: boolean;
- expandedStates?: Doc[];
+ id?: symbol;
};
-declare function group(doc: Doc, opts?: GroupOpts): Doc;
+declare function group(doc: Doc, options?: GroupOptions): Doc;
```
Mark a group of items which the printer should try to fit on one line. This is the basic command to tell the printer when to break. Groups are usually nested, and the printer will try to fit everything on one line, but if it doesn't fit it will break the outermost group first and try again. It will continue breaking groups until everything fits (or there are no more groups to break).
-A document can force parent groups to break by including `breakParent` (see below). A hard and literal line automatically include this so they always break parent groups. Breaks are propagated to all parent groups, so if a deeply nested expression has a hard break, everything will break. This only matters for "hard" breaks, i.e. newlines that are printed no matter what and can be statically analyzed.
+A group is forced to break if it's created with the `shouldBreak` option set to `true` or if it includes [`breakParent`](#breakParent). A [hard](#hardline) and [literal](#literalline) line breaks automatically include this so they always break parent groups. Breaks are propagated to all parent groups, so if a deeply nested expression has a hard break, everything will break. This only matters for "hard" breaks, i.e. newlines that are printed no matter what and can be statically analyzed.
For example, an array will try to fit on one line:
@@ -36,17 +46,16 @@ However, if any of the items inside the array have a hard break, the array will
Functions always break after the opening curly brace no matter what, so the array breaks as well for consistent formatting. See [the implementation of `ArrayExpression`](#example) for an example.
-### conditionalGroup
+The `id` option can be used in [`ifBreak`](#ifBreak) checks.
+
+### `conditionalGroup`
This should be used as **last resort** as it triggers an exponential complexity when nested.
```ts
-type ConditionalGroupOpts = {
- shouldBreak?: boolean;
-};
declare function conditionalGroup(
alternatives: Doc[],
- opts?: ConditionalGroupOpts
+ options?: GroupOptions
): Doc;
```
@@ -56,89 +65,97 @@ This will try to print the first argument, if it fit use it, otherwise go to the
conditionalGroup([a, b, c]);
```
-### fill
+### `fill`
```ts
declare function fill(docs: Doc[]): Doc;
```
-This is an alternative type of group which behaves like text layout: it's going to add a break whenever the next element doesn't fit in the line anymore. The difference with a typical group is that it's not going to break all the separators, just the ones that are at the end of lines.
+This is an alternative type of group which behaves like text layout: it's going to add a break whenever the next element doesn't fit in the line anymore. The difference with [`group`](#group) is that it's not going to break all the separators, just the ones that are at the end of lines.
```js
-fill(["I", line, "love", line, "prettier"]);
+fill(["I", line, "love", line, "Prettier"]);
```
-### ifBreak
+Expects the `docs` argument to be an array of alternating content and line breaks. In other words, elements with odd indices must be line breaks (e.g., [`softline`](#softline)).
+
+### `ifBreak`
```ts
-declare function ifBreak(ifBreak: Doc, noBreak: Doc): Doc;
+declare function ifBreak(
+ ifBreak: Doc,
+ noBreak?: Doc,
+ options?: { groupId?: symbol }
+): Doc;
```
-Prints something if the current group breaks and something else if it doesn't.
+Print something if the current `group` or the current element of `fill` breaks and something else if it doesn't.
```js
ifBreak(";", " ");
```
-### breakParent
+`groupId` can be used to check another _already printed_ group instead of the current group.
+
+### `breakParent`
```ts
-declare var breakParent: Doc;
+declare const breakParent: Doc;
```
-Include this anywhere to force all parent groups to break. See `group` for more info. Example:
+Include this anywhere to force all parent groups to break. See [`group`](#group) for more info. Example:
```js
group([" ", expr, " ", breakParent]);
```
-### join
+### `join`
```ts
declare function join(sep: Doc, docs: Doc[]): Doc;
```
-Join an array of items with a separator.
+Join an array of docs with a separator.
-### line
+### `line`
```ts
-declare var line: Doc;
+declare const line: Doc;
```
Specify a line break. If an expression fits on one line, the line break will be replaced with a space. Line breaks always indent the next line with the current level of indentation.
-### softline
+### `softline`
```ts
-declare var softline: Doc;
+declare const softline: Doc;
```
Specify a line break. The difference from `line` is that if the expression fits on one line, it will be replaced with nothing.
-### hardline
+### `hardline`
```ts
-declare var hardline: Doc;
+declare const hardline: Doc;
```
Specify a line break that is **always** included in the output, no matter if the expression fits on one line or not.
-### literalline
+### `literalline`
```ts
-declare var literalline: Doc;
+declare const literalline: Doc;
```
-Specify a line break that is **always** included in the output, and don't indent the next line. This is used for template literals.
+Specify a line break that is **always** included in the output and doesn't indent the next line. Also, unlike `hardline`, this kind of line break preserves trailing whitespace on the line it ends. This is used for template literals.
-### lineSuffix
+### `lineSuffix`
```ts
declare function lineSuffix(suffix: Doc): Doc;
```
-This is used to implement trailing comments. In practice, it is not practical to find where the line ends and you don't want to accidentally print some code at the end of the comment. `lineSuffix` will buffer the output and flush it before any new line.
+This is used to implement trailing comments. It's not practical to constantly check where the line ends to avoid accidentally printing some code at the end of a comment. `lineSuffix` buffers docs passed to it and flushes them before any new line.
```js
["a", lineSuffix(" // comment"), ";", hardline];
@@ -150,13 +167,13 @@ will output
a; // comment
```
-### lineSuffixBoundary
+### `lineSuffixBoundary`
```ts
-declare var lineSuffixBoundary: Doc;
+declare const lineSuffixBoundary: Doc;
```
-In cases where you embed code inside of templates, comments shouldn't be able to leave the code part. lineSuffixBoundary is an explicit marker you can use to flush code in addition to newlines.
+In cases where you embed code inside of templates, comments shouldn't be able to leave the code part. `lineSuffixBoundary` is an explicit marker you can use to flush the [`lineSuffix`](#lineSuffix) buffer in addition to line breaks.
```js
["{", lineSuffix(" // comment"), lineSuffixBoundary, "}", hardline];
@@ -177,7 +194,7 @@ and **not**
{} // comment
```
-### indent
+### `indent`
```ts
declare function indent(doc: Doc): Doc;
@@ -185,7 +202,7 @@ declare function indent(doc: Doc): Doc;
Increase the level of indentation.
-### dedent
+### `dedent`
```ts
declare function dedent(doc: Doc): Doc;
@@ -193,15 +210,15 @@ declare function dedent(doc: Doc): Doc;
Decrease the level of indentation. (Each `align` is considered one level of indentation.)
-### align
+### `align`
```ts
declare function align(n: number | string, doc: Doc): Doc;
```
-This is similar to indent but it increases the level of indentation by a fixed number or a string.
-Trailing alignments in indentation are still spaces, but middle ones are transformed into one tab per `align` when `useTabs` enabled.
-If it's using in a whitespace-sensitive language, e.g. markdown, you should use `n` with string value to force print it.
+Increase the indentation by a fixed number of spaces or a string. A variant of [`indent`](#indent).
+
+When `useTabs` is enabled, trailing alignments in indentation are still spaces, but middle ones are transformed one tab per `align`. In a whitespace-sensitive context (e.g., Markdown), you should pass spaces to `align` as strings to prevent their replacement with tabs.
For example:
@@ -213,47 +230,64 @@ For example:
- `` -> `<2 space>`
- `` -> `<2 space>`
-### markAsRoot
+### `markAsRoot`
```ts
declare function markAsRoot(doc: Doc): Doc;
```
-This marks the current indentation as root for `dedentToRoot` and `literalline`s.
+Mark the current indentation as root for [`dedentToRoot`](#dedentToRoot) and [`literalline`](#literalline)s.
-### dedentToRoot
+### `dedentToRoot`
```ts
declare function dedentToRoot(doc: Doc): Doc;
```
-This will dedent the current indentation to the root marked by `markAsRoot`.
+Decrease the current indentation to the root marked by [`markAsRoot`](#markAsRoot).
-### trim
+### `trim`
```ts
-declare var trim: Doc;
+declare const trim: Doc;
```
-This will trim any whitespace or tab character on the current line. This is used for preprocessor directives.
+Trim all the indentation on the current line. This can be used for preprocessor directives. Should be placed after a line break.
-### hardlineWithoutBreakParent and literallineWithoutBreakParent
+### `hardlineWithoutBreakParent` and `literallineWithoutBreakParent`
-These are used very rarely, for advanced formatting tricks.
+_Added in v2.3.0_
+
+```ts
+declare const hardlineWithoutBreakParent: Doc;
+declare const literallineWithoutBreakParent: Doc;
+```
+
+These are used very rarely, for advanced formatting tricks. Unlike their "normal" counterparts, they don't include an implicit (`breakParent`)[#breakParent].
Examples:
- `hardlineWithoutBreakParent` is used for printing tables in Prettier's Markdown printer. With `proseWrap` set to `never`, the columns are aligned only if none of the rows exceeds `printWidth`.
-- `literallineWithoutBreakParent` (called `literalLineNoBreak` [there](https://github.com/prettier/plugin-ruby/blob/9e658db13d3f0524d816528e060b1381e0431559/src/ruby/nodes/heredocs.js)) is used in the [Ruby plugin](https://github.com/prettier/plugin-ruby) for printing heredoc syntax.
+- `literallineWithoutBreakParent` is used in the [Ruby plugin](https://github.com/prettier/plugin-ruby) for [printing heredoc syntax](https://github.com/prettier/plugin-ruby/blob/b6e7bd6bc3f70de8f146aa58ad0c8310518bf467/src/ruby/nodes/heredocs.js).
-### cursor
+### `cursor`
```ts
-declare var cursor: Doc;
+declare const cursor: Doc;
```
This is a placeholder value where the cursor is in the original input in order to find where it would be printed.
+### [Deprecated] `concat`
+
+_This command has been deprecated in v2.3.0, use `Doc[]` instead_
+
+```ts
+declare function concat(docs: Doc[]): Doc;
+```
+
+Combine an array into a single doc.
+
## Example
For an example, here's the implementation of the `ArrayExpression` node type:
@@ -279,13 +313,3 @@ group(
```
This is a group with opening and closing brackets, and possibly indented contents. Because it's a `group` it will always be broken up if any of the sub-expressions are broken.
-
-### [Deprecated] concat
-
-> This command is deprecated, use `Doc[]` instead.
-
-```ts
-declare function concat(docs: Doc[]): Doc;
-```
-
-Combine an array into a single string.
From 9bb9828199aa8c923908905b34a9bacfa367a700 Mon Sep 17 00:00:00 2001
From: xrkffgg
Date: Wed, 3 Feb 2021 10:09:04 +0800
Subject: [PATCH 057/237] CI: Fix `Mark Issue Duplicate` job (#10220)
Co-authored-by: fisker Cheung
---
.github/workflows/mark-issue-duplicate.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/mark-issue-duplicate.yml b/.github/workflows/mark-issue-duplicate.yml
index f181aaa47..1cb8ac072 100644
--- a/.github/workflows/mark-issue-duplicate.yml
+++ b/.github/workflows/mark-issue-duplicate.yml
@@ -8,8 +8,9 @@ on:
jobs:
mark-duplicate:
runs-on: ubuntu-latest
+ if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, "Duplicate of ") }}
steps:
- - uses: actions-cool/issues-helper@v2.0.0
+ - uses: actions-cool/issues-helper@v2.1.1
with:
actions: "mark-duplicate"
token: ${{ secrets.GITHUB_TOKEN }}
From a5118601e5aa1e9a1e2fe0b5bfcc5ad4ea79e822 Mon Sep 17 00:00:00 2001
From: fisker Cheing
Date: Wed, 3 Feb 2021 10:12:49 +0800
Subject: [PATCH 058/237] Fix `mark-issue-duplicate.yml`
---
.github/workflows/mark-issue-duplicate.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/mark-issue-duplicate.yml b/.github/workflows/mark-issue-duplicate.yml
index 1cb8ac072..e33e09de2 100644
--- a/.github/workflows/mark-issue-duplicate.yml
+++ b/.github/workflows/mark-issue-duplicate.yml
@@ -8,7 +8,7 @@ on:
jobs:
mark-duplicate:
runs-on: ubuntu-latest
- if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, "Duplicate of ") }}
+ if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, 'Duplicate of ') }}
steps:
- uses: actions-cool/issues-helper@v2.1.1
with:
From cf02703613c1bb1f07b9661e4d57b1f8be55cff9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 10:45:03 +0800
Subject: [PATCH 059/237] Build(deps-dev): Bump webpack from 5.18.0 to 5.19.0
in /website (#10189)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/website/package.json b/website/package.json
index 0ca86fe7f..836052dcf 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.18.0",
+ "webpack": "5.19.0",
"webpack-cli": "4.4.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index dc0d428c0..9e50aba0e 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -7439,10 +7439,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.18.0:
- version "5.18.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.18.0.tgz#bbcf13094aa0da0534d513f27d7ee72d74e499c6"
- integrity sha512-RmiP/iy6ROvVe/S+u0TrvL/oOmvP+2+Bs8MWjvBwwY/j82Q51XJyDJ75m0QAGntL1Wx6B//Xc0+4VPP/hlNHmw==
+webpack@5.19.0:
+ version "5.19.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.19.0.tgz#1a5fee84dd63557e68336b0774ac4a1c81aa2c73"
+ integrity sha512-egX19vAQ8fZ4cVYtA9Y941eqJtcZAK68mQq87MMv+GTXKZOc3TpKBBxdGX+HXUYlquPxiluNsJ1VHvwwklW7CQ==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 1fa3b1c341562b8eb11d7e055b4579720dbcfe57 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Wed, 3 Feb 2021 11:01:50 +0800
Subject: [PATCH 060/237] Playground: Allow hide `input` and `output` (#10184)
Co-authored-by: Georgii Dolzhykov
---
website/playground/EditorState.js | 4 +++
website/playground/Playground.js | 44 ++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/website/playground/EditorState.js b/website/playground/EditorState.js
index c1b2d0c3d..7ec595a22 100644
--- a/website/playground/EditorState.js
+++ b/website/playground/EditorState.js
@@ -12,11 +12,15 @@ export default class extends React.Component {
showDoc: false,
showComments: false,
showSecondFormat: false,
+ showInput: true,
+ showOutput: true,
toggleSidebar: () => this.setState(stateToggler("showSidebar")),
toggleAst: () => this.setState(stateToggler("showAst")),
toggleDoc: () => this.setState(stateToggler("showDoc")),
toggleComments: () => this.setState(stateToggler("showComments")),
toggleSecondFormat: () => this.setState(stateToggler("showSecondFormat")),
+ toggleInput: () => this.setState(stateToggler("showInput")),
+ toggleOutput: () => this.setState(stateToggler("showOutput")),
...storage.get("editor_state"),
};
}
diff --git a/website/playground/Playground.js b/website/playground/Playground.js
index 2e512fb42..9ec84dac7 100644
--- a/website/playground/Playground.js
+++ b/website/playground/Playground.js
@@ -220,6 +220,11 @@ class Playground extends React.Component {
+
)}
+
-
+ {editorState.showInput ? (
+
+ ) : null}
{editorState.showAst ? (
) : null}
-
+ {editorState.showOutput ? (
+
+ ) : null}
{editorState.showSecondFormat ? (
Date: Wed, 3 Feb 2021 12:09:53 +0800
Subject: [PATCH 061/237] Build(deps-dev): Bump webpack from 5.18.0 to 5.20.0
(#10223)
Bumps [webpack](https://github.com/webpack/webpack) from 5.18.0 to 5.20.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.18.0...v5.20.0)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 40 +++++-----------------------------------
2 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/package.json b/package.json
index 250556c48..dbfaadfc6 100644
--- a/package.json
+++ b/package.json
@@ -131,7 +131,7 @@
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
- "webpack": "5.18.0"
+ "webpack": "5.20.0"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
diff --git a/yarn.lock b/yarn.lock
index 76c2e180b..5b3064e6a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3482,14 +3482,6 @@ find-up@^4.0.0, find-up@^4.1.0:
locate-path "^5.0.0"
path-exists "^4.0.0"
-find-up@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
- integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
- dependencies:
- locate-path "^6.0.0"
- path-exists "^4.0.0"
-
flat-cache@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
@@ -5070,13 +5062,6 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
-locate-path@^6.0.0:
- version "6.0.0"
- resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
- integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
- dependencies:
- p-locate "^5.0.0"
-
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@@ -5557,7 +5542,7 @@ p-limit@^2.2.0:
dependencies:
p-try "^2.0.0"
-p-limit@^3.0.2, p-limit@^3.1.0:
+p-limit@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
@@ -5578,13 +5563,6 @@ p-locate@^4.1.0:
dependencies:
p-limit "^2.2.0"
-p-locate@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
- integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
- dependencies:
- p-limit "^3.0.2"
-
p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
@@ -5760,13 +5738,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"
-pkg-dir@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760"
- integrity sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==
- dependencies:
- find-up "^5.0.0"
-
platform@^1.3.3:
version "1.3.5"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.5.tgz#fb6958c696e07e2918d2eeda0f0bc9448d733444"
@@ -7339,10 +7310,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.18.0:
- version "5.18.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.18.0.tgz#bbcf13094aa0da0534d513f27d7ee72d74e499c6"
- integrity sha512-RmiP/iy6ROvVe/S+u0TrvL/oOmvP+2+Bs8MWjvBwwY/j82Q51XJyDJ75m0QAGntL1Wx6B//Xc0+4VPP/hlNHmw==
+webpack@5.20.0:
+ version "5.20.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.0.tgz#7225c2e780f4332aef18e0b323b8b3ec01e16d66"
+ integrity sha512-k7X/+gisrvirr4bzv8JVLzy2RhWiVzd3gA9qzS5je3lwqYrMc5F549vLOk34BoNkkUp4SIpt1rQp48pTxBMXvA==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
@@ -7362,7 +7333,6 @@ webpack@5.18.0:
loader-runner "^4.2.0"
mime-types "^2.1.27"
neo-async "^2.6.2"
- pkg-dir "^5.0.0"
schema-utils "^3.0.0"
tapable "^2.1.1"
terser-webpack-plugin "^5.1.1"
From 1d2497ccc3c212178872deb91d03fafea236ea8e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 14:32:19 +0800
Subject: [PATCH 062/237] Build(deps-dev): Bump @babel/preset-env from 7.12.11
to 7.12.13 (#10231)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 918 ++++++++++++++++++++++++++++-----------------------
2 files changed, 513 insertions(+), 407 deletions(-)
diff --git a/package.json b/package.json
index dbfaadfc6..bbdd6bc2b 100644
--- a/package.json
+++ b/package.json
@@ -86,7 +86,7 @@
},
"devDependencies": {
"@babel/core": "7.12.10",
- "@babel/preset-env": "7.12.11",
+ "@babel/preset-env": "7.12.13",
"@babel/types": "7.12.12",
"@glimmer/reference": "0.74.2",
"@rollup/plugin-alias": "3.1.2",
diff --git a/yarn.lock b/yarn.lock
index 5b3064e6a..5daf81de3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -23,10 +23,17 @@
dependencies:
"@babel/highlight" "^7.10.4"
-"@babel/compat-data@^7.12.5", "@babel/compat-data@^7.12.7":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.12.7.tgz#9329b4782a7d6bbd7eef57e11addf91ee3ef1e41"
- integrity sha512-YaxPMGs/XIWtYqrdEOZOCPsVWfEoriXopnsz3/i7apYPXQ3698UFhS6dVT1KN5qOsWmVgw/FOrmQgpRaZayGsw==
+"@babel/code-frame@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658"
+ integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==
+ dependencies:
+ "@babel/highlight" "^7.12.13"
+
+"@babel/compat-data@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.12.13.tgz#27e19e0ed3726ccf54067ced4109501765e7e2e8"
+ integrity sha512-U/hshG5R+SIoW7HVWIdmy1cB7s3ki+r3FpyEZiCgpi4tFgPnX/vynY80ZGSASOIrUM6O7VxOgCZgdt7h97bUGg==
"@babel/core@7.12.10", "@babel/core@^7.1.0", "@babel/core@^7.7.5":
version "7.12.10"
@@ -58,67 +65,65 @@
jsesc "^2.5.1"
source-map "^0.5.0"
-"@babel/helper-annotate-as-pure@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3"
- integrity sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA==
+"@babel/generator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.13.tgz#5f6ebe6c85db99886db2d7b044409196f872a503"
+ integrity sha512-9qQ8Fgo8HaSvHEt6A5+BATP7XktD/AdAnObUeTRz5/e2y3kbrxZgz32qUJJsdmwUvBJzF4AeV21nGTNwv05Mpw==
dependencies:
- "@babel/types" "^7.10.4"
+ "@babel/types" "^7.12.13"
+ jsesc "^2.5.1"
+ source-map "^0.5.0"
-"@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz#bb0b75f31bf98cbf9ff143c1ae578b87274ae1a3"
- integrity sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==
+"@babel/helper-annotate-as-pure@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab"
+ integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==
dependencies:
- "@babel/helper-explode-assignable-expression" "^7.10.4"
- "@babel/types" "^7.10.4"
+ "@babel/types" "^7.12.13"
-"@babel/helper-compilation-targets@^7.12.5":
- version "7.12.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.5.tgz#cb470c76198db6a24e9dbc8987275631e5d29831"
- integrity sha512-+qH6NrscMolUlzOYngSBMIOQpKUGPPsc61Bu5W10mg84LxZ7cmvnBHzARKbDoFxVvqqAbj6Tg6N7bSrWSPXMyw==
+"@babel/helper-builder-binary-assignment-operator-visitor@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.12.13.tgz#6bc20361c88b0a74d05137a65cac8d3cbf6f61fc"
+ integrity sha512-CZOv9tGphhDRlVjVkAgm8Nhklm9RzSmWpX2my+t7Ua/KT616pEzXsQCjinzvkRvHWJ9itO4f296efroX23XCMA==
dependencies:
- "@babel/compat-data" "^7.12.5"
- "@babel/helper-validator-option" "^7.12.1"
+ "@babel/helper-explode-assignable-expression" "^7.12.13"
+ "@babel/types" "^7.12.13"
+
+"@babel/helper-compilation-targets@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.13.tgz#d689cdef88810aa74e15a7a94186f26a3d773c98"
+ integrity sha512-dXof20y/6wB5HnLOGyLh/gobsMvDNoekcC+8MCV2iaTd5JemhFkPD73QB+tK3iFC9P0xJC73B6MvKkyUfS9cCw==
+ dependencies:
+ "@babel/compat-data" "^7.12.13"
+ "@babel/helper-validator-option" "^7.12.11"
browserslist "^4.14.5"
semver "^5.5.0"
-"@babel/helper-create-class-features-plugin@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz#3c45998f431edd4a9214c5f1d3ad1448a6137f6e"
- integrity sha512-hkL++rWeta/OVOBTRJc9a5Azh5mt5WgZUGAKMD8JM141YsE08K//bp1unBBieO6rUKkIPyUE0USQ30jAy3Sk1w==
+"@babel/helper-create-class-features-plugin@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.13.tgz#0f1707c2eec1a4604f2a22a6fb209854ef2a399a"
+ integrity sha512-Vs/e9wv7rakKYeywsmEBSRC9KtmE7Px+YBlESekLeJOF0zbGUicGfXSNi3o+tfXSNS48U/7K9mIOOCR79Cl3+Q==
dependencies:
- "@babel/helper-function-name" "^7.10.4"
- "@babel/helper-member-expression-to-functions" "^7.12.1"
- "@babel/helper-optimise-call-expression" "^7.10.4"
- "@babel/helper-replace-supers" "^7.12.1"
- "@babel/helper-split-export-declaration" "^7.10.4"
+ "@babel/helper-function-name" "^7.12.13"
+ "@babel/helper-member-expression-to-functions" "^7.12.13"
+ "@babel/helper-optimise-call-expression" "^7.12.13"
+ "@babel/helper-replace-supers" "^7.12.13"
+ "@babel/helper-split-export-declaration" "^7.12.13"
-"@babel/helper-create-regexp-features-plugin@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.1.tgz#18b1302d4677f9dc4740fe8c9ed96680e29d37e8"
- integrity sha512-rsZ4LGvFTZnzdNZR5HZdmJVuXK8834R5QkF3WvcnBhrlVtF0HSIUC6zbreL9MgjTywhKokn8RIYRiq99+DLAxA==
+"@babel/helper-create-regexp-features-plugin@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.13.tgz#0996d370a92896c612ae41a4215544bd152579c0"
+ integrity sha512-XC+kiA0J3at6E85dL5UnCYfVOcIZ834QcAY0TIpgUVnz0zDzg+0TtvZTnJ4g9L1dPRGe30Qi03XCIS4tYCLtqw==
dependencies:
- "@babel/helper-annotate-as-pure" "^7.10.4"
- "@babel/helper-regex" "^7.10.4"
+ "@babel/helper-annotate-as-pure" "^7.12.13"
regexpu-core "^4.7.1"
-"@babel/helper-define-map@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.10.4.tgz#f037ad794264f729eda1889f4ee210b870999092"
- integrity sha512-nIij0oKErfCnLUCWaCaHW0Bmtl2RO9cN7+u2QT8yqTywgALKlyUVOvHDElh+b5DwVC6YB1FOYFOTWcN/+41EDA==
+"@babel/helper-explode-assignable-expression@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.13.tgz#0e46990da9e271502f77507efa4c9918d3d8634a"
+ integrity sha512-5loeRNvMo9mx1dA/d6yNi+YiKziJZFylZnCo1nmFF4qPU4yJ14abhWESuSMQSlQxWdxdOFzxXjk/PpfudTtYyw==
dependencies:
- "@babel/helper-function-name" "^7.10.4"
- "@babel/types" "^7.10.4"
- lodash "^4.17.13"
-
-"@babel/helper-explode-assignable-expression@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.10.4.tgz#40a1cd917bff1288f699a94a75b37a1a2dbd8c7c"
- integrity sha512-4K71RyRQNPRrR85sr5QY4X3VwG4wtVoXZB9+L3r1Gp38DhELyHCtovqydRi7c1Ovb17eRGiQ/FD5s8JdU0Uy5A==
- dependencies:
- "@babel/traverse" "^7.10.4"
- "@babel/types" "^7.10.4"
+ "@babel/types" "^7.12.13"
"@babel/helper-function-name@^7.10.4":
version "7.10.4"
@@ -129,6 +134,15 @@
"@babel/template" "^7.10.4"
"@babel/types" "^7.10.4"
+"@babel/helper-function-name@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a"
+ integrity sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA==
+ dependencies:
+ "@babel/helper-get-function-arity" "^7.12.13"
+ "@babel/template" "^7.12.13"
+ "@babel/types" "^7.12.13"
+
"@babel/helper-get-function-arity@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2"
@@ -136,12 +150,19 @@
dependencies:
"@babel/types" "^7.10.4"
-"@babel/helper-hoist-variables@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz#d49b001d1d5a68ca5e6604dda01a6297f7c9381e"
- integrity sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==
+"@babel/helper-get-function-arity@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583"
+ integrity sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==
dependencies:
- "@babel/types" "^7.10.4"
+ "@babel/types" "^7.12.13"
+
+"@babel/helper-hoist-variables@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.12.13.tgz#13aba58b7480b502362316ea02f52cca0e9796cd"
+ integrity sha512-KSC5XSj5HreRhYQtZ3cnSnQwDzgnbdUDEFsxkN0m6Q3WrCRt72xrnZ8+h+pX7YxM7hr87zIO3a/v5p/H3TrnVw==
+ dependencies:
+ "@babel/types" "^7.12.13"
"@babel/helper-member-expression-to-functions@^7.12.1":
version "7.12.1"
@@ -150,12 +171,19 @@
dependencies:
"@babel/types" "^7.12.1"
-"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.5":
- version "7.12.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz#1bfc0229f794988f76ed0a4d4e90860850b54dfb"
- integrity sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==
+"@babel/helper-member-expression-to-functions@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.13.tgz#c5715695b4f8bab32660dbdcdc2341dec7e3df40"
+ integrity sha512-B+7nN0gIL8FZ8SvMcF+EPyB21KnCcZHQZFczCxbiNGV/O0rsrSBlWGLzmtBJ3GMjSVMIm4lpFhR+VdVBuIsUcQ==
dependencies:
- "@babel/types" "^7.12.5"
+ "@babel/types" "^7.12.13"
+
+"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz#ec67e4404f41750463e455cc3203f6a32e93fcb0"
+ integrity sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g==
+ dependencies:
+ "@babel/types" "^7.12.13"
"@babel/helper-module-transforms@^7.12.1":
version "7.12.1"
@@ -172,6 +200,21 @@
"@babel/types" "^7.12.1"
lodash "^4.17.19"
+"@babel/helper-module-transforms@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.13.tgz#01afb052dcad2044289b7b20beb3fa8bd0265bea"
+ integrity sha512-acKF7EjqOR67ASIlDTupwkKM1eUisNAjaSduo5Cz+793ikfnpe7p4Q7B7EWU2PCoSTPWsQkR7hRUWEIZPiVLGA==
+ dependencies:
+ "@babel/helper-module-imports" "^7.12.13"
+ "@babel/helper-replace-supers" "^7.12.13"
+ "@babel/helper-simple-access" "^7.12.13"
+ "@babel/helper-split-export-declaration" "^7.12.13"
+ "@babel/helper-validator-identifier" "^7.12.11"
+ "@babel/template" "^7.12.13"
+ "@babel/traverse" "^7.12.13"
+ "@babel/types" "^7.12.13"
+ lodash "^4.17.19"
+
"@babel/helper-optimise-call-expression@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673"
@@ -179,26 +222,26 @@
dependencies:
"@babel/types" "^7.10.4"
-"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
- integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==
-
-"@babel/helper-regex@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.10.4.tgz#59b373daaf3458e5747dece71bbaf45f9676af6d"
- integrity sha512-inWpnHGgtg5NOF0eyHlC0/74/VkdRITY9dtTpB2PrxKKn+AkVMRiZz/Adrx+Ssg+MLDesi2zohBW6MVq6b4pOQ==
+"@babel/helper-optimise-call-expression@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea"
+ integrity sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==
dependencies:
- lodash "^4.17.13"
+ "@babel/types" "^7.12.13"
-"@babel/helper-remap-async-to-generator@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz#8c4dbbf916314f6047dc05e6a2217074238347fd"
- integrity sha512-9d0KQCRM8clMPcDwo8SevNs+/9a8yWVVmaE80FGJcEP8N1qToREmWEGnBn8BUlJhYRFz6fqxeRL1sl5Ogsed7A==
+"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.12.13.tgz#174254d0f2424d8aefb4dd48057511247b0a9eeb"
+ integrity sha512-C+10MXCXJLiR6IeG9+Wiejt9jmtFpxUc3MQqCmPY8hfCjyUGl9kT+B2okzEZrtykiwrc4dbCPdDoz0A/HQbDaA==
+
+"@babel/helper-remap-async-to-generator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.13.tgz#170365f4140e2d20e5c88f8ba23c24468c296878"
+ integrity sha512-Qa6PU9vNcj1NZacZZI1Mvwt+gXDH6CTfgAkSjeRMLE8HxtDK76+YDId6NQR+z7Rgd5arhD2cIbS74r0SxD6PDA==
dependencies:
- "@babel/helper-annotate-as-pure" "^7.10.4"
- "@babel/helper-wrap-function" "^7.10.4"
- "@babel/types" "^7.12.1"
+ "@babel/helper-annotate-as-pure" "^7.12.13"
+ "@babel/helper-wrap-function" "^7.12.13"
+ "@babel/types" "^7.12.13"
"@babel/helper-replace-supers@^7.12.1":
version "7.12.1"
@@ -210,6 +253,16 @@
"@babel/traverse" "^7.12.1"
"@babel/types" "^7.12.1"
+"@babel/helper-replace-supers@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.13.tgz#00ec4fb6862546bd3d0aff9aac56074277173121"
+ integrity sha512-pctAOIAMVStI2TMLhozPKbf5yTEXc0OJa0eENheb4w09SrgOWEs+P4nTOZYJQCqs8JlErGLDPDJTiGIp3ygbLg==
+ dependencies:
+ "@babel/helper-member-expression-to-functions" "^7.12.13"
+ "@babel/helper-optimise-call-expression" "^7.12.13"
+ "@babel/traverse" "^7.12.13"
+ "@babel/types" "^7.12.13"
+
"@babel/helper-simple-access@^7.12.1":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136"
@@ -217,6 +270,13 @@
dependencies:
"@babel/types" "^7.12.1"
+"@babel/helper-simple-access@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.13.tgz#8478bcc5cacf6aa1672b251c1d2dde5ccd61a6c4"
+ integrity sha512-0ski5dyYIHEfwpWGx5GPWhH35j342JaflmCeQmsPWcrOQDtCN6C1zKAVRFVbK53lPW2c9TsuLLSUDf0tIGJ5hA==
+ dependencies:
+ "@babel/types" "^7.12.13"
+
"@babel/helper-skip-transparent-expression-wrappers@^7.12.1":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz#462dc63a7e435ade8468385c63d2b84cce4b3cbf"
@@ -224,13 +284,6 @@
dependencies:
"@babel/types" "^7.12.1"
-"@babel/helper-split-export-declaration@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1"
- integrity sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg==
- dependencies:
- "@babel/types" "^7.10.4"
-
"@babel/helper-split-export-declaration@^7.11.0":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f"
@@ -238,25 +291,32 @@
dependencies:
"@babel/types" "^7.11.0"
+"@babel/helper-split-export-declaration@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05"
+ integrity sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==
+ dependencies:
+ "@babel/types" "^7.12.13"
+
"@babel/helper-validator-identifier@^7.10.4", "@babel/helper-validator-identifier@^7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
-"@babel/helper-validator-option@^7.12.1", "@babel/helper-validator-option@^7.12.11":
+"@babel/helper-validator-option@^7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.11.tgz#d66cb8b7a3e7fe4c6962b32020a131ecf0847f4f"
integrity sha512-TBFCyj939mFSdeX7U7DDj32WtzYY7fDcalgq8v3fBZMNOJQNn7nOYzMaUCiPxPYfCup69mtIpqlKgMZLvQ8Xhw==
-"@babel/helper-wrap-function@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87"
- integrity sha512-6py45WvEF0MhiLrdxtRjKjufwLL1/ob2qDJgg5JgNdojBAZSAKnAjkyOCNug6n+OBl4VW76XjvgSFTdaMcW0Ug==
+"@babel/helper-wrap-function@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.12.13.tgz#e3ea8cb3ee0a16911f9c1b50d9e99fe8fe30f9ff"
+ integrity sha512-t0aZFEmBJ1LojdtJnhOaQEVejnzYhyjWHSsNSNo8vOYRbAJNh6r6GQF7pd36SqG7OKGbn+AewVQ/0IfYfIuGdw==
dependencies:
- "@babel/helper-function-name" "^7.10.4"
- "@babel/template" "^7.10.4"
- "@babel/traverse" "^7.10.4"
- "@babel/types" "^7.10.4"
+ "@babel/helper-function-name" "^7.12.13"
+ "@babel/template" "^7.12.13"
+ "@babel/traverse" "^7.12.13"
+ "@babel/types" "^7.12.13"
"@babel/helpers@^7.12.5":
version "7.12.5"
@@ -276,27 +336,41 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
+"@babel/highlight@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c"
+ integrity sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==
+ dependencies:
+ "@babel/helper-validator-identifier" "^7.12.11"
+ chalk "^2.0.0"
+ js-tokens "^4.0.0"
+
"@babel/parser@7.12.11", "@babel/parser@^7.1.0", "@babel/parser@^7.12.10", "@babel/parser@^7.12.7", "@babel/parser@^7.7.0":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79"
integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg==
-"@babel/plugin-proposal-async-generator-functions@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz#dc6c1170e27d8aca99ff65f4925bd06b1c90550e"
- integrity sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==
+"@babel/parser@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.13.tgz#3ee7be4131fe657ba9143d5c5b3a9f253fdb75e9"
+ integrity sha512-z7n7ybOUzaRc3wwqLpAX8UFIXsrVXUJhtNGBwAnLz6d1KUapqyq7ad2La8gZ6CXhHmGAIL32cop8Tst4/PNWLw==
+
+"@babel/plugin-proposal-async-generator-functions@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.13.tgz#d1c6d841802ffb88c64a2413e311f7345b9e66b5"
+ integrity sha512-1KH46Hx4WqP77f978+5Ye/VUbuwQld2hph70yaw2hXS2v7ER2f3nlpNMu909HO2rbvP0NKLlMVDPh9KXklVMhA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-remap-async-to-generator" "^7.12.1"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-remap-async-to-generator" "^7.12.13"
"@babel/plugin-syntax-async-generators" "^7.8.0"
-"@babel/plugin-proposal-class-properties@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz#a082ff541f2a29a4821065b8add9346c0c16e5de"
- integrity sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w==
+"@babel/plugin-proposal-class-properties@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.13.tgz#3d2ce350367058033c93c098e348161d6dc0d8c8"
+ integrity sha512-8SCJ0Ddrpwv4T7Gwb33EmW1V9PY5lggTO+A8WjyIwxrSHDUyBw4MtF96ifn1n8H806YlxbVCoKXbbmzD6RD+cA==
dependencies:
- "@babel/helper-create-class-features-plugin" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-create-class-features-plugin" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-proposal-dynamic-import@^7.12.1":
version "7.12.1"
@@ -306,87 +380,87 @@
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-syntax-dynamic-import" "^7.8.0"
-"@babel/plugin-proposal-export-namespace-from@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.1.tgz#8b9b8f376b2d88f5dd774e4d24a5cc2e3679b6d4"
- integrity sha512-6CThGf0irEkzujYS5LQcjBx8j/4aQGiVv7J9+2f7pGfxqyKh3WnmVJYW3hdrQjyksErMGBPQrCnHfOtna+WLbw==
+"@babel/plugin-proposal-export-namespace-from@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.13.tgz#393be47a4acd03fa2af6e3cde9b06e33de1b446d"
+ integrity sha512-INAgtFo4OnLN3Y/j0VwAgw3HDXcDtX+C/erMvWzuV9v71r7urb6iyMXu7eM9IgLr1ElLlOkaHjJ0SbCmdOQ3Iw==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-export-namespace-from" "^7.8.3"
-"@babel/plugin-proposal-json-strings@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.1.tgz#d45423b517714eedd5621a9dfdc03fa9f4eb241c"
- integrity sha512-GoLDUi6U9ZLzlSda2Df++VSqDJg3CG+dR0+iWsv6XRw1rEq+zwt4DirM9yrxW6XWaTpmai1cWJLMfM8qQJf+yw==
+"@babel/plugin-proposal-json-strings@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.13.tgz#ced7888a2db92a3d520a2e35eb421fdb7fcc9b5d"
+ integrity sha512-v9eEi4GiORDg8x+Dmi5r8ibOe0VXoKDeNPYcTTxdGN4eOWikrJfDJCJrr1l5gKGvsNyGJbrfMftC2dTL6oz7pg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-json-strings" "^7.8.0"
-"@babel/plugin-proposal-logical-assignment-operators@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.1.tgz#f2c490d36e1b3c9659241034a5d2cd50263a2751"
- integrity sha512-k8ZmVv0JU+4gcUGeCDZOGd0lCIamU/sMtIiX3UWnUc5yzgq6YUGyEolNYD+MLYKfSzgECPcqetVcJP9Afe/aCA==
+"@babel/plugin-proposal-logical-assignment-operators@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.13.tgz#575b5d9a08d8299eeb4db6430da6e16e5cf14350"
+ integrity sha512-fqmiD3Lz7jVdK6kabeSr1PZlWSUVqSitmHEe3Z00dtGTKieWnX9beafvavc32kjORa5Bai4QNHgFDwWJP+WtSQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-logical-assignment-operators" "^7.10.4"
-"@babel/plugin-proposal-nullish-coalescing-operator@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.1.tgz#3ed4fff31c015e7f3f1467f190dbe545cd7b046c"
- integrity sha512-nZY0ESiaQDI1y96+jk6VxMOaL4LPo/QDHBqL+SF3/vl6dHkTwHlOI8L4ZwuRBHgakRBw5zsVylel7QPbbGuYgg==
+"@babel/plugin-proposal-nullish-coalescing-operator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.13.tgz#24867307285cee4e1031170efd8a7ac807deefde"
+ integrity sha512-Qoxpy+OxhDBI5kRqliJFAl4uWXk3Bn24WeFstPH0iLymFehSAUR8MHpqU7njyXv/qbo7oN6yTy5bfCmXdKpo1Q==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0"
-"@babel/plugin-proposal-numeric-separator@^7.12.7":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.7.tgz#8bf253de8139099fea193b297d23a9d406ef056b"
- integrity sha512-8c+uy0qmnRTeukiGsjLGy6uVs/TFjJchGXUeBqlG4VWYOdJWkhhVPdQ3uHwbmalfJwv2JsV0qffXP4asRfL2SQ==
+"@babel/plugin-proposal-numeric-separator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.13.tgz#bd9da3188e787b5120b4f9d465a8261ce67ed1db"
+ integrity sha512-O1jFia9R8BUCl3ZGB7eitaAPu62TXJRHn7rh+ojNERCFyqRwJMTmhz+tJ+k0CwI6CLjX/ee4qW74FSqlq9I35w==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-numeric-separator" "^7.10.4"
-"@babel/plugin-proposal-object-rest-spread@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz#def9bd03cea0f9b72283dac0ec22d289c7691069"
- integrity sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==
+"@babel/plugin-proposal-object-rest-spread@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.13.tgz#f93f3116381ff94bc676fdcb29d71045cd1ec011"
+ integrity sha512-WvA1okB/0OS/N3Ldb3sziSrXg6sRphsBgqiccfcQq7woEn5wQLNX82Oc4PlaFcdwcWHuQXAtb8ftbS8Fbsg/sg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-object-rest-spread" "^7.8.0"
- "@babel/plugin-transform-parameters" "^7.12.1"
+ "@babel/plugin-transform-parameters" "^7.12.13"
-"@babel/plugin-proposal-optional-catch-binding@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.1.tgz#ccc2421af64d3aae50b558a71cede929a5ab2942"
- integrity sha512-hFvIjgprh9mMw5v42sJWLI1lzU5L2sznP805zeT6rySVRA0Y18StRhDqhSxlap0oVgItRsB6WSROp4YnJTJz0g==
+"@babel/plugin-proposal-optional-catch-binding@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.13.tgz#4640520afe57728af14b4d1574ba844f263bcae5"
+ integrity sha512-9+MIm6msl9sHWg58NvqpNpLtuFbmpFYk37x8kgnGzAHvX35E1FyAwSUt5hIkSoWJFSAH+iwU8bJ4fcD1zKXOzg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-optional-catch-binding" "^7.8.0"
-"@babel/plugin-proposal-optional-chaining@^7.12.7":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.7.tgz#e02f0ea1b5dc59d401ec16fb824679f683d3303c"
- integrity sha512-4ovylXZ0PWmwoOvhU2vhnzVNnm88/Sm9nx7V8BPgMvAzn5zDou3/Awy0EjglyubVHasJj+XCEkr/r1X3P5elCA==
+"@babel/plugin-proposal-optional-chaining@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.13.tgz#63a7d805bc8ce626f3234ee5421a2a7fb23f66d9"
+ integrity sha512-0ZwjGfTcnZqyV3y9DSD1Yk3ebp+sIUpT2YDqP8hovzaNZnQq2Kd7PEqa6iOIUDBXBt7Jl3P7YAcEIL5Pz8u09Q==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/helper-skip-transparent-expression-wrappers" "^7.12.1"
"@babel/plugin-syntax-optional-chaining" "^7.8.0"
-"@babel/plugin-proposal-private-methods@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz#86814f6e7a21374c980c10d38b4493e703f4a389"
- integrity sha512-mwZ1phvH7/NHK6Kf8LP7MYDogGV+DKB1mryFOEwx5EBNQrosvIczzZFTUmWaeujd5xT6G1ELYWUz3CutMhjE1w==
+"@babel/plugin-proposal-private-methods@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.13.tgz#ea78a12554d784ecf7fc55950b752d469d9c4a71"
+ integrity sha512-sV0V57uUwpauixvR7s2o75LmwJI6JECwm5oPUY5beZB1nBl2i37hc7CJGqB5G+58fur5Y6ugvl3LRONk5x34rg==
dependencies:
- "@babel/helper-create-class-features-plugin" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-create-class-features-plugin" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-proposal-unicode-property-regex@^7.12.1", "@babel/plugin-proposal-unicode-property-regex@^7.4.4":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.1.tgz#2a183958d417765b9eae334f47758e5d6a82e072"
- integrity sha512-MYq+l+PvHuw/rKUz1at/vb6nCnQ2gmJBNaM62z0OgH7B2W1D9pvkpYtlti9bGtizNIU1K3zm4bZF9F91efVY0w==
+"@babel/plugin-proposal-unicode-property-regex@^7.12.13", "@babel/plugin-proposal-unicode-property-regex@^7.4.4":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.13.tgz#bebde51339be829c17aaaaced18641deb62b39ba"
+ integrity sha512-XyJmZidNfofEkqFV5VC/bLabGmO5QzenPO/YOfGuEbgU+2sSwMmio3YLb4WtBgcmmdwZHyVyv8on77IUjQ5Gvg==
dependencies:
- "@babel/helper-create-regexp-features-plugin" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-create-regexp-features-plugin" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4":
version "7.8.4"
@@ -402,12 +476,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"
-"@babel/plugin-syntax-class-properties@^7.12.1", "@babel/plugin-syntax-class-properties@^7.8.3":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.1.tgz#bcb297c5366e79bebadef509549cd93b04f19978"
- integrity sha512-U40A76x5gTwmESz+qiqssqmeEsKvcSyvtgktrm0uzcARAmM9I1jR221f6Oq+GmHrcD+LvZDag1UTOTe2fL3TeA==
+"@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10"
+ integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-dynamic-import@^7.8.0":
version "7.8.3"
@@ -479,287 +553,286 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"
-"@babel/plugin-syntax-top-level-await@^7.12.1", "@babel/plugin-syntax-top-level-await@^7.8.3":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz#dd6c0b357ac1bb142d98537450a319625d13d2a0"
- integrity sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A==
+"@babel/plugin-syntax-top-level-await@^7.12.13", "@babel/plugin-syntax-top-level-await@^7.8.3":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.13.tgz#c5f0fa6e249f5b739727f923540cf7a806130178"
+ integrity sha512-A81F9pDwyS7yM//KwbCSDqy3Uj4NMIurtplxphWxoYtNPov7cJsDkAFNNyVlIZ3jwGycVsurZ+LtOA8gZ376iQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-arrow-functions@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.1.tgz#8083ffc86ac8e777fbe24b5967c4b2521f3cb2b3"
- integrity sha512-5QB50qyN44fzzz4/qxDPQMBCTHgxg3n0xRBLJUmBlLoU/sFvxVWGZF/ZUfMVDQuJUKXaBhbupxIzIfZ6Fwk/0A==
+"@babel/plugin-transform-arrow-functions@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.13.tgz#eda5670b282952100c229f8a3bd49e0f6a72e9fe"
+ integrity sha512-tBtuN6qtCTd+iHzVZVOMNp+L04iIJBpqkdY42tWbmjIT5wvR2kx7gxMBsyhQtFzHwBbyGi9h8J8r9HgnOpQHxg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-async-to-generator@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.1.tgz#3849a49cc2a22e9743cbd6b52926d30337229af1"
- integrity sha512-SDtqoEcarK1DFlRJ1hHRY5HvJUj5kX4qmtpMAm2QnhOlyuMC4TMdCRgW6WXpv93rZeYNeLP22y8Aq2dbcDRM1A==
+"@babel/plugin-transform-async-to-generator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.13.tgz#fed8c69eebf187a535bfa4ee97a614009b24f7ae"
+ integrity sha512-psM9QHcHaDr+HZpRuJcE1PXESuGWSCcbiGFFhhwfzdbTxaGDVzuVtdNYliAwcRo3GFg0Bc8MmI+AvIGYIJG04A==
dependencies:
- "@babel/helper-module-imports" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-remap-async-to-generator" "^7.12.1"
+ "@babel/helper-module-imports" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-remap-async-to-generator" "^7.12.13"
-"@babel/plugin-transform-block-scoped-functions@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.1.tgz#f2a1a365bde2b7112e0a6ded9067fdd7c07905d9"
- integrity sha512-5OpxfuYnSgPalRpo8EWGPzIYf0lHBWORCkj5M0oLBwHdlux9Ri36QqGW3/LR13RSVOAoUUMzoPI/jpE4ABcHoA==
+"@babel/plugin-transform-block-scoped-functions@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.13.tgz#a9bf1836f2a39b4eb6cf09967739de29ea4bf4c4"
+ integrity sha512-zNyFqbc3kI/fVpqwfqkg6RvBgFpC4J18aKKMmv7KdQ/1GgREapSJAykLMVNwfRGO3BtHj3YQZl8kxCXPcVMVeg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-block-scoping@^7.12.11":
- version "7.12.11"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.11.tgz#83ae92a104dbb93a7d6c6dd1844f351083c46b4f"
- integrity sha512-atR1Rxc3hM+VPg/NvNvfYw0npQEAcHuJ+MGZnFn6h3bo+1U3BWXMdFMlvVRApBTWKQMX7SOwRJZA5FBF/JQbvA==
+"@babel/plugin-transform-block-scoping@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.13.tgz#f36e55076d06f41dfd78557ea039c1b581642e61"
+ integrity sha512-Pxwe0iqWJX4fOOM2kEZeUuAxHMWb9nK+9oh5d11bsLoB0xMg+mkDpt0eYuDZB7ETrY9bbcVlKUGTOGWy7BHsMQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-classes@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.1.tgz#65e650fcaddd3d88ddce67c0f834a3d436a32db6"
- integrity sha512-/74xkA7bVdzQTBeSUhLLJgYIcxw/dpEpCdRDiHgPJ3Mv6uC11UhjpOhl72CgqbBCmt1qtssCyB2xnJm1+PFjog==
+"@babel/plugin-transform-classes@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.13.tgz#9728edc1838b5d62fc93ad830bd523b1fcb0e1f6"
+ integrity sha512-cqZlMlhCC1rVnxE5ZGMtIb896ijL90xppMiuWXcwcOAuFczynpd3KYemb91XFFPi3wJSe/OcrX9lXoowatkkxA==
dependencies:
- "@babel/helper-annotate-as-pure" "^7.10.4"
- "@babel/helper-define-map" "^7.10.4"
- "@babel/helper-function-name" "^7.10.4"
- "@babel/helper-optimise-call-expression" "^7.10.4"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-replace-supers" "^7.12.1"
- "@babel/helper-split-export-declaration" "^7.10.4"
+ "@babel/helper-annotate-as-pure" "^7.12.13"
+ "@babel/helper-function-name" "^7.12.13"
+ "@babel/helper-optimise-call-expression" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-replace-supers" "^7.12.13"
+ "@babel/helper-split-export-declaration" "^7.12.13"
globals "^11.1.0"
-"@babel/plugin-transform-computed-properties@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.1.tgz#d68cf6c9b7f838a8a4144badbe97541ea0904852"
- integrity sha512-vVUOYpPWB7BkgUWPo4C44mUQHpTZXakEqFjbv8rQMg7TC6S6ZhGZ3otQcRH6u7+adSlE5i0sp63eMC/XGffrzg==
+"@babel/plugin-transform-computed-properties@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.13.tgz#6a210647a3d67f21f699cfd2a01333803b27339d"
+ integrity sha512-dDfuROUPGK1mTtLKyDPUavmj2b6kFu82SmgpztBFEO974KMjJT+Ytj3/oWsTUMBmgPcp9J5Pc1SlcAYRpJ2hRA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-destructuring@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.1.tgz#b9a570fe0d0a8d460116413cb4f97e8e08b2f847"
- integrity sha512-fRMYFKuzi/rSiYb2uRLiUENJOKq4Gnl+6qOv5f8z0TZXg3llUwUhsNNwrwaT/6dUhJTzNpBr+CUvEWBtfNY1cw==
+"@babel/plugin-transform-destructuring@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.13.tgz#fc56c5176940c5b41735c677124d1d20cecc9aeb"
+ integrity sha512-Dn83KykIFzjhA3FDPA1z4N+yfF3btDGhjnJwxIj0T43tP0flCujnU8fKgEkf0C1biIpSv9NZegPBQ1J6jYkwvQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-dotall-regex@^7.12.1", "@babel/plugin-transform-dotall-regex@^7.4.4":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.1.tgz#a1d16c14862817b6409c0a678d6f9373ca9cd975"
- integrity sha512-B2pXeRKoLszfEW7J4Hg9LoFaWEbr/kzo3teWHmtFCszjRNa/b40f9mfeqZsIDLLt/FjwQ6pz/Gdlwy85xNckBA==
+"@babel/plugin-transform-dotall-regex@^7.12.13", "@babel/plugin-transform-dotall-regex@^7.4.4":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.13.tgz#3f1601cc29905bfcb67f53910f197aeafebb25ad"
+ integrity sha512-foDrozE65ZFdUC2OfgeOCrEPTxdB3yjqxpXh8CH+ipd9CHd4s/iq81kcUpyH8ACGNEPdFqbtzfgzbT/ZGlbDeQ==
dependencies:
- "@babel/helper-create-regexp-features-plugin" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-create-regexp-features-plugin" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-duplicate-keys@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.1.tgz#745661baba295ac06e686822797a69fbaa2ca228"
- integrity sha512-iRght0T0HztAb/CazveUpUQrZY+aGKKaWXMJ4uf9YJtqxSUe09j3wteztCUDRHs+SRAL7yMuFqUsLoAKKzgXjw==
+"@babel/plugin-transform-duplicate-keys@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.13.tgz#6f06b87a8b803fd928e54b81c258f0a0033904de"
+ integrity sha512-NfADJiiHdhLBW3pulJlJI2NB0t4cci4WTZ8FtdIuNc2+8pslXdPtRRAEWqUY+m9kNOk2eRYbTAOipAxlrOcwwQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-exponentiation-operator@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.1.tgz#b0f2ed356ba1be1428ecaf128ff8a24f02830ae0"
- integrity sha512-7tqwy2bv48q+c1EHbXK0Zx3KXd2RVQp6OC7PbwFNt/dPTAV3Lu5sWtWuAj8owr5wqtWnqHfl2/mJlUmqkChKug==
+"@babel/plugin-transform-exponentiation-operator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.13.tgz#4d52390b9a273e651e4aba6aee49ef40e80cd0a1"
+ integrity sha512-fbUelkM1apvqez/yYx1/oICVnGo2KM5s63mhGylrmXUxK/IAXSIf87QIxVfZldWf4QsOafY6vV3bX8aMHSvNrA==
dependencies:
- "@babel/helper-builder-binary-assignment-operator-visitor" "^7.10.4"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-for-of@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.1.tgz#07640f28867ed16f9511c99c888291f560921cfa"
- integrity sha512-Zaeq10naAsuHo7heQvyV0ptj4dlZJwZgNAtBYBnu5nNKJoW62m0zKcIEyVECrUKErkUkg6ajMy4ZfnVZciSBhg==
+"@babel/plugin-transform-for-of@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.13.tgz#561ff6d74d9e1c8879cb12dbaf4a14cd29d15cf6"
+ integrity sha512-xCbdgSzXYmHGyVX3+BsQjcd4hv4vA/FDy7Kc8eOpzKmBBPEOTurt0w5fCRQaGl+GSBORKgJdstQ1rHl4jbNseQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-function-name@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.1.tgz#2ec76258c70fe08c6d7da154003a480620eba667"
- integrity sha512-JF3UgJUILoFrFMEnOJLJkRHSk6LUSXLmEFsA23aR2O5CSLUxbeUX1IZ1YQ7Sn0aXb601Ncwjx73a+FVqgcljVw==
+"@babel/plugin-transform-function-name@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.13.tgz#bb024452f9aaed861d374c8e7a24252ce3a50051"
+ integrity sha512-6K7gZycG0cmIwwF7uMK/ZqeCikCGVBdyP2J5SKNCXO5EOHcqi+z7Jwf8AmyDNcBgxET8DrEtCt/mPKPyAzXyqQ==
dependencies:
- "@babel/helper-function-name" "^7.10.4"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-function-name" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-literals@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.1.tgz#d73b803a26b37017ddf9d3bb8f4dc58bfb806f57"
- integrity sha512-+PxVGA+2Ag6uGgL0A5f+9rklOnnMccwEBzwYFL3EUaKuiyVnUipyXncFcfjSkbimLrODoqki1U9XxZzTvfN7IQ==
+"@babel/plugin-transform-literals@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.13.tgz#2ca45bafe4a820197cf315794a4d26560fe4bdb9"
+ integrity sha512-FW+WPjSR7hiUxMcKqyNjP05tQ2kmBCdpEpZHY1ARm96tGQCCBvXKnpjILtDplUnJ/eHZ0lALLM+d2lMFSpYJrQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-member-expression-literals@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.1.tgz#496038602daf1514a64d43d8e17cbb2755e0c3ad"
- integrity sha512-1sxePl6z9ad0gFMB9KqmYofk34flq62aqMt9NqliS/7hPEpURUCMbyHXrMPlo282iY7nAvUB1aQd5mg79UD9Jg==
+"@babel/plugin-transform-member-expression-literals@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.13.tgz#5ffa66cd59b9e191314c9f1f803b938e8c081e40"
+ integrity sha512-kxLkOsg8yir4YeEPHLuO2tXP9R/gTjpuTOjshqSpELUN3ZAg2jfDnKUvzzJxObun38sw3wm4Uu69sX/zA7iRvg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-modules-amd@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.1.tgz#3154300b026185666eebb0c0ed7f8415fefcf6f9"
- integrity sha512-tDW8hMkzad5oDtzsB70HIQQRBiTKrhfgwC/KkJeGsaNFTdWhKNt/BiE8c5yj19XiGyrxpbkOfH87qkNg1YGlOQ==
+"@babel/plugin-transform-modules-amd@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.13.tgz#43db16249b274ee2e551e2422090aa1c47692d56"
+ integrity sha512-JHLOU0o81m5UqG0Ulz/fPC68/v+UTuGTWaZBUwpEk1fYQ1D9LfKV6MPn4ttJKqRo5Lm460fkzjLTL4EHvCprvA==
dependencies:
- "@babel/helper-module-transforms" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-module-transforms" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
babel-plugin-dynamic-import-node "^2.3.3"
-"@babel/plugin-transform-modules-commonjs@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz#fa403124542636c786cf9b460a0ffbb48a86e648"
- integrity sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==
+"@babel/plugin-transform-modules-commonjs@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.13.tgz#5043b870a784a8421fa1fd9136a24f294da13e50"
+ integrity sha512-OGQoeVXVi1259HjuoDnsQMlMkT9UkZT9TpXAsqWplS/M0N1g3TJAn/ByOCeQu7mfjc5WpSsRU+jV1Hd89ts0kQ==
dependencies:
- "@babel/helper-module-transforms" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-simple-access" "^7.12.1"
+ "@babel/helper-module-transforms" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-simple-access" "^7.12.13"
babel-plugin-dynamic-import-node "^2.3.3"
-"@babel/plugin-transform-modules-systemjs@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.1.tgz#663fea620d593c93f214a464cd399bf6dc683086"
- integrity sha512-Hn7cVvOavVh8yvW6fLwveFqSnd7rbQN3zJvoPNyNaQSvgfKmDBO9U1YL9+PCXGRlZD9tNdWTy5ACKqMuzyn32Q==
+"@babel/plugin-transform-modules-systemjs@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.13.tgz#351937f392c7f07493fc79b2118201d50404a3c5"
+ integrity sha512-aHfVjhZ8QekaNF/5aNdStCGzwTbU7SI5hUybBKlMzqIMC7w7Ho8hx5a4R/DkTHfRfLwHGGxSpFt9BfxKCoXKoA==
dependencies:
- "@babel/helper-hoist-variables" "^7.10.4"
- "@babel/helper-module-transforms" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-validator-identifier" "^7.10.4"
+ "@babel/helper-hoist-variables" "^7.12.13"
+ "@babel/helper-module-transforms" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-validator-identifier" "^7.12.11"
babel-plugin-dynamic-import-node "^2.3.3"
-"@babel/plugin-transform-modules-umd@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.1.tgz#eb5a218d6b1c68f3d6217b8fa2cc82fec6547902"
- integrity sha512-aEIubCS0KHKM0zUos5fIoQm+AZUMt1ZvMpqz0/H5qAQ7vWylr9+PLYurT+Ic7ID/bKLd4q8hDovaG3Zch2uz5Q==
+"@babel/plugin-transform-modules-umd@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.13.tgz#26c66f161d3456674e344b4b1255de4d530cfb37"
+ integrity sha512-BgZndyABRML4z6ibpi7Z98m4EVLFI9tVsZDADC14AElFaNHHBcJIovflJ6wtCqFxwy2YJ1tJhGRsr0yLPKoN+w==
dependencies:
- "@babel/helper-module-transforms" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-module-transforms" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-named-capturing-groups-regex@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.1.tgz#b407f5c96be0d9f5f88467497fa82b30ac3e8753"
- integrity sha512-tB43uQ62RHcoDp9v2Nsf+dSM8sbNodbEicbQNA53zHz8pWUhsgHSJCGpt7daXxRydjb0KnfmB+ChXOv3oADp1Q==
+"@babel/plugin-transform-named-capturing-groups-regex@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.13.tgz#2213725a5f5bbbe364b50c3ba5998c9599c5c9d9"
+ integrity sha512-Xsm8P2hr5hAxyYblrfACXpQKdQbx4m2df9/ZZSQ8MAhsadw06+jW7s9zsSw6he+mJZXRlVMyEnVktJo4zjk1WA==
dependencies:
- "@babel/helper-create-regexp-features-plugin" "^7.12.1"
+ "@babel/helper-create-regexp-features-plugin" "^7.12.13"
-"@babel/plugin-transform-new-target@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.1.tgz#80073f02ee1bb2d365c3416490e085c95759dec0"
- integrity sha512-+eW/VLcUL5L9IvJH7rT1sT0CzkdUTvPrXC2PXTn/7z7tXLBuKvezYbGdxD5WMRoyvyaujOq2fWoKl869heKjhw==
+"@babel/plugin-transform-new-target@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.13.tgz#e22d8c3af24b150dd528cbd6e685e799bf1c351c"
+ integrity sha512-/KY2hbLxrG5GTQ9zzZSc3xWiOy379pIETEhbtzwZcw9rvuaVV4Fqy7BYGYOWZnaoXIQYbbJ0ziXLa/sKcGCYEQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-object-super@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.1.tgz#4ea08696b8d2e65841d0c7706482b048bed1066e"
- integrity sha512-AvypiGJH9hsquNUn+RXVcBdeE3KHPZexWRdimhuV59cSoOt5kFBmqlByorAeUlGG2CJWd0U+4ZtNKga/TB0cAw==
+"@babel/plugin-transform-object-super@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.13.tgz#b4416a2d63b8f7be314f3d349bd55a9c1b5171f7"
+ integrity sha512-JzYIcj3XtYspZDV8j9ulnoMPZZnF/Cj0LUxPOjR89BdBVx+zYJI9MdMIlUZjbXDX+6YVeS6I3e8op+qQ3BYBoQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/helper-replace-supers" "^7.12.1"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/helper-replace-supers" "^7.12.13"
-"@babel/plugin-transform-parameters@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.1.tgz#d2e963b038771650c922eff593799c96d853255d"
- integrity sha512-xq9C5EQhdPK23ZeCdMxl8bbRnAgHFrw5EOC3KJUsSylZqdkCaFEXxGSBuTSObOpiiHHNyb82es8M1QYgfQGfNg==
+"@babel/plugin-transform-parameters@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.13.tgz#461e76dfb63c2dfd327b8a008a9e802818ce9853"
+ integrity sha512-e7QqwZalNiBRHCpJg/P8s/VJeSRYgmtWySs1JwvfwPqhBbiWfOcHDKdeAi6oAyIimoKWBlwc8oTgbZHdhCoVZA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-property-literals@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.1.tgz#41bc81200d730abb4456ab8b3fbd5537b59adecd"
- integrity sha512-6MTCR/mZ1MQS+AwZLplX4cEySjCpnIF26ToWo942nqn8hXSm7McaHQNeGx/pt7suI1TWOWMfa/NgBhiqSnX0cQ==
+"@babel/plugin-transform-property-literals@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.13.tgz#4e6a9e37864d8f1b3bc0e2dce7bf8857db8b1a81"
+ integrity sha512-nqVigwVan+lR+g8Fj8Exl0UQX2kymtjcWfMOYM1vTYEKujeyv2SkMgazf2qNcK7l4SDiKyTA/nHCPqL4e2zo1A==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-regenerator@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.12.1.tgz#5f0a28d842f6462281f06a964e88ba8d7ab49753"
- integrity sha512-gYrHqs5itw6i4PflFX3OdBPMQdPbF4bj2REIUxlMRUFk0/ZOAIpDFuViuxPjUL7YC8UPnf+XG7/utJvqXdPKng==
+"@babel/plugin-transform-regenerator@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.12.13.tgz#b628bcc9c85260ac1aeb05b45bde25210194a2f5"
+ integrity sha512-lxb2ZAvSLyJ2PEe47hoGWPmW22v7CtSl9jW8mingV4H2sEX/JOcrAj2nPuGWi56ERUm2bUpjKzONAuT6HCn2EA==
dependencies:
regenerator-transform "^0.14.2"
-"@babel/plugin-transform-reserved-words@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.1.tgz#6fdfc8cc7edcc42b36a7c12188c6787c873adcd8"
- integrity sha512-pOnUfhyPKvZpVyBHhSBoX8vfA09b7r00Pmm1sH+29ae2hMTKVmSp4Ztsr8KBKjLjx17H0eJqaRC3bR2iThM54A==
+"@babel/plugin-transform-reserved-words@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.13.tgz#7d9988d4f06e0fe697ea1d9803188aa18b472695"
+ integrity sha512-xhUPzDXxZN1QfiOy/I5tyye+TRz6lA7z6xaT4CLOjPRMVg1ldRf0LHw0TDBpYL4vG78556WuHdyO9oi5UmzZBg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-shorthand-properties@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.1.tgz#0bf9cac5550fce0cfdf043420f661d645fdc75e3"
- integrity sha512-GFZS3c/MhX1OusqB1MZ1ct2xRzX5ppQh2JU1h2Pnfk88HtFTM+TWQqJNfwkmxtPQtb/s1tk87oENfXJlx7rSDw==
+"@babel/plugin-transform-shorthand-properties@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.13.tgz#db755732b70c539d504c6390d9ce90fe64aff7ad"
+ integrity sha512-xpL49pqPnLtf0tVluuqvzWIgLEhuPpZzvs2yabUHSKRNlN7ScYU7aMlmavOeyXJZKgZKQRBlh8rHbKiJDraTSw==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-spread@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.1.tgz#527f9f311be4ec7fdc2b79bb89f7bf884b3e1e1e"
- integrity sha512-vuLp8CP0BE18zVYjsEBZ5xoCecMK6LBMMxYzJnh01rxQRvhNhH1csMMmBfNo5tGpGO+NhdSNW2mzIvBu3K1fng==
+"@babel/plugin-transform-spread@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.13.tgz#ca0d5645abbd560719c354451b849f14df4a7949"
+ integrity sha512-dUCrqPIowjqk5pXsx1zPftSq4sT0aCeZVAxhdgs3AMgyaDmoUT0G+5h3Dzja27t76aUEIJWlFgPJqJ/d4dbTtg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/helper-skip-transparent-expression-wrappers" "^7.12.1"
-"@babel/plugin-transform-sticky-regex@^7.12.7":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.7.tgz#560224613ab23987453948ed21d0b0b193fa7fad"
- integrity sha512-VEiqZL5N/QvDbdjfYQBhruN0HYjSPjC4XkeqW4ny/jNtH9gcbgaqBIXYEZCNnESMAGs0/K/R7oFGMhOyu/eIxg==
+"@babel/plugin-transform-sticky-regex@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.13.tgz#760ffd936face73f860ae646fb86ee82f3d06d1f"
+ integrity sha512-Jc3JSaaWT8+fr7GRvQP02fKDsYk4K/lYwWq38r/UGfaxo89ajud321NH28KRQ7xy1Ybc0VUE5Pz8psjNNDUglg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-template-literals@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.1.tgz#b43ece6ed9a79c0c71119f576d299ef09d942843"
- integrity sha512-b4Zx3KHi+taXB1dVRBhVJtEPi9h1THCeKmae2qP0YdUHIFhVjtpqqNfxeVAa1xeHVhAy4SbHxEwx5cltAu5apw==
+"@babel/plugin-transform-template-literals@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.13.tgz#655037b07ebbddaf3b7752f55d15c2fd6f5aa865"
+ integrity sha512-arIKlWYUgmNsF28EyfmiQHJLJFlAJNYkuQO10jL46ggjBpeb2re1P9K9YGxNJB45BqTbaslVysXDYm/g3sN/Qg==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-typeof-symbol@^7.12.10":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.10.tgz#de01c4c8f96580bd00f183072b0d0ecdcf0dec4b"
- integrity sha512-JQ6H8Rnsogh//ijxspCjc21YPd3VLVoYtAwv3zQmqAt8YGYUtdo5usNhdl4b9/Vir2kPFZl6n1h0PfUz4hJhaA==
+"@babel/plugin-transform-typeof-symbol@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.13.tgz#785dd67a1f2ea579d9c2be722de8c84cb85f5a7f"
+ integrity sha512-eKv/LmUJpMnu4npgfvs3LiHhJua5fo/CysENxa45YCQXZwKnGCQKAg87bvoqSW1fFT+HA32l03Qxsm8ouTY3ZQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-unicode-escapes@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz#5232b9f81ccb07070b7c3c36c67a1b78f1845709"
- integrity sha512-I8gNHJLIc7GdApm7wkVnStWssPNbSRMPtgHdmH3sRM1zopz09UWPS4x5V4n1yz/MIWTVnJ9sp6IkuXdWM4w+2Q==
+"@babel/plugin-transform-unicode-escapes@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.13.tgz#840ced3b816d3b5127dd1d12dcedc5dead1a5e74"
+ integrity sha512-0bHEkdwJ/sN/ikBHfSmOXPypN/beiGqjo+o4/5K+vxEFNPRPdImhviPakMKG4x96l85emoa0Z6cDflsdBusZbw==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-unicode-regex@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.1.tgz#cc9661f61390db5c65e3febaccefd5c6ac3faecb"
- integrity sha512-SqH4ClNngh/zGwHZOOQMTD+e8FGWexILV+ePMyiDJttAWRh5dhDL8rcl5lSgU3Huiq6Zn6pWTMvdPAb21Dwdyg==
+"@babel/plugin-transform-unicode-regex@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.13.tgz#b52521685804e155b1202e83fc188d34bb70f5ac"
+ integrity sha512-mDRzSNY7/zopwisPZ5kM9XKCfhchqIYwAKRERtEnhYscZB79VRekuRSoYbN0+KVe3y8+q1h6A4svXtP7N+UoCA==
dependencies:
- "@babel/helper-create-regexp-features-plugin" "^7.12.1"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-create-regexp-features-plugin" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/preset-env@7.12.11":
- version "7.12.11"
- resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.12.11.tgz#55d5f7981487365c93dbbc84507b1c7215e857f9"
- integrity sha512-j8Tb+KKIXKYlDBQyIOy4BLxzv1NUOwlHfZ74rvW+Z0Gp4/cI2IMDPBWAgWceGcE7aep9oL/0K9mlzlMGxA8yNw==
+"@babel/preset-env@7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.12.13.tgz#3aa2d09cf7d255177538dff292ac9af29ad46525"
+ integrity sha512-JUVlizG8SoFTz4LmVUL8++aVwzwxcvey3N0j1tRbMAXVEy95uQ/cnEkmEKHN00Bwq4voAV3imQGnQvpkLAxsrw==
dependencies:
- "@babel/compat-data" "^7.12.7"
- "@babel/helper-compilation-targets" "^7.12.5"
- "@babel/helper-module-imports" "^7.12.5"
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/compat-data" "^7.12.13"
+ "@babel/helper-compilation-targets" "^7.12.13"
+ "@babel/helper-module-imports" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/helper-validator-option" "^7.12.11"
- "@babel/plugin-proposal-async-generator-functions" "^7.12.1"
- "@babel/plugin-proposal-class-properties" "^7.12.1"
+ "@babel/plugin-proposal-async-generator-functions" "^7.12.13"
+ "@babel/plugin-proposal-class-properties" "^7.12.13"
"@babel/plugin-proposal-dynamic-import" "^7.12.1"
- "@babel/plugin-proposal-export-namespace-from" "^7.12.1"
- "@babel/plugin-proposal-json-strings" "^7.12.1"
- "@babel/plugin-proposal-logical-assignment-operators" "^7.12.1"
- "@babel/plugin-proposal-nullish-coalescing-operator" "^7.12.1"
- "@babel/plugin-proposal-numeric-separator" "^7.12.7"
- "@babel/plugin-proposal-object-rest-spread" "^7.12.1"
- "@babel/plugin-proposal-optional-catch-binding" "^7.12.1"
- "@babel/plugin-proposal-optional-chaining" "^7.12.7"
- "@babel/plugin-proposal-private-methods" "^7.12.1"
- "@babel/plugin-proposal-unicode-property-regex" "^7.12.1"
+ "@babel/plugin-proposal-export-namespace-from" "^7.12.13"
+ "@babel/plugin-proposal-json-strings" "^7.12.13"
+ "@babel/plugin-proposal-logical-assignment-operators" "^7.12.13"
+ "@babel/plugin-proposal-nullish-coalescing-operator" "^7.12.13"
+ "@babel/plugin-proposal-numeric-separator" "^7.12.13"
+ "@babel/plugin-proposal-object-rest-spread" "^7.12.13"
+ "@babel/plugin-proposal-optional-catch-binding" "^7.12.13"
+ "@babel/plugin-proposal-optional-chaining" "^7.12.13"
+ "@babel/plugin-proposal-private-methods" "^7.12.13"
+ "@babel/plugin-proposal-unicode-property-regex" "^7.12.13"
"@babel/plugin-syntax-async-generators" "^7.8.0"
- "@babel/plugin-syntax-class-properties" "^7.12.1"
+ "@babel/plugin-syntax-class-properties" "^7.12.13"
"@babel/plugin-syntax-dynamic-import" "^7.8.0"
"@babel/plugin-syntax-export-namespace-from" "^7.8.3"
"@babel/plugin-syntax-json-strings" "^7.8.0"
@@ -769,41 +842,41 @@
"@babel/plugin-syntax-object-rest-spread" "^7.8.0"
"@babel/plugin-syntax-optional-catch-binding" "^7.8.0"
"@babel/plugin-syntax-optional-chaining" "^7.8.0"
- "@babel/plugin-syntax-top-level-await" "^7.12.1"
- "@babel/plugin-transform-arrow-functions" "^7.12.1"
- "@babel/plugin-transform-async-to-generator" "^7.12.1"
- "@babel/plugin-transform-block-scoped-functions" "^7.12.1"
- "@babel/plugin-transform-block-scoping" "^7.12.11"
- "@babel/plugin-transform-classes" "^7.12.1"
- "@babel/plugin-transform-computed-properties" "^7.12.1"
- "@babel/plugin-transform-destructuring" "^7.12.1"
- "@babel/plugin-transform-dotall-regex" "^7.12.1"
- "@babel/plugin-transform-duplicate-keys" "^7.12.1"
- "@babel/plugin-transform-exponentiation-operator" "^7.12.1"
- "@babel/plugin-transform-for-of" "^7.12.1"
- "@babel/plugin-transform-function-name" "^7.12.1"
- "@babel/plugin-transform-literals" "^7.12.1"
- "@babel/plugin-transform-member-expression-literals" "^7.12.1"
- "@babel/plugin-transform-modules-amd" "^7.12.1"
- "@babel/plugin-transform-modules-commonjs" "^7.12.1"
- "@babel/plugin-transform-modules-systemjs" "^7.12.1"
- "@babel/plugin-transform-modules-umd" "^7.12.1"
- "@babel/plugin-transform-named-capturing-groups-regex" "^7.12.1"
- "@babel/plugin-transform-new-target" "^7.12.1"
- "@babel/plugin-transform-object-super" "^7.12.1"
- "@babel/plugin-transform-parameters" "^7.12.1"
- "@babel/plugin-transform-property-literals" "^7.12.1"
- "@babel/plugin-transform-regenerator" "^7.12.1"
- "@babel/plugin-transform-reserved-words" "^7.12.1"
- "@babel/plugin-transform-shorthand-properties" "^7.12.1"
- "@babel/plugin-transform-spread" "^7.12.1"
- "@babel/plugin-transform-sticky-regex" "^7.12.7"
- "@babel/plugin-transform-template-literals" "^7.12.1"
- "@babel/plugin-transform-typeof-symbol" "^7.12.10"
- "@babel/plugin-transform-unicode-escapes" "^7.12.1"
- "@babel/plugin-transform-unicode-regex" "^7.12.1"
+ "@babel/plugin-syntax-top-level-await" "^7.12.13"
+ "@babel/plugin-transform-arrow-functions" "^7.12.13"
+ "@babel/plugin-transform-async-to-generator" "^7.12.13"
+ "@babel/plugin-transform-block-scoped-functions" "^7.12.13"
+ "@babel/plugin-transform-block-scoping" "^7.12.13"
+ "@babel/plugin-transform-classes" "^7.12.13"
+ "@babel/plugin-transform-computed-properties" "^7.12.13"
+ "@babel/plugin-transform-destructuring" "^7.12.13"
+ "@babel/plugin-transform-dotall-regex" "^7.12.13"
+ "@babel/plugin-transform-duplicate-keys" "^7.12.13"
+ "@babel/plugin-transform-exponentiation-operator" "^7.12.13"
+ "@babel/plugin-transform-for-of" "^7.12.13"
+ "@babel/plugin-transform-function-name" "^7.12.13"
+ "@babel/plugin-transform-literals" "^7.12.13"
+ "@babel/plugin-transform-member-expression-literals" "^7.12.13"
+ "@babel/plugin-transform-modules-amd" "^7.12.13"
+ "@babel/plugin-transform-modules-commonjs" "^7.12.13"
+ "@babel/plugin-transform-modules-systemjs" "^7.12.13"
+ "@babel/plugin-transform-modules-umd" "^7.12.13"
+ "@babel/plugin-transform-named-capturing-groups-regex" "^7.12.13"
+ "@babel/plugin-transform-new-target" "^7.12.13"
+ "@babel/plugin-transform-object-super" "^7.12.13"
+ "@babel/plugin-transform-parameters" "^7.12.13"
+ "@babel/plugin-transform-property-literals" "^7.12.13"
+ "@babel/plugin-transform-regenerator" "^7.12.13"
+ "@babel/plugin-transform-reserved-words" "^7.12.13"
+ "@babel/plugin-transform-shorthand-properties" "^7.12.13"
+ "@babel/plugin-transform-spread" "^7.12.13"
+ "@babel/plugin-transform-sticky-regex" "^7.12.13"
+ "@babel/plugin-transform-template-literals" "^7.12.13"
+ "@babel/plugin-transform-typeof-symbol" "^7.12.13"
+ "@babel/plugin-transform-unicode-escapes" "^7.12.13"
+ "@babel/plugin-transform-unicode-regex" "^7.12.13"
"@babel/preset-modules" "^0.1.3"
- "@babel/types" "^7.12.11"
+ "@babel/types" "^7.12.13"
core-js-compat "^3.8.0"
semver "^5.5.0"
@@ -834,7 +907,16 @@
"@babel/parser" "^7.12.7"
"@babel/types" "^7.12.7"
-"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5", "@babel/traverse@^7.7.0":
+"@babel/template@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327"
+ integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==
+ dependencies:
+ "@babel/code-frame" "^7.12.13"
+ "@babel/parser" "^7.12.13"
+ "@babel/types" "^7.12.13"
+
+"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5", "@babel/traverse@^7.7.0":
version "7.12.10"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.10.tgz#2d1f4041e8bf42ea099e5b2dc48d6a594c00017a"
integrity sha512-6aEtf0IeRgbYWzta29lePeYSk+YAFIC3kyqESeft8o5CkFlYIMX+EQDDWEiAQ9LHOA3d0oHdgrSsID/CKqXJlg==
@@ -849,7 +931,22 @@
globals "^11.1.0"
lodash "^4.17.19"
-"@babel/types@7.12.12", "@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
+"@babel/traverse@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.13.tgz#689f0e4b4c08587ad26622832632735fb8c4e0c0"
+ integrity sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA==
+ dependencies:
+ "@babel/code-frame" "^7.12.13"
+ "@babel/generator" "^7.12.13"
+ "@babel/helper-function-name" "^7.12.13"
+ "@babel/helper-split-export-declaration" "^7.12.13"
+ "@babel/parser" "^7.12.13"
+ "@babel/types" "^7.12.13"
+ debug "^4.1.0"
+ globals "^11.1.0"
+ lodash "^4.17.19"
+
+"@babel/types@7.12.12":
version "7.12.12"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.12.tgz#4608a6ec313abbd87afa55004d373ad04a96c299"
integrity sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ==
@@ -858,6 +955,15 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"
+"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611"
+ integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ==
+ dependencies:
+ "@babel/helper-validator-identifier" "^7.12.11"
+ lodash "^4.17.19"
+ to-fast-properties "^2.0.0"
+
"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
@@ -5067,7 +5173,7 @@ lodash.sortby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
-lodash@4.17.20, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4:
+lodash@4.17.20, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
From 252371cc80791eb71e6794cda5af1586262286eb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 14:36:01 +0800
Subject: [PATCH 063/237] Build(deps-dev): Bump webpack from 5.19.0 to 5.20.0
in /website (#10227)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 45 ++++----------------------------------------
2 files changed, 5 insertions(+), 42 deletions(-)
diff --git a/website/package.json b/website/package.json
index 836052dcf..aa7c5b556 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.19.0",
+ "webpack": "5.20.0",
"webpack-cli": "4.4.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index 9e50aba0e..1f7282250 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -3291,14 +3291,6 @@ find-up@^4.0.0:
locate-path "^5.0.0"
path-exists "^4.0.0"
-find-up@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
- integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
- dependencies:
- locate-path "^6.0.0"
- path-exists "^4.0.0"
-
find-versions@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-3.1.0.tgz#10161f29cf3eb4350dec10a29bdde75bff0df32d"
@@ -4551,13 +4543,6 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
-locate-path@^6.0.0:
- version "6.0.0"
- resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
- integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
- dependencies:
- p-locate "^5.0.0"
-
lodash._reinterpolate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -5307,13 +5292,6 @@ p-limit@^2.2.0:
dependencies:
p-try "^2.0.0"
-p-limit@^3.0.2:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.0.2.tgz#1664e010af3cadc681baafd3e2a437be7b0fb5fe"
- integrity sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==
- dependencies:
- p-try "^2.0.0"
-
p-limit@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
@@ -5341,13 +5319,6 @@ p-locate@^4.1.0:
dependencies:
p-limit "^2.2.0"
-p-locate@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
- integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
- dependencies:
- p-limit "^3.0.2"
-
p-map-series@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-1.0.0.tgz#bf98fe575705658a9e1351befb85ae4c1f07bdca"
@@ -5519,13 +5490,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"
-pkg-dir@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760"
- integrity sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==
- dependencies:
- find-up "^5.0.0"
-
pkg-up@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f"
@@ -7439,10 +7403,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.19.0:
- version "5.19.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.19.0.tgz#1a5fee84dd63557e68336b0774ac4a1c81aa2c73"
- integrity sha512-egX19vAQ8fZ4cVYtA9Y941eqJtcZAK68mQq87MMv+GTXKZOc3TpKBBxdGX+HXUYlquPxiluNsJ1VHvwwklW7CQ==
+webpack@5.20.0:
+ version "5.20.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.0.tgz#7225c2e780f4332aef18e0b323b8b3ec01e16d66"
+ integrity sha512-k7X/+gisrvirr4bzv8JVLzy2RhWiVzd3gA9qzS5je3lwqYrMc5F549vLOk34BoNkkUp4SIpt1rQp48pTxBMXvA==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
@@ -7462,7 +7426,6 @@ webpack@5.19.0:
loader-runner "^4.2.0"
mime-types "^2.1.27"
neo-async "^2.6.2"
- pkg-dir "^5.0.0"
schema-utils "^3.0.0"
tapable "^2.1.1"
terser-webpack-plugin "^5.1.1"
From 5527b078ac630a941eb6de43d411e6d9a76f6441 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 14:38:57 +0800
Subject: [PATCH 064/237] Build(deps-dev): Bump @babel/preset-react from
7.12.10 to 7.12.13 in /website (#10225)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 150 ++++++++++++++++---------------------------
2 files changed, 57 insertions(+), 95 deletions(-)
diff --git a/website/package.json b/website/package.json
index aa7c5b556..36df8d210 100644
--- a/website/package.json
+++ b/website/package.json
@@ -16,7 +16,7 @@
"react-dom": "17.0.1"
},
"devDependencies": {
- "@babel/preset-react": "7.12.10",
+ "@babel/preset-react": "7.12.13",
"@sandhose/prettier-animated-logo": "1.0.3",
"babel-loader": "8.2.2",
"concurrently": "5.3.0",
diff --git a/website/yarn.lock b/website/yarn.lock
index 1f7282250..ee9303bf0 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -70,12 +70,12 @@
dependencies:
"@babel/types" "^7.10.4"
-"@babel/helper-annotate-as-pure@^7.12.10":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.10.tgz#54ab9b000e60a93644ce17b3f37d313aaf1d115d"
- integrity sha512-XplmVbC1n+KY6jL8/fgLVXXUauDIB+lD5+GsQEh6F6GBF1dq1qy4DP4yXWzDKcoqXB3X58t61e85Fitoww4JVQ==
+"@babel/helper-annotate-as-pure@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab"
+ integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==
dependencies:
- "@babel/types" "^7.12.10"
+ "@babel/types" "^7.12.13"
"@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4":
version "7.10.4"
@@ -85,32 +85,6 @@
"@babel/helper-explode-assignable-expression" "^7.10.4"
"@babel/types" "^7.10.4"
-"@babel/helper-builder-react-jsx-experimental@^7.12.10":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.10.tgz#a58cb96a793dc0fcd5c9ed3bb36d62fdc60534c2"
- integrity sha512-3Kcr2LGpL7CTRDTTYm1bzeor9qZbxbvU2AxsLA6mUG9gYarSfIKMK0UlU+azLWI+s0+BH768bwyaziWB2NOJlQ==
- dependencies:
- "@babel/helper-annotate-as-pure" "^7.12.10"
- "@babel/helper-module-imports" "^7.12.5"
- "@babel/types" "^7.12.10"
-
-"@babel/helper-builder-react-jsx-experimental@^7.12.4":
- version "7.12.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.4.tgz#55fc1ead5242caa0ca2875dcb8eed6d311e50f48"
- integrity sha512-AjEa0jrQqNk7eDQOo0pTfUOwQBMF+xVqrausQwT9/rTKy0g04ggFNaJpaE09IQMn9yExluigWMJcj0WC7bq+Og==
- dependencies:
- "@babel/helper-annotate-as-pure" "^7.10.4"
- "@babel/helper-module-imports" "^7.12.1"
- "@babel/types" "^7.12.1"
-
-"@babel/helper-builder-react-jsx@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz#8095cddbff858e6fa9c326daee54a2f2732c1d5d"
- integrity sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg==
- dependencies:
- "@babel/helper-annotate-as-pure" "^7.10.4"
- "@babel/types" "^7.10.4"
-
"@babel/helper-compilation-targets@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.4.tgz#804ae8e3f04376607cc791b9d47d540276332bd2"
@@ -206,19 +180,12 @@
dependencies:
"@babel/types" "^7.10.4"
-"@babel/helper-module-imports@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz#1644c01591a15a2f084dd6d092d9430eb1d1216c"
- integrity sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA==
+"@babel/helper-module-imports@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz#ec67e4404f41750463e455cc3203f6a32e93fcb0"
+ integrity sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g==
dependencies:
- "@babel/types" "^7.12.1"
-
-"@babel/helper-module-imports@^7.12.5":
- version "7.12.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz#1bfc0229f794988f76ed0a4d4e90860850b54dfb"
- integrity sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==
- dependencies:
- "@babel/types" "^7.12.5"
+ "@babel/types" "^7.12.13"
"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0":
version "7.11.0"
@@ -240,10 +207,10 @@
dependencies:
"@babel/types" "^7.10.4"
-"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.1", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
- integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==
+"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.1", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.12.13.tgz#174254d0f2424d8aefb4dd48057511247b0a9eeb"
+ integrity sha512-C+10MXCXJLiR6IeG9+Wiejt9jmtFpxUc3MQqCmPY8hfCjyUGl9kT+B2okzEZrtykiwrc4dbCPdDoz0A/HQbDaA==
"@babel/helper-regex@^7.10.1":
version "7.10.1"
@@ -312,6 +279,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==
+"@babel/helper-validator-identifier@^7.12.11":
+ version "7.12.11"
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
+ integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
+
"@babel/helper-wrap-function@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87"
@@ -504,12 +476,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"
-"@babel/plugin-syntax-jsx@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.1.tgz#9d9d357cc818aa7ae7935917c1257f67677a0926"
- integrity sha512-1yRi7yAtB0ETgxdY9ti/p2TivUxJkTdhu/ZbF9MshVGqOx1TdB3b7xCXs49Fupgg50N45KcAsRP/ZqWjs9SRjg==
+"@babel/plugin-syntax-jsx@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz#044fb81ebad6698fe62c478875575bcbb9b70f15"
+ integrity sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-logical-assignment-operators@^7.10.4":
version "7.10.4"
@@ -752,31 +724,30 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"
-"@babel/plugin-transform-react-display-name@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.12.1.tgz#1cbcd0c3b1d6648c55374a22fc9b6b7e5341c00d"
- integrity sha512-cAzB+UzBIrekfYxyLlFqf/OagTvHLcVBb5vpouzkYkBclRPraiygVnafvAoipErZLI8ANv8Ecn6E/m5qPXD26w==
+"@babel/plugin-transform-react-display-name@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.12.13.tgz#c28effd771b276f4647411c9733dbb2d2da954bd"
+ integrity sha512-MprESJzI9O5VnJZrL7gg1MpdqmiFcUv41Jc7SahxYsNP2kDkFqClxxTZq+1Qv4AFCamm+GXMRDQINNn+qrxmiA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
+ "@babel/helper-plugin-utils" "^7.12.13"
-"@babel/plugin-transform-react-jsx-development@^7.12.7":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.7.tgz#4c2a647de79c7e2b16bfe4540677ba3121e82a08"
- integrity sha512-Rs3ETtMtR3VLXFeYRChle5SsP/P9Jp/6dsewBQfokDSzKJThlsuFcnzLTDRALiUmTC48ej19YD9uN1mupEeEDg==
+"@babel/plugin-transform-react-jsx-development@^7.12.12":
+ version "7.12.12"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.12.tgz#bccca33108fe99d95d7f9e82046bfe762e71f4e7"
+ integrity sha512-i1AxnKxHeMxUaWVXQOSIco4tvVvvCxMSfeBMnMM06mpaJt3g+MpxYQQrDfojUQldP1xxraPSJYSMEljoWM/dCg==
dependencies:
- "@babel/helper-builder-react-jsx-experimental" "^7.12.4"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/plugin-syntax-jsx" "^7.12.1"
+ "@babel/plugin-transform-react-jsx" "^7.12.12"
-"@babel/plugin-transform-react-jsx@^7.12.10":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.10.tgz#a7af3097c73479123594c8c8fe39545abebd44e3"
- integrity sha512-MM7/BC8QdHXM7Qc1wdnuk73R4gbuOpfrSUgfV/nODGc86sPY1tgmY2M9E9uAnf2e4DOIp8aKGWqgZfQxnTNGuw==
+"@babel/plugin-transform-react-jsx@^7.12.12", "@babel/plugin-transform-react-jsx@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.13.tgz#6c9f993b9f6fb6f0e32a4821ed59349748576a3e"
+ integrity sha512-hhXZMYR8t9RvduN2uW4sjl6MRtUhzNE726JvoJhpjhxKgRUVkZqTsA0xc49ALZxQM7H26pZ/lLvB2Yrea9dllA==
dependencies:
- "@babel/helper-builder-react-jsx" "^7.10.4"
- "@babel/helper-builder-react-jsx-experimental" "^7.12.10"
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/plugin-syntax-jsx" "^7.12.1"
+ "@babel/helper-annotate-as-pure" "^7.12.13"
+ "@babel/helper-module-imports" "^7.12.13"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/plugin-syntax-jsx" "^7.12.13"
+ "@babel/types" "^7.12.13"
"@babel/plugin-transform-react-pure-annotations@^7.12.1":
version "7.12.1"
@@ -946,15 +917,15 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"
-"@babel/preset-react@7.12.10", "@babel/preset-react@^7.9.4":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.12.10.tgz#4fed65f296cbb0f5fb09de6be8cddc85cc909be9"
- integrity sha512-vtQNjaHRl4DUpp+t+g4wvTHsLQuye+n0H/wsXIZRn69oz/fvNC7gQ4IK73zGJBaxvHoxElDvnYCthMcT7uzFoQ==
+"@babel/preset-react@7.12.13", "@babel/preset-react@^7.9.4":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.12.13.tgz#5f911b2eb24277fa686820d5bd81cad9a0602a0a"
+ integrity sha512-TYM0V9z6Abb6dj1K7i5NrEhA13oS5ujUYQYDfqIBXYHOc2c2VkFgc+q9kyssIyUfy4/hEwqrgSlJ/Qgv8zJLsA==
dependencies:
- "@babel/helper-plugin-utils" "^7.10.4"
- "@babel/plugin-transform-react-display-name" "^7.12.1"
- "@babel/plugin-transform-react-jsx" "^7.12.10"
- "@babel/plugin-transform-react-jsx-development" "^7.12.7"
+ "@babel/helper-plugin-utils" "^7.12.13"
+ "@babel/plugin-transform-react-display-name" "^7.12.13"
+ "@babel/plugin-transform-react-jsx" "^7.12.13"
+ "@babel/plugin-transform-react-jsx-development" "^7.12.12"
"@babel/plugin-transform-react-pure-annotations" "^7.12.1"
"@babel/register@^7.9.0":
@@ -1008,21 +979,12 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"
-"@babel/types@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae"
- integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA==
+"@babel/types@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611"
+ integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ==
dependencies:
- "@babel/helper-validator-identifier" "^7.10.4"
- lodash "^4.17.19"
- to-fast-properties "^2.0.0"
-
-"@babel/types@^7.12.10", "@babel/types@^7.12.5":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.10.tgz#7965e4a7260b26f09c56bcfcb0498af1f6d9b260"
- integrity sha512-sf6wboJV5mGyip2hIpDSKsr80RszPinEFjsHTalMxZAZkoQ2/2yQzxlcFN52SJqsyPfLtPmenL4g2KB3KJXPDw==
- dependencies:
- "@babel/helper-validator-identifier" "^7.10.4"
+ "@babel/helper-validator-identifier" "^7.12.11"
lodash "^4.17.19"
to-fast-properties "^2.0.0"
From 831c783e9eaeae075f9be9ef7a5b6344cce3f367 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 15:46:46 +0800
Subject: [PATCH 065/237] Build(deps-dev): Bump webpack-cli from 4.4.0 to 4.5.0
in /website (#10229)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 48 ++++++++++++++++++++++----------------------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/website/package.json b/website/package.json
index 36df8d210..bfda79e4d 100644
--- a/website/package.json
+++ b/website/package.json
@@ -24,6 +24,6 @@
"js-yaml": "4.0.0",
"svgo": "1.3.2",
"webpack": "5.20.0",
- "webpack-cli": "4.4.0"
+ "webpack-cli": "4.5.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index ee9303bf0..2fe24cd9d 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -1184,22 +1184,22 @@
"@webassemblyjs/ast" "1.11.0"
"@xtuc/long" "4.2.2"
-"@webpack-cli/configtest@^1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.0.0.tgz#2aff5f1ebc6f793c13ba9b2a701d180eab17f5ee"
- integrity sha512-Un0SdBoN1h4ACnIO7EiCjWuyhNI0Jl96JC+63q6xi4HDUYRZn8Auluea9D+v9NWKc5J4sICVEltdBaVjLX39xw==
+"@webpack-cli/configtest@^1.0.1":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.0.1.tgz#241aecfbdc715eee96bed447ed402e12ec171935"
+ integrity sha512-B+4uBUYhpzDXmwuo3V9yBH6cISwxEI4J+NO5ggDaGEEHb0osY/R7MzeKc0bHURXQuZjMM4qD+bSJCKIuI3eNBQ==
-"@webpack-cli/info@^1.2.1":
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.2.1.tgz#af98311f983d0b9fce7284cfcf1acaf1e9f4879c"
- integrity sha512-fLnDML5HZ5AEKzHul8xLAksoKN2cibu6MgonkUj8R9V7bbeVRkd1XbGEGWrAUNYHbX1jcqCsDEpBviE5StPMzQ==
+"@webpack-cli/info@^1.2.2":
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.2.2.tgz#ef3c0cd947a1fa083e174a59cb74e0b6195c236c"
+ integrity sha512-5U9kUJHnwU+FhKH4PWGZuBC1hTEPYyxGSL5jjoBI96Gx8qcYJGOikpiIpFoTq8mmgX3im2zAo2wanv/alD74KQ==
dependencies:
envinfo "^7.7.3"
-"@webpack-cli/serve@^1.2.2":
- version "1.2.2"
- resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.2.2.tgz#1f8eee44f96524756268f5e3f43e9d943f864d41"
- integrity sha512-03GkWxcgFfm8+WIwcsqJb9agrSDNDDoxaNnexPnCCexP5SCE4IgFd9lNpSy+K2nFqVMpgTFw6SwbmVAVTndVew==
+"@webpack-cli/serve@^1.3.0":
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.3.0.tgz#2730c770f5f1f132767c63dcaaa4ec28f8c56a6c"
+ integrity sha512-k2p2VrONcYVX1wRRrf0f3X2VGltLWcv+JzXRBDmvCxGlCeESx4OXw91TsWeKOkp784uNoVQo313vxJFHXPPwfw==
"@xtuc/ieee754@^1.2.0":
version "1.2.0"
@@ -2063,10 +2063,10 @@ commander@^4.0.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c"
integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==
-commander@^6.2.0:
- version "6.2.0"
- resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
- integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==
+commander@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2"
+ integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==
commondir@^1.0.1:
version "1.0.1"
@@ -7329,17 +7329,17 @@ webidl-conversions@^4.0.2:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
-webpack-cli@4.4.0:
- version "4.4.0"
- resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.4.0.tgz#38c7fa01ea31510f5c490245dd1bb28018792f1b"
- integrity sha512-/Qh07CXfXEkMu5S8wEpjuaw2Zj/CC0hf/qbTDp6N8N7JjdGuaOjZ7kttz+zhuJO/J5m7alQEhNk9lsc4rC6xgQ==
+webpack-cli@4.5.0:
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.5.0.tgz#b5213b84adf6e1f5de6391334c9fa53a48850466"
+ integrity sha512-wXg/ef6Ibstl2f50mnkcHblRPN/P9J4Nlod5Hg9HGFgSeF8rsqDGHJeVe4aR26q9l62TUJi6vmvC2Qz96YJw1Q==
dependencies:
"@discoveryjs/json-ext" "^0.5.0"
- "@webpack-cli/configtest" "^1.0.0"
- "@webpack-cli/info" "^1.2.1"
- "@webpack-cli/serve" "^1.2.2"
+ "@webpack-cli/configtest" "^1.0.1"
+ "@webpack-cli/info" "^1.2.2"
+ "@webpack-cli/serve" "^1.3.0"
colorette "^1.2.1"
- commander "^6.2.0"
+ commander "^7.0.0"
enquirer "^2.3.6"
execa "^5.0.0"
fastest-levenshtein "^1.0.12"
From d34fb7ff3faa3094c3a45a4c4aa5bf7dbbe2fd93 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 3 Feb 2021 08:36:38 +0000
Subject: [PATCH 066/237] Build(deps-dev): Bump @babel/types from 7.12.12 to
7.12.13 (#10230)
---
package.json | 2 +-
yarn.lock | 11 +----------
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/package.json b/package.json
index bbdd6bc2b..214740c9c 100644
--- a/package.json
+++ b/package.json
@@ -87,7 +87,7 @@
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/preset-env": "7.12.13",
- "@babel/types": "7.12.12",
+ "@babel/types": "7.12.13",
"@glimmer/reference": "0.74.2",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-babel": "5.2.3",
diff --git a/yarn.lock b/yarn.lock
index 5daf81de3..749f22ed6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -946,16 +946,7 @@
globals "^11.1.0"
lodash "^4.17.19"
-"@babel/types@7.12.12":
- version "7.12.12"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.12.tgz#4608a6ec313abbd87afa55004d373ad04a96c299"
- integrity sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ==
- dependencies:
- "@babel/helper-validator-identifier" "^7.12.11"
- lodash "^4.17.19"
- to-fast-properties "^2.0.0"
-
-"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
+"@babel/types@7.12.13", "@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611"
integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ==
From 650c21c311079ff107ad871b532e0b088a11b70d Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Wed, 3 Feb 2021 18:17:22 +0800
Subject: [PATCH 067/237] CI: Fix coverage report (#10224)
---
.github/workflows/dev-test.yml | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml
index 10758dee7..532547283 100644
--- a/.github/workflows/dev-test.yml
+++ b/.github/workflows/dev-test.yml
@@ -44,6 +44,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
+ # `codecov/codecov-action` require depth to be at least `2`, see #10219
+ with:
+ fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v2.1.4
@@ -65,8 +68,6 @@ jobs:
uses: codecov/codecov-action@v1.2.1
if: matrix.ENABLE_CODE_COVERAGE
with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./coverage/lcov.info
fail_ci_if_error: true
# #8073 test
@@ -79,6 +80,4 @@ jobs:
uses: codecov/codecov-action@v1.2.1
if: matrix.ENABLE_CODE_COVERAGE
with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./coverage/lcov.info
fail_ci_if_error: true
From 30f9e1adbc54d7283363ed550ec50ffd94d45813 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 4 Feb 2021 09:08:29 +0800
Subject: [PATCH 068/237] Build(deps-dev): Bump @babel/core from 7.12.10 to
7.12.13 (#10232)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheing
---
package.json | 2 +-
.../__snapshots__/third-party.js.snap | 4 +-
yarn.lock | 156 +++---------------
3 files changed, 30 insertions(+), 132 deletions(-)
diff --git a/package.json b/package.json
index 214740c9c..6065e55e9 100644
--- a/package.json
+++ b/package.json
@@ -85,7 +85,7 @@
"yaml-unist-parser": "1.3.1"
},
"devDependencies": {
- "@babel/core": "7.12.10",
+ "@babel/core": "7.12.13",
"@babel/preset-env": "7.12.13",
"@babel/types": "7.12.13",
"@glimmer/reference": "0.74.2",
diff --git a/tests_integration/__tests__/__snapshots__/third-party.js.snap b/tests_integration/__tests__/__snapshots__/third-party.js.snap
index b31fc3040..59921aedb 100644
--- a/tests_integration/__tests__/__snapshots__/third-party.js.snap
+++ b/tests_integration/__tests__/__snapshots__/third-party.js.snap
@@ -5,12 +5,12 @@ exports[`cosmiconfig Invalid json file 1`] = `
> 1 | {a':}
| ^
- 2 |
+ 2 |
Unexpected token a in JSON at position 1 while parsing near '{a':}'
> 1 | {a':}
| ^
- 2 |
+ 2 |
"
`;
diff --git a/yarn.lock b/yarn.lock
index 749f22ed6..31f3462ce 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -16,14 +16,14 @@
dependencies:
"@babel/highlight" "^7.0.0"
-"@babel/code-frame@7.12.11", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4":
+"@babel/code-frame@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
dependencies:
"@babel/highlight" "^7.10.4"
-"@babel/code-frame@^7.12.13":
+"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658"
integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==
@@ -35,19 +35,19 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.12.13.tgz#27e19e0ed3726ccf54067ced4109501765e7e2e8"
integrity sha512-U/hshG5R+SIoW7HVWIdmy1cB7s3ki+r3FpyEZiCgpi4tFgPnX/vynY80ZGSASOIrUM6O7VxOgCZgdt7h97bUGg==
-"@babel/core@7.12.10", "@babel/core@^7.1.0", "@babel/core@^7.7.5":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.10.tgz#b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd"
- integrity sha512-eTAlQKq65zHfkHZV0sIVODCPGVgoo1HdBlbSLi9CqOzuZanMv2ihzY+4paiKr1mH+XmYESMAmJ/dpZ68eN6d8w==
+"@babel/core@7.12.13", "@babel/core@^7.1.0", "@babel/core@^7.7.5":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.13.tgz#b73a87a3a3e7d142a66248bf6ad88b9ceb093425"
+ integrity sha512-BQKE9kXkPlXHPeqissfxo0lySWJcYdEP0hdtJOH/iJfDdhOCcgtNCjftCJg3qqauB4h+lz2N6ixM++b9DN1Tcw==
dependencies:
- "@babel/code-frame" "^7.10.4"
- "@babel/generator" "^7.12.10"
- "@babel/helper-module-transforms" "^7.12.1"
- "@babel/helpers" "^7.12.5"
- "@babel/parser" "^7.12.10"
- "@babel/template" "^7.12.7"
- "@babel/traverse" "^7.12.10"
- "@babel/types" "^7.12.10"
+ "@babel/code-frame" "^7.12.13"
+ "@babel/generator" "^7.12.13"
+ "@babel/helper-module-transforms" "^7.12.13"
+ "@babel/helpers" "^7.12.13"
+ "@babel/parser" "^7.12.13"
+ "@babel/template" "^7.12.13"
+ "@babel/traverse" "^7.12.13"
+ "@babel/types" "^7.12.13"
convert-source-map "^1.7.0"
debug "^4.1.0"
gensync "^1.0.0-beta.1"
@@ -56,15 +56,6 @@
semver "^5.4.1"
source-map "^0.5.0"
-"@babel/generator@^7.12.10":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.10.tgz#2b188fc329fb8e4f762181703beffc0fe6df3460"
- integrity sha512-6mCdfhWgmqLdtTkhXjnIz0LcdVCd26wS2JXRtj2XY0u5klDsXBREA/pG5NVOuVnF2LUrBGNFtQkIqqTbblg0ww==
- dependencies:
- "@babel/types" "^7.12.10"
- jsesc "^2.5.1"
- source-map "^0.5.0"
-
"@babel/generator@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.13.tgz#5f6ebe6c85db99886db2d7b044409196f872a503"
@@ -125,15 +116,6 @@
dependencies:
"@babel/types" "^7.12.13"
-"@babel/helper-function-name@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a"
- integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==
- dependencies:
- "@babel/helper-get-function-arity" "^7.10.4"
- "@babel/template" "^7.10.4"
- "@babel/types" "^7.10.4"
-
"@babel/helper-function-name@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a"
@@ -143,13 +125,6 @@
"@babel/template" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/helper-get-function-arity@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2"
- integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==
- dependencies:
- "@babel/types" "^7.10.4"
-
"@babel/helper-get-function-arity@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583"
@@ -164,13 +139,6 @@
dependencies:
"@babel/types" "^7.12.13"
-"@babel/helper-member-expression-to-functions@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz#fba0f2fcff3fba00e6ecb664bb5e6e26e2d6165c"
- integrity sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==
- dependencies:
- "@babel/types" "^7.12.1"
-
"@babel/helper-member-expression-to-functions@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.13.tgz#c5715695b4f8bab32660dbdcdc2341dec7e3df40"
@@ -178,28 +146,13 @@
dependencies:
"@babel/types" "^7.12.13"
-"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.13":
+"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz#ec67e4404f41750463e455cc3203f6a32e93fcb0"
integrity sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g==
dependencies:
"@babel/types" "^7.12.13"
-"@babel/helper-module-transforms@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c"
- integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==
- dependencies:
- "@babel/helper-module-imports" "^7.12.1"
- "@babel/helper-replace-supers" "^7.12.1"
- "@babel/helper-simple-access" "^7.12.1"
- "@babel/helper-split-export-declaration" "^7.11.0"
- "@babel/helper-validator-identifier" "^7.10.4"
- "@babel/template" "^7.10.4"
- "@babel/traverse" "^7.12.1"
- "@babel/types" "^7.12.1"
- lodash "^4.17.19"
-
"@babel/helper-module-transforms@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.13.tgz#01afb052dcad2044289b7b20beb3fa8bd0265bea"
@@ -215,13 +168,6 @@
"@babel/types" "^7.12.13"
lodash "^4.17.19"
-"@babel/helper-optimise-call-expression@^7.10.4":
- version "7.10.4"
- resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673"
- integrity sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==
- dependencies:
- "@babel/types" "^7.10.4"
-
"@babel/helper-optimise-call-expression@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea"
@@ -243,16 +189,6 @@
"@babel/helper-wrap-function" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/helper-replace-supers@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.1.tgz#f15c9cc897439281891e11d5ce12562ac0cf3fa9"
- integrity sha512-zJjTvtNJnCFsCXVi5rUInstLd/EIVNmIKA1Q9ynESmMBWPWd+7sdR+G4/wdu+Mppfep0XLyG2m7EBPvjCeFyrw==
- dependencies:
- "@babel/helper-member-expression-to-functions" "^7.12.1"
- "@babel/helper-optimise-call-expression" "^7.10.4"
- "@babel/traverse" "^7.12.1"
- "@babel/types" "^7.12.1"
-
"@babel/helper-replace-supers@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.13.tgz#00ec4fb6862546bd3d0aff9aac56074277173121"
@@ -263,13 +199,6 @@
"@babel/traverse" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/helper-simple-access@^7.12.1":
- version "7.12.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136"
- integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==
- dependencies:
- "@babel/types" "^7.12.1"
-
"@babel/helper-simple-access@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.13.tgz#8478bcc5cacf6aa1672b251c1d2dde5ccd61a6c4"
@@ -284,13 +213,6 @@
dependencies:
"@babel/types" "^7.12.1"
-"@babel/helper-split-export-declaration@^7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f"
- integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==
- dependencies:
- "@babel/types" "^7.11.0"
-
"@babel/helper-split-export-declaration@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05"
@@ -318,14 +240,14 @@
"@babel/traverse" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/helpers@^7.12.5":
- version "7.12.5"
- resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.12.5.tgz#1a1ba4a768d9b58310eda516c449913fe647116e"
- integrity sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==
+"@babel/helpers@^7.12.13":
+ version "7.12.13"
+ resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.12.13.tgz#3c75e993632e4dadc0274eae219c73eb7645ba47"
+ integrity sha512-oohVzLRZ3GQEk4Cjhfs9YkJA4TdIDTObdBEZGrd6F/T0GPSnuV6l22eMcxlvcvzVIPH3VTtxbseudM1zIE+rPQ==
dependencies:
- "@babel/template" "^7.10.4"
- "@babel/traverse" "^7.12.5"
- "@babel/types" "^7.12.5"
+ "@babel/template" "^7.12.13"
+ "@babel/traverse" "^7.12.13"
+ "@babel/types" "^7.12.13"
"@babel/highlight@^7.0.0", "@babel/highlight@^7.10.4":
version "7.10.4"
@@ -345,12 +267,12 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
-"@babel/parser@7.12.11", "@babel/parser@^7.1.0", "@babel/parser@^7.12.10", "@babel/parser@^7.12.7", "@babel/parser@^7.7.0":
+"@babel/parser@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79"
integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg==
-"@babel/parser@^7.12.13":
+"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.7.0":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.13.tgz#3ee7be4131fe657ba9143d5c5b3a9f253fdb75e9"
integrity sha512-z7n7ybOUzaRc3wwqLpAX8UFIXsrVXUJhtNGBwAnLz6d1KUapqyq7ad2La8gZ6CXhHmGAIL32cop8Tst4/PNWLw==
@@ -898,16 +820,7 @@
dependencies:
regenerator-runtime "^0.13.4"
-"@babel/template@^7.10.4", "@babel/template@^7.12.7", "@babel/template@^7.3.3":
- version "7.12.7"
- resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc"
- integrity sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==
- dependencies:
- "@babel/code-frame" "^7.10.4"
- "@babel/parser" "^7.12.7"
- "@babel/types" "^7.12.7"
-
-"@babel/template@^7.12.13":
+"@babel/template@^7.12.13", "@babel/template@^7.3.3":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327"
integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==
@@ -916,22 +829,7 @@
"@babel/parser" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5", "@babel/traverse@^7.7.0":
- version "7.12.10"
- resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.10.tgz#2d1f4041e8bf42ea099e5b2dc48d6a594c00017a"
- integrity sha512-6aEtf0IeRgbYWzta29lePeYSk+YAFIC3kyqESeft8o5CkFlYIMX+EQDDWEiAQ9LHOA3d0oHdgrSsID/CKqXJlg==
- dependencies:
- "@babel/code-frame" "^7.10.4"
- "@babel/generator" "^7.12.10"
- "@babel/helper-function-name" "^7.10.4"
- "@babel/helper-split-export-declaration" "^7.11.0"
- "@babel/parser" "^7.12.10"
- "@babel/types" "^7.12.10"
- debug "^4.1.0"
- globals "^11.1.0"
- lodash "^4.17.19"
-
-"@babel/traverse@^7.12.13":
+"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.13", "@babel/traverse@^7.7.0":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.13.tgz#689f0e4b4c08587ad26622832632735fb8c4e0c0"
integrity sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA==
@@ -946,7 +844,7 @@
globals "^11.1.0"
lodash "^4.17.19"
-"@babel/types@7.12.13", "@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
+"@babel/types@7.12.13", "@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611"
integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ==
From d0942b8fae17916917387dd77bb5b7ff79238b94 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 4 Feb 2021 09:42:00 +0800
Subject: [PATCH 069/237] Build(deps): Bump @babel/code-frame from 7.12.11 to
7.12.13 (#10226)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung
---
package.json | 2 +-
.../range/__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 14 +-
.../range/__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 134 ++++++++---------
.../__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
tests/js/bom/__snapshots__/jsfmt.spec.js.snap | 18 +--
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
.../__snapshots__/jsfmt.spec.js.snap | 20 +--
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../cursor/__snapshots__/jsfmt.spec.js.snap | 20 +--
.../__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 10 +-
.../__snapshots__/jsfmt.spec.js.snap | 24 ++--
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
tests/js/eol/__snapshots__/jsfmt.spec.js.snap | 96 ++++++-------
.../exports/__snapshots__/jsfmt.spec.js.snap | 12 +-
.../__snapshots__/jsfmt.spec.js.snap | 24 ++--
.../__snapshots__/jsfmt.spec.js.snap | 12 +-
.../__snapshots__/jsfmt.spec.js.snap | 2 +-
.../literal/__snapshots__/jsfmt.spec.js.snap | 10 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
.../no-semi/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../objects/__snapshots__/jsfmt.spec.js.snap | 14 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 12 +-
.../__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
.../js/range/__snapshots__/jsfmt.spec.js.snap | 136 +++++++++---------
.../record/__snapshots__/jsfmt.spec.js.snap | 24 ++--
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../js/tuple/__snapshots__/jsfmt.spec.js.snap | 26 ++--
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../range/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
.../babel-ts/__snapshots__/jsfmt.spec.js.snap | 6 +-
.../flow/__snapshots__/jsfmt.spec.js.snap | 18 +--
.../graphql/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 14 +-
.../__snapshots__/jsfmt.spec.js.snap | 34 ++---
.../js/__snapshots__/jsfmt.spec.js.snap | 20 +--
.../less/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 14 +-
.../vue/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../yaml/__snapshots__/jsfmt.spec.js.snap | 2 +-
.../js/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../class/__snapshots__/jsfmt.spec.js.snap | 8 +-
.../compiler/__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 4 +-
.../abstract/__snapshots__/jsfmt.spec.js.snap | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 8 +-
.../keywords/__snapshots__/jsfmt.spec.js.snap | 4 +-
.../range/__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../range/__snapshots__/jsfmt.spec.js.snap | 6 +-
tests_config/run_spec.js | 2 +-
.../__tests__/__snapshots__/format.js.snap | 2 +-
yarn.lock | 12 +-
72 files changed, 466 insertions(+), 472 deletions(-)
diff --git a/package.json b/package.json
index 6065e55e9..b177a4abf 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
],
"dependencies": {
"@angular/compiler": "11.1.1",
- "@babel/code-frame": "7.12.11",
+ "@babel/code-frame": "7.12.13",
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.74.2",
"@iarna/toml": "2.2.5",
diff --git a/tests/css/range/__snapshots__/jsfmt.spec.js.snap b/tests/css/range/__snapshots__/jsfmt.spec.js.snap
index 090dfdf59..887c9437f 100644
--- a/tests/css/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/css/range/__snapshots__/jsfmt.spec.js.snap
@@ -9,7 +9,7 @@ rangeEnd: 4
=====================================input======================================
> 1 | .x{}
| ^^^^
- 2 |
+ 2 |
=====================================output=====================================
.x{}
diff --git a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap
index 676102b83..6c97fb86a 100644
--- a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap
@@ -57,12 +57,12 @@ function baz(this: number, ...a) {}
exports[`function_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = `
"Unexpected token, expected \\")\\" (3:16)
1 | // @flow
- 2 |
+ 2 |
> 3 | type T = (this : number, a : string, b : number) => void
| ^
- 4 |
+ 4 |
5 | type U = (this : number, ...c : any) => void
- 6 | "
+ 6 |"
`;
exports[`function_type.js - {"trailingComma":"all"} format 1`] = `
@@ -95,11 +95,11 @@ type V = (this: number) => void;
exports[`line_break.js - {"trailingComma":"all"} [babel-flow] format 1`] = `
"Unexpected token, expected \\")\\" (3:15)
1 | // @flow
- 2 |
+ 2 |
> 3 | type T = (this: boolean,
| ^
4 | a: number,
- 5 |
+ 5 |
6 | b: number,"
`;
@@ -197,13 +197,13 @@ class A {
exports[`union_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = `
"Unexpected token, expected \\")\\" (4:7)
- 2 |
+ 2 |
3 | type A = (
> 4 | this: | SupperLongLongLongLongLongLongLongLongLongLongLongType | FooBarBazLorem12345,
| ^
5 | b: number,
6 | ) => boolean;
- 7 | "
+ 7 |"
`;
exports[`union_type.js - {"trailingComma":"all"} format 1`] = `
diff --git a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap
index 648665abd..7a5bd1d3d 100644
--- a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap
@@ -9,7 +9,7 @@ rangeEnd: 3
=====================================input======================================
> 1 | {NPC{life}}
| ^^^
- 2 |
+ 2 |
=====================================output=====================================
{
NPC {
diff --git a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap
index c11bf4473..c7d0ae146 100644
--- a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap
@@ -309,7 +309,7 @@ exports[`class-property.js [espree] format 1`] = `
> 3 | static propTypes = {};
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`class-property.js - {"arrowParens":"always"} [espree] format 1`] = `
@@ -319,7 +319,7 @@ exports[`class-property.js - {"arrowParens":"always"} [espree] format 1`] = `
> 3 | static propTypes = {};
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`class-property.js - {"arrowParens":"always"} format 1`] = `
@@ -350,7 +350,7 @@ exports[`class-property.js - {"trailingComma":"all"} [espree] format 1`] = `
> 3 | static propTypes = {};
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`class-property.js - {"trailingComma":"all"} format 1`] = `
diff --git a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
index a6820e80c..6e78ef4d3 100644
--- a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`arrows-bind.js [espree] format 1`] = `
| ^
2 | (a => b)::c;
3 | a::(b => c);
- 4 | "
+ 4 |"
`;
exports[`arrows-bind.js [meriyah] format 1`] = `
@@ -15,7 +15,7 @@ exports[`arrows-bind.js [meriyah] format 1`] = `
| ^
2 | (a => b)::c;
3 | a::(b => c);
- 4 | "
+ 4 |"
`;
exports[`arrows-bind.js format 1`] = `
diff --git a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
index 6618920b1..cb22f4f14 100644
--- a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,7 @@ exports[`newline-before-arrow.js [espree] format 1`] = `
1 | async x
> 2 | => x
| ^
- 3 | "
+ 3 |"
`;
exports[`newline-before-arrow.js [meriyah] format 1`] = `
@@ -13,7 +13,7 @@ exports[`newline-before-arrow.js [meriyah] format 1`] = `
1 | async x
> 2 | => x
| ^
- 3 | "
+ 3 |"
`;
exports[`newline-before-arrow.js format 1`] = `
diff --git a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
index ac88339fa..4adcb644e 100644
--- a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
@@ -425,7 +425,7 @@ class C {
exports[`decimal.js [espree] format 1`] = `
"Identifier directly after number (3:4)
1 | // https://github.com/babel/babel/pull/11640
- 2 |
+ 2 |
> 3 | 100m;
| ^
4 | 9223372036854775807m;
@@ -436,7 +436,7 @@ exports[`decimal.js [espree] format 1`] = `
exports[`decimal.js [meriyah] format 1`] = `
"[3:3]: No identifiers allowed directly after numeric literal (3:3)
1 | // https://github.com/babel/babel/pull/11640
- 2 |
+ 2 |
> 3 | 100m;
| ^
4 | 9223372036854775807m;
@@ -510,11 +510,11 @@ typeof 1m === "decimal128";
exports[`decorators.js [espree] format 1`] = `
"Unexpected character '@' (3:1)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-decorators
- 2 |
+ 2 |
> 3 | @annotation
| ^
4 | class MyClass { }
- 5 |
+ 5 |
6 | function annotation(target) {"
`;
@@ -591,7 +591,7 @@ function enumerable(value) {
exports[`do-expressions.js [espree] format 1`] = `
"Unexpected token do (3:9)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions
- 2 |
+ 2 |
> 3 | let a = do {
| ^
4 | if(x > 10) {
@@ -602,7 +602,7 @@ exports[`do-expressions.js [espree] format 1`] = `
exports[`do-expressions.js [meriyah] format 1`] = `
"[3:10]: Unexpected token: 'do' (3:10)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions
- 2 |
+ 2 |
> 3 | let a = do {
| ^
4 | if(x > 10) {
@@ -674,20 +674,20 @@ import(prettier).then((module) => console.log(module));
exports[`export-default-from.js [espree] format 1`] = `
"Unexpected token v (4:8)
- 2 |
- 3 |
+ 2 |
+ 3 |
> 4 | export v from 'mod';
| ^
- 5 | "
+ 5 |"
`;
exports[`export-default-from.js [meriyah] format 1`] = `
"[4:8]: Unexpected token: 'identifier' (4:8)
- 2 |
- 3 |
+ 2 |
+ 3 |
> 4 | export v from 'mod';
| ^
- 5 | "
+ 5 |"
`;
exports[`export-default-from.js format 1`] = `
@@ -730,19 +730,19 @@ export * as ns from "mod";
exports[`flow.js [espree] format 1`] = `
"Unexpected token : (3:17)
1 | // https://babeljs.io/docs/en/babel-preset-flow
- 2 |
+ 2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 | "
+ 4 |"
`;
exports[`flow.js [meriyah] format 1`] = `
"[3:17]: Expected ')' (3:17)
1 | // https://babeljs.io/docs/en/babel-preset-flow
- 2 |
+ 2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 | "
+ 4 |"
`;
exports[`flow.js format 1`] = `
@@ -766,23 +766,23 @@ function foo(one: any, two: number, three?): string {}
exports[`function-bind.js [espree] format 1`] = `
"Unexpected token : (3:5)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind
- 2 |
+ 2 |
> 3 | obj::func
| ^
4 | // is equivalent to:
5 | func.bind(obj)
- 6 | "
+ 6 |"
`;
exports[`function-bind.js [meriyah] format 1`] = `
"[3:5]: Unexpected token: ':' (3:5)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind
- 2 |
+ 2 |
> 3 | obj::func
| ^
4 | // is equivalent to:
5 | func.bind(obj)
- 6 | "
+ 6 |"
`;
exports[`function-bind.js format 1`] = `
@@ -832,24 +832,24 @@ obj.func.call(obj, val);
exports[`function-sent.js [espree] format 1`] = `
"Unexpected token . (4:33)
- 2 |
+ 2 |
3 | function* generator() {
> 4 | console.log(\\"Sent\\", function.sent);
| ^
5 | console.log(\\"Yield\\", yield);
6 | }
- 7 | "
+ 7 |"
`;
exports[`function-sent.js [meriyah] format 1`] = `
"[4:33]: Expected '(' (4:33)
- 2 |
+ 2 |
3 | function* generator() {
> 4 | console.log(\\"Sent\\", function.sent);
| ^
5 | console.log(\\"Yield\\", yield);
6 | }
- 7 | "
+ 7 |"
`;
exports[`function-sent.js format 1`] = `
@@ -888,14 +888,14 @@ exports[`import-assertions-dynamic.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`import-assertions-dynamic.js [meriyah] format 1`] = `
"[1:20]: Expected ')' (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`import-assertions-dynamic.js format 1`] = `
@@ -916,14 +916,14 @@ exports[`import-assertions-static.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`import-assertions-static.js [meriyah] format 1`] = `
"[1:36]: Unexpected token: 'identifier' (1:36)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`import-assertions-static.js format 1`] = `
@@ -1017,11 +1017,11 @@ var profile = (
exports[`logical-assignment-operators.js [meriyah] format 1`] = `
"[3:5]: Unexpected token: '=' (3:5)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators
- 2 |
+ 2 |
> 3 | a ||= b;
| ^
4 | obj.a.b ||= c;
- 5 |
+ 5 |
6 | a &&= b;"
`;
@@ -1056,7 +1056,7 @@ exports[`module-string-names.js [espree] format 1`] = `
> 1 | import { \\"π\\" as smile } from \\"./emojis.js\\";
| ^
2 | export { smile as \\"π\\" } from \\"./emojis.js\\";
- 3 | "
+ 3 |"
`;
exports[`module-string-names.js [meriyah] format 1`] = `
@@ -1064,7 +1064,7 @@ exports[`module-string-names.js [meriyah] format 1`] = `
> 1 | import { \\"π\\" as smile } from \\"./emojis.js\\";
| ^
2 | export { smile as \\"π\\" } from \\"./emojis.js\\";
- 3 | "
+ 3 |"
`;
exports[`module-string-names.js format 1`] = `
@@ -1260,10 +1260,10 @@ try {
exports[`optional-chaining.js [espree] format 1`] = `
"Optional chaining cannot appear in the callee of new expressions (56:21)
54 | };
- 55 |
+ 55 |
> 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance
| ^
- 57 |
+ 57 |
58 | const safe5 = new obj?.qux?.baz(); // undefined
59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined"
`;
@@ -1271,10 +1271,10 @@ exports[`optional-chaining.js [espree] format 1`] = `
exports[`optional-chaining.js [meriyah] format 1`] = `
"[56:22]: Invalid optional chain from new expression (56:22)
54 | };
- 55 |
+ 55 |
> 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance
| ^
- 57 |
+ 57 |
58 | const safe5 = new obj?.qux?.baz(); // undefined
59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined"
`;
@@ -1444,22 +1444,22 @@ const ret = delete obj?.foo?.bar?.baz; // true
exports[`partial-application.js [espree] format 1`] = `
"Unexpected token ? (5:23)
3 | function add(x, y) { return x + y; }
- 4 |
+ 4 |
> 5 | const addOne = add(1, ?); // apply from the left
| ^
6 | addOne(2); // 3
- 7 |
+ 7 |
8 | const addTen = add(?, 10); // apply from the right"
`;
exports[`partial-application.js [meriyah] format 1`] = `
"[5:23]: Unexpected token: '?' (5:23)
3 | function add(x, y) { return x + y; }
- 4 |
+ 4 |
> 5 | const addOne = add(1, ?); // apply from the left
| ^
6 | addOne(2); // 3
- 7 |
+ 7 |
8 | const addTen = add(?, 10); // apply from the right"
`;
@@ -1519,7 +1519,7 @@ super.f(?); // partial application allowed for call on |SuperProperty|
exports[`pipeline-operator-fsharp.js [espree] format 1`] = `
"Unexpected token > (5:4)
- 3 |
+ 3 |
4 | promise
> 5 | |> await
| ^
@@ -1530,7 +1530,7 @@ exports[`pipeline-operator-fsharp.js [espree] format 1`] = `
exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = `
"[5:4]: Unexpected token: '>' (5:4)
- 3 |
+ 3 |
4 | promise
> 5 | |> await
| ^
@@ -1617,7 +1617,7 @@ let newScore = boundScore(0, 100, add(7, double(person.score)));
exports[`pipeline-operator-minimal.js [espree] format 1`] = `
"Identifier 'result' has already been declared (7:5)
5 | result //=> \\"Hello, hello!\\"
- 6 |
+ 6 |
> 7 | let result = \\"hello\\"
| ^
8 | |> doubleSay
@@ -1627,13 +1627,13 @@ exports[`pipeline-operator-minimal.js [espree] format 1`] = `
exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
"[8:4]: Unexpected token: '>' (8:4)
- 6 |
+ 6 |
7 | let result = \\"hello\\"
> 8 | |> doubleSay
| ^
9 | |> capitalize
10 | |> exclaim;
- 11 | "
+ 11 |"
`;
exports[`pipeline-operator-minimal.js format 1`] = `
@@ -1671,7 +1671,7 @@ result; //=> "Hello, hello!"
exports[`pipeline-operator-smart.js [espree] format 1`] = `
"Unexpected token > (5:2)
- 3 |
+ 3 |
4 | value
> 5 | |> await #
| ^
@@ -1682,7 +1682,7 @@ exports[`pipeline-operator-smart.js [espree] format 1`] = `
exports[`pipeline-operator-smart.js [meriyah] format 1`] = `
"[5:2]: Unexpected token: '>' (5:2)
- 3 |
+ 3 |
4 | value
> 5 | |> await #
| ^
@@ -1731,11 +1731,11 @@ value
exports[`private-fields-in-in.js [espree] format 1`] = `
"Unexpected character '#' (4:3)
- 2 |
+ 2 |
3 | class C {
> 4 | #brand;
| ^
- 5 |
+ 5 |
6 | static isC(obj) {
7 | try {"
`;
@@ -1864,11 +1864,11 @@ class C {
exports[`private-methods.js [espree] format 1`] = `
"Unexpected character '#' (6:3)
- 4 |
+ 4 |
5 | class Counter extends HTMLElement {
> 6 | #xValue = 0;
| ^
- 7 |
+ 7 |
8 | get #x() { return this.#xValue; }
9 | set #x(value) {"
`;
@@ -1970,14 +1970,14 @@ exports[`record-tuple-tuple.js [espree] format 1`] = `
"Unexpected character '#' (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 | "
+ 2 |"
`;
exports[`record-tuple-tuple.js [meriyah] format 1`] = `
"[1:16]: '#' not followed by identifier (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 | "
+ 2 |"
`;
exports[`record-tuple-tuple.js format 1`] = `
@@ -1997,23 +1997,23 @@ const tuple1 = #[1, 2, 3];
exports[`throw-expressions.js [espree] format 1`] = `
"Unexpected token throw (3:23)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions
- 2 |
+ 2 |
> 3 | function test(param = throw new Error('required!')) {
| ^
4 | const test = param === true || throw new Error('Falsy!');
5 | }
- 6 | "
+ 6 |"
`;
exports[`throw-expressions.js [meriyah] format 1`] = `
"[3:27]: Unexpected token: 'throw' (3:27)
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions
- 2 |
+ 2 |
> 3 | function test(param = throw new Error('required!')) {
| ^
4 | const test = param === true || throw new Error('Falsy!');
5 | }
- 6 | "
+ 6 |"
`;
exports[`throw-expressions.js format 1`] = `
@@ -2041,19 +2041,19 @@ function test(param = throw new Error("required!")) {
exports[`typescript.js [espree] format 1`] = `
"Unexpected token : (3:8)
1 | // https://babeljs.io/docs/en/babel-preset-typescript
- 2 |
+ 2 |
> 3 | const x: number = 0;
| ^
- 4 | "
+ 4 |"
`;
exports[`typescript.js [meriyah] format 1`] = `
"[3:8]: Missing initializer in const declaration (3:8)
1 | // https://babeljs.io/docs/en/babel-preset-typescript
- 2 |
+ 2 |
> 3 | const x: number = 0;
| ^
- 4 | "
+ 4 |"
`;
exports[`typescript.js format 1`] = `
@@ -2077,22 +2077,22 @@ const x: number = 0;
exports[`v8intrinsic.js [espree] format 1`] = `
"Unexpected token % (3:1)
1 | // https://github.com/babel/babel/pull/10148
- 2 |
+ 2 |
> 3 | %DebugPrint(foo);
| ^
- 4 |
- 5 |
+ 4 |
+ 5 |
6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json"
`;
exports[`v8intrinsic.js [meriyah] format 1`] = `
"[3:1]: Unexpected token: '%' (3:1)
1 | // https://github.com/babel/babel/pull/10148
- 2 |
+ 2 |
> 3 | %DebugPrint(foo);
| ^
- 4 |
- 5 |
+ 4 |
+ 5 |
6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json"
`;
diff --git a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
index 912e5c4eb..5effef05e 100644
--- a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
@@ -744,7 +744,7 @@ exports[`like-regexp.js [espree] format 1`] = `
"Unterminated regular expression (1:19)
> 1 | 0 ? a : { b : 1 }/2;
| ^
- 2 | "
+ 2 |"
`;
exports[`like-regexp.js format 1`] = `
diff --git a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
index 1de03edb8..c5580b524 100644
--- a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,7 @@ exports[`await.js [espree] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`await.js [meriyah] format 1`] = `
@@ -17,7 +17,7 @@ exports[`await.js [meriyah] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`await.js - {"semi":false} [espree] format 1`] = `
@@ -27,7 +27,7 @@ exports[`await.js - {"semi":false} [espree] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`await.js - {"semi":false} [meriyah] format 1`] = `
@@ -37,7 +37,7 @@ exports[`await.js - {"semi":false} [meriyah] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 | "
+ 5 |"
`;
exports[`await.js - {"semi":false} format 1`] = `
diff --git a/tests/js/bom/__snapshots__/jsfmt.spec.js.snap b/tests/js/bom/__snapshots__/jsfmt.spec.js.snap
index ea19003f7..b14dd255e 100644
--- a/tests/js/bom/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/bom/__snapshots__/jsfmt.spec.js.snap
@@ -27,13 +27,13 @@ rangeStart: 11
| | printWidth
=====================================input======================================
1 | ο»Ώ
- 2 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( <|> ) {}
| ^^^^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
ο»Ώ
@@ -55,15 +55,15 @@ rangeStart: 11
| | printWidth
=====================================input======================================
1 | ο»Ώ
- 2 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
- 8 |
+ 8 |
=====================================output=====================================
ο»Ώ
@@ -86,16 +86,16 @@ rangeStart: 12
| | printWidth
=====================================input======================================
1 | ο»Ώ
- 2 |
- 3 |
+ 2 |
+ 3 |
> 4 | class a {
| ^^^^
> 5 | b( <|> ) {}
| ^^^^^^^^^^^^^^
6 | }
- 7 |
+ 7 |
8 | let x
- 9 |
+ 9 |
=====================================output=====================================
ο»Ώ
diff --git a/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap b/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap
index d211bc9a1..439b8891e 100644
--- a/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,7 @@ exports[`import.js [espree] format 1`] = `
> 1 | import(/* comment */)
| ^
2 | new import(/* comment */)
- 3 | "
+ 3 |"
`;
exports[`import.js [flow] format 1`] = `
@@ -13,7 +13,7 @@ exports[`import.js [flow] format 1`] = `
> 1 | import(/* comment */)
| ^
2 | new import(/* comment */)
- 3 | "
+ 3 |"
`;
exports[`import.js [meriyah] format 1`] = `
@@ -21,7 +21,7 @@ exports[`import.js [meriyah] format 1`] = `
> 1 | import(/* comment */)
| ^
2 | new import(/* comment */)
- 3 | "
+ 3 |"
`;
exports[`import.js [typescript] format 1`] = `
@@ -29,7 +29,7 @@ exports[`import.js [typescript] format 1`] = `
1 | import(/* comment */)
> 2 | new import(/* comment */)
| ^
- 3 | "
+ 3 |"
`;
exports[`import.js format 1`] = `
diff --git a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
index ac500b314..67fe4bafd 100644
--- a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
@@ -3,37 +3,37 @@
exports[`optional-chaining.js [espree] format 1`] = `
"Unexpected character '#' (3:13)
1 | // https://github.com/babel/babel/pull/11669
- 2 |
+ 2 |
> 3 | delete obj?.#x.a
| ^
- 4 | "
+ 4 |"
`;
exports[`optional-chaining.js [meriyah] format 1`] = `
"[3:13]: Dot property must be an identifier (3:13)
1 | // https://github.com/babel/babel/pull/11669
- 2 |
+ 2 |
> 3 | delete obj?.#x.a
| ^
- 4 | "
+ 4 |"
`;
exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = `
"Unexpected character '#' (3:13)
1 | // https://github.com/babel/babel/pull/11669
- 2 |
+ 2 |
> 3 | delete obj?.#x.a
| ^
- 4 | "
+ 4 |"
`;
exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = `
"[3:13]: Dot property must be an identifier (3:13)
1 | // https://github.com/babel/babel/pull/11669
- 2 |
+ 2 |
> 3 | delete obj?.#x.a
| ^
- 4 | "
+ 4 |"
`;
exports[`optional-chaining.js - {"semi":false} format 1`] = `
@@ -78,7 +78,7 @@ exports[`private_fields.js [espree] format 1`] = `
> 1 | class A { #x; #y; }
| ^
2 | class B { #x = 0; #y = 1; }
- 3 |
+ 3 |
4 | class C {"
`;
@@ -87,7 +87,7 @@ exports[`private_fields.js - {"semi":false} [espree] format 1`] = `
> 1 | class A { #x; #y; }
| ^
2 | class B { #x = 0; #y = 1; }
- 3 |
+ 3 |
4 | class C {"
`;
diff --git a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
index 97ffe2ef4..b0ab6e9d7 100644
--- a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`example.js [espree] format 1`] = `
"'super' keyword outside a method (1:1)
> 1 | super();
| ^
- 2 | "
+ 2 |"
`;
exports[`example.js [meriyah] format 1`] = `
"[1:6]: Calls to super must be in the \\"constructor\\" method of a class expression or class declaration that has a superclass (1:6)
> 1 | super();
| ^
- 2 | "
+ 2 |"
`;
exports[`example.js format 1`] = `
diff --git a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
index 3df1a940d..ab3787427 100644
--- a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,7 @@ exports[`pipeline_own_line.js [espree] format 1`] = `
> 4 | |> x
| ^
5 | }
- 6 |
+ 6 |
7 | bifornCringerMoshedPerplexSawder("
`;
@@ -18,7 +18,7 @@ exports[`pipeline_own_line.js [meriyah] format 1`] = `
> 4 | |> x
| ^
5 | }
- 6 |
+ 6 |
7 | bifornCringerMoshedPerplexSawder("
`;
diff --git a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap
index 09262351b..459e006ec 100644
--- a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap
@@ -315,10 +315,10 @@ rangeStart: 31
| | printWidth
=====================================input======================================
1 | thisWontBeFormatted ( 1 ,3)
- 2 |
+ 2 |
> 3 | thisWillBeFormatted <|> (2 ,3, )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-> 4 |
+> 4 |
| ^
> 5 | thisWontBeFormatted (2, 90 ,)
| ^
@@ -343,10 +343,10 @@ rangeStart: 31
| | printWidth
=====================================input======================================
1 | thisWontBeFormatted ( 1 ,3)
- 2 |
+ 2 |
> 3 | thisWillBeFormatted (2 ,3<|>, )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-> 4 |
+> 4 |
| ^
> 5 | thisWontBeFormatted (2, 90 ,)
| ^
@@ -371,10 +371,10 @@ rangeStart: 31
| | printWidth
=====================================input======================================
1 | thisWontBeFormatted ( 1 ,3)
- 2 |
+ 2 |
> 3 | thisWillBeFormatted (2 ,3, <|> )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-> 4 |
+> 4 |
| ^
> 5 | thisWontBeFormatted (2, 90 ,)
| ^
@@ -399,11 +399,11 @@ rangeStart: 30
| | printWidth
=====================================input======================================
1 | thisWontBeFormatted <|> ( 1 ,3)
-> 2 |
+> 2 |
| ^
> 3 | thisWillBeFormatted (2 ,3, )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-> 4 |
+> 4 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 5 | thisWontBeFormatted (2, 90 ,)
| ^
@@ -428,10 +428,10 @@ rangeStart: 31
| | printWidth
=====================================input======================================
1 | thisWontBeFormatted ( 1 ,3)
- 2 |
+ 2 |
> 3 | thisWillBeFormatted (2 ,3, )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-> 4 |
+> 4 |
| ^
> 5 | thisWontBeFormatted (2, 9<|>0 ,)
| ^^^^
diff --git a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap
index c1fda3302..d28627f51 100644
--- a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap
@@ -17,7 +17,7 @@ exports[`comments.js [meriyah] format 1`] = `
> 4 | static property: Array;
| ^
5 | }
- 6 | "
+ 6 |"
`;
exports[`comments.js format 1`] = `
diff --git a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
index 403bcc68d..eabe686e0 100644
--- a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
@@ -4,18 +4,18 @@ exports[`after_export.js [espree] format 1`] = `
"Unexpected character '@' (1:8)
> 1 | export @decorator class Foo {}
| ^
- 2 |
+ 2 |
3 | export default @decorator class {}
- 4 | "
+ 4 |"
`;
exports[`after_export.js [meriyah] format 1`] = `
"[1:8]: Unexpected token: '@' (1:8)
> 1 | export @decorator class Foo {}
| ^
- 2 |
+ 2 |
3 | export default @decorator class {}
- 4 | "
+ 4 |"
`;
exports[`after_export.js format 1`] = `
@@ -45,7 +45,7 @@ exports[`before_export.js [espree] format 1`] = `
> 1 | @decorator
| ^
2 | export class Foo {}
- 3 |
+ 3 |
4 | @decorator"
`;
diff --git a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap
index 085fb5091..c63ccd585 100644
--- a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap
@@ -4,9 +4,9 @@ exports[`classes.js [espree] format 1`] = `
"Unexpected character '@' (1:1)
> 1 | @deco class Foo {}
| ^
- 2 |
+ 2 |
3 | @deco export class Bar {}
- 4 | "
+ 4 |"
`;
exports[`classes.js format 1`] = `
@@ -59,7 +59,7 @@ const bar =
exports[`comments.js [espree] format 1`] = `
"Unexpected character '@' (3:1)
1 | var x = 100
- 2 |
+ 2 |
> 3 | @Hello({
| ^
4 | a: 'a', // Comment is in the wrong place
@@ -140,12 +140,12 @@ export class Bar {}
exports[`methods.js [espree] format 1`] = `
"Unexpected character '@' (3:3)
- 1 |
+ 1 |
2 | class Yo {
> 3 | @foo(\\"hello\\")
| ^
4 | async plop() {}
- 5 |
+ 5 |
6 | @anotherDecoratorWithALongName(\\"and a very long string as a first argument\\")"
`;
@@ -184,7 +184,7 @@ class Yo {
exports[`mixed.js [espree] format 1`] = `
"Unexpected character '@' (3:1)
1 | // https://github.com/prettier/prettier/issues/6747
- 2 |
+ 2 |
> 3 | @foo
| ^
4 | export default class MyComponent {
@@ -221,22 +221,22 @@ export default class MyComponent {
exports[`mobx.js [espree] format 1`] = `
"Unexpected character '@' (3:1)
1 | import {observable} from \\"mobx\\";
- 2 |
+ 2 |
> 3 | @observer class OrderLine {
| ^
4 | @observable price:number = 0;
5 | @observable amount:number = 1;
- 6 | "
+ 6 |"
`;
exports[`mobx.js [meriyah] format 1`] = `
"[4:20]: Unexpected token: ':' (4:20)
- 2 |
+ 2 |
3 | @observer class OrderLine {
> 4 | @observable price:number = 0;
| ^
5 | @observable amount:number = 1;
- 6 |
+ 6 |
7 | constructor(price) {"
`;
@@ -438,7 +438,7 @@ exports[`parens.js [espree] format 1`] = `
| ^
3 | x
4 | }
- 5 | "
+ 5 |"
`;
exports[`parens.js format 1`] = `
@@ -466,7 +466,7 @@ exports[`redux.js [espree] format 1`] = `
> 1 | @connect(mapStateToProps, mapDispatchToProps)
| ^
2 | export class MyApp extends React.Component {}
- 3 |
+ 3 |
4 | @connect(state => ({ todos: state.todos }))"
`;
diff --git a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
index 66f06ab32..e35226160 100644
--- a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
@@ -4,28 +4,28 @@ exports[`assertions.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`assertions.js [flow] format 1`] = `
"Unexpected token \`,\`, expected the token \`)\` (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`assertions.js [meriyah] format 1`] = `
"[1:20]: Expected ')' (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`assertions.js [typescript] format 1`] = `
"Dynamic import must have one specifier as an argument. (1:8)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`assertions.js format 1`] = `
diff --git a/tests/js/eol/__snapshots__/jsfmt.spec.js.snap b/tests/js/eol/__snapshots__/jsfmt.spec.js.snap
index 527b3d550..07f517f29 100644
--- a/tests/js/eol/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/eol/__snapshots__/jsfmt.spec.js.snap
@@ -82,14 +82,14 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( <|> ) {}
| ^^^^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
@@ -112,14 +112,14 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( <|> ) {}
| ^^^^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
@@ -142,14 +142,14 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( <|> ) {}
| ^^^^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
@@ -172,14 +172,14 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( <|> ) {}
| ^^^^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
@@ -201,16 +201,16 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
- 8 |
+ 8 |
=====================================output=====================================
@@ -232,16 +232,16 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
- 8 |
+ 8 |
=====================================output=====================================
@@ -263,16 +263,16 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
- 8 |
+ 8 |
=====================================output=====================================
@@ -294,16 +294,16 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
- 8 |
+ 8 |
=====================================output=====================================
@@ -326,17 +326,17 @@ rangeEnd: 27
rangeStart: 11
| | printWidth
=====================================input======================================
- 1 |
- 2 |
- 3 |
+ 1 |
+ 2 |
+ 3 |
> 4 | class a {
| ^^^^
> 5 | b( <|> ) {}
| ^^^^^^^^^^^^^^
6 | }
- 7 |
+ 7 |
8 | let x
- 9 |
+ 9 |
=====================================output=====================================
@@ -360,17 +360,17 @@ rangeEnd: 27
rangeStart: 11
| | printWidth
=====================================input======================================
- 1 |
- 2 |
- 3 |
+ 1 |
+ 2 |
+ 3 |
> 4 | class a {
| ^^^^
> 5 | b( <|> ) {}
| ^^^^^^^^^^^^^^
6 | }
- 7 |
+ 7 |
8 | let x
- 9 |
+ 9 |
=====================================output=====================================
@@ -394,17 +394,17 @@ rangeEnd: 27
rangeStart: 11
| | printWidth
=====================================input======================================
- 1 |
- 2 |
- 3 |
+ 1 |
+ 2 |
+ 3 |
> 4 | class a {
| ^^^^
> 5 | b( <|> ) {}
| ^^^^^^^^^^^^^^
6 | }
- 7 |
+ 7 |
8 | let x
- 9 |
+ 9 |
=====================================output=====================================
@@ -428,17 +428,17 @@ rangeEnd: 27
rangeStart: 11
| | printWidth
=====================================input======================================
- 1 |
- 2 |
- 3 |
+ 1 |
+ 2 |
+ 3 |
> 4 | class a {
| ^^^^
> 5 | b( <|> ) {}
| ^^^^^^^^^^^^^^
6 | }
- 7 |
+ 7 |
8 | let x
- 9 |
+ 9 |
=====================================output=====================================
diff --git a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap
index 0d9be4fbf..9366302a9 100644
--- a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap
@@ -3,23 +3,23 @@
exports[`test.js [espree] format 1`] = `
"Unexpected token a (3:8)
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\";
- 2 |
+ 2 |
> 3 | export a,{b} from \\"./baz\\";
| ^
- 4 |
+ 4 |
5 | export * as ns from \\"mod\\";
- 6 | "
+ 6 |"
`;
exports[`test.js [meriyah] format 1`] = `
"[3:8]: Unexpected token: 'identifier' (3:8)
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\";
- 2 |
+ 2 |
> 3 | export a,{b} from \\"./baz\\";
| ^
- 4 |
+ 4 |
5 | export * as ns from \\"mod\\";
- 6 | "
+ 6 |"
`;
exports[`test.js format 1`] = `
diff --git a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
index 1dfb06751..bd4aa50ec 100644
--- a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`dynamic-import.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.js [meriyah] format 1`] = `
"[1:20]: Expected ')' (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.js format 1`] = `
@@ -34,7 +34,7 @@ exports[`empty.js [espree] format 1`] = `
> 2 | export * as bar from \\"bar.json\\" assert { }
| ^
3 | export * as baz from \\"baz.json\\" assert { /* comment */ }
- 4 |
+ 4 |
5 | import * as foo from \\"foo.json\\""
`;
@@ -44,7 +44,7 @@ exports[`empty.js [meriyah] format 1`] = `
> 2 | export * as bar from \\"bar.json\\" assert { }
| ^
3 | export * as baz from \\"baz.json\\" assert { /* comment */ }
- 4 |
+ 4 |
5 | import * as foo from \\"foo.json\\""
`;
@@ -77,14 +77,14 @@ exports[`multi-types.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`multi-types.js [meriyah] format 1`] = `
"[1:36]: Unexpected token: 'identifier' (1:36)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`multi-types.js format 1`] = `
@@ -123,7 +123,7 @@ exports[`re-export.js [espree] format 1`] = `
| ^
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" };
- 4 | "
+ 4 |"
`;
exports[`re-export.js [meriyah] format 1`] = `
@@ -132,7 +132,7 @@ exports[`re-export.js [meriyah] format 1`] = `
| ^
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" };
- 4 | "
+ 4 |"
`;
exports[`re-export.js format 1`] = `
@@ -157,14 +157,14 @@ exports[`static-import.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`static-import.js [meriyah] format 1`] = `
"[1:36]: Unexpected token: 'identifier' (1:36)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`static-import.js format 1`] = `
@@ -185,14 +185,14 @@ exports[`without-from.js [espree] format 1`] = `
"Unexpected token assert (1:14)
> 1 | import \\"foo\\" assert { type: \\"json\\" }
| ^
- 2 | "
+ 2 |"
`;
exports[`without-from.js [meriyah] format 1`] = `
"[1:19]: Unexpected token: 'identifier' (1:19)
> 1 | import \\"foo\\" assert { type: \\"json\\" }
| ^
- 2 | "
+ 2 |"
`;
exports[`without-from.js format 1`] = `
diff --git a/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
index 3e06a9d9e..96bf68213 100644
--- a/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"[1:20]: Expected ')' (1:20)
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
| ^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = `
@@ -59,14 +59,14 @@ exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token assert (1:33)
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"[1:38]: Unexpected token: 'identifier' (1:38)
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`re-export.js - {"bracketSpacing":false} format 1`] = `
@@ -88,14 +88,14 @@ exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"[1:36]: Unexpected token: 'identifier' (1:36)
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`static-import.js - {"bracketSpacing":false} format 1`] = `
diff --git a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
index 5b5a129e1..dce8de945 100644
--- a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,7 @@ exports[`duplicate_bindings.js [espree] format 1`] = `
"Identifier 'A' has already been declared (1:19)
> 1 | class A{} class A{}
| ^
- 2 | "
+ 2 |"
`;
exports[`duplicate_bindings.js format 1`] = `
diff --git a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap
index c57ee6471..5f5daa18c 100644
--- a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,21 @@ exports[`invalid-exponent.js [espree] format 1`] = `
"Invalid number (1:1)
> 1 | 12.3e
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-exponent.js [meriyah] format 1`] = `
"[1:5]: Non-number found after exponent indicator (1:5)
> 1 | 12.3e
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-exponent.js [typescript] format 1`] = `
"Digit expected. (1:6)
> 1 | 12.3e
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-exponent.js format 1`] = `
@@ -42,7 +42,7 @@ exports[`number.js [espree] format 1`] = `
| ^
3 | return (100).toString();
4 | }
- 5 | "
+ 5 |"
`;
exports[`number.js [meriyah] format 1`] = `
@@ -52,7 +52,7 @@ exports[`number.js [meriyah] format 1`] = `
| ^
3 | return (100).toString();
4 | }
- 5 | "
+ 5 |"
`;
exports[`number.js format 1`] = `
diff --git a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
index 20ffcc223..4ea6b04c8 100644
--- a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`invalid.js [espree] format 1`] = `
"Assigning to rvalue (1:21)
> 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid.js [meriyah] format 1`] = `
"[1:19]: Unexpected token: '=' (1:19)
> 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid.js format 1`] = `
@@ -32,7 +32,7 @@ exports[`logical-assignment.js [meriyah] format 1`] = `
"[1:5]: Unexpected token: '=' (1:5)
> 1 | a ||= b;
| ^
- 2 |
+ 2 |
3 | a &&= \\"foo\\";
4 | b ||= \\"foo\\";"
`;
diff --git a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
index 2dab89f0b..d1334de2d 100644
--- a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
@@ -55,7 +55,7 @@ exports[`module-string-names-import.js [espree] format 1`] = `
| ^
2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\";
3 | import { \\"εΈθζηΏδΉοΌδΈδΊ¦θͺͺδΉοΌ\\" as quotation } from \\"Confucius\\";
- 4 | "
+ 4 |"
`;
exports[`module-string-names-import.js [meriyah] format 1`] = `
@@ -64,7 +64,7 @@ exports[`module-string-names-import.js [meriyah] format 1`] = `
| ^
2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\";
3 | import { \\"εΈθζηΏδΉοΌδΈδΊ¦θͺͺδΉοΌ\\" as quotation } from \\"Confucius\\";
- 4 | "
+ 4 |"
`;
exports[`module-string-names-import.js format 1`] = `
diff --git a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
index c5f782e1e..45c5ec714 100644
--- a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,7 @@ exports[`text.js [espree] format 1`] = `
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
| ^
7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`;
- 8 |
+ 8 |
9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;"
`;
@@ -27,7 +27,7 @@ exports[`text.js [meriyah] format 1`] = `
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
| ^
7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`;
- 8 |
+ 8 |
9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;"
`;
diff --git a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
index 1419ffdcc..874fb43cd 100644
--- a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,7 @@ exports[`no-semi.js [espree] format 1`] = `
1 | a
> 2 | ;::b.c
| ^
- 3 |
+ 3 |
4 | class A {
5 | a = b;"
`;
@@ -15,7 +15,7 @@ exports[`no-semi.js [meriyah] format 1`] = `
1 | a
> 2 | ;::b.c
| ^
- 3 |
+ 3 |
4 | class A {
5 | a = b;"
`;
@@ -25,7 +25,7 @@ exports[`no-semi.js - {"semi":false} [espree] format 1`] = `
1 | a
> 2 | ;::b.c
| ^
- 3 |
+ 3 |
4 | class A {
5 | a = b;"
`;
@@ -35,7 +35,7 @@ exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = `
1 | a
> 2 | ;::b.c
| ^
- 3 |
+ 3 |
4 | class A {
5 | a = b;"
`;
diff --git a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
index ec3792c20..609486589 100644
--- a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
@@ -2,7 +2,7 @@
exports[`class.js [espree] format 1`] = `
"Unexpected token ; (12:6)
- 10 |
+ 10 |
11 | class C1 {
> 12 | get; // The semicolon *is* necessary
| ^
@@ -13,7 +13,7 @@ exports[`class.js [espree] format 1`] = `
exports[`class.js - {"semi":false} [espree] format 1`] = `
"Unexpected token ; (12:6)
- 10 |
+ 10 |
11 | class C1 {
> 12 | get; // The semicolon *is* necessary
| ^
diff --git a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap
index 83bc1d99c..a1cdce27f 100644
--- a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap
@@ -153,7 +153,7 @@ exports[`getter-setter.js [espree] format 1`] = `
> 3 | ({ set x() {} });
| ^
4 | ({ get x(x) {} });
- 5 | "
+ 5 |"
`;
exports[`getter-setter.js [meriyah] format 1`] = `
@@ -163,7 +163,7 @@ exports[`getter-setter.js [meriyah] format 1`] = `
> 3 | ({ set x() {} });
| ^
4 | ({ get x(x) {} });
- 5 | "
+ 5 |"
`;
exports[`getter-setter.js format 1`] = `
@@ -192,7 +192,7 @@ printWidth: 80
exports[`invalid-accessor-generator.js [espree] format 1`] = `
"Unexpected token * (5:9)
- 3 |
+ 3 |
4 | ({
> 5 | get *iterator() { },
| ^
@@ -203,7 +203,7 @@ exports[`invalid-accessor-generator.js [espree] format 1`] = `
exports[`invalid-accessor-generator.js [meriyah] format 1`] = `
"[5:9]: A getter cannot be a generator (5:9)
- 3 |
+ 3 |
4 | ({
> 5 | get *iterator() { },
| ^
@@ -214,7 +214,7 @@ exports[`invalid-accessor-generator.js [meriyah] format 1`] = `
exports[`invalid-accessor-generator.js [typescript] format 1`] = `
"Identifier expected. (5:9)
- 3 |
+ 3 |
4 | ({
> 5 | get *iterator() { },
| ^
@@ -257,14 +257,14 @@ exports[`invalid-setter.js [espree] format 1`] = `
"setter should have exactly one param (1:9)
> 1 | ({ set x(){} });
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-setter.js [meriyah] format 1`] = `
"[1:10]: Setter functions must have exactly one argument (1:10)
> 1 | ({ set x(){} });
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-setter.js format 1`] = `
diff --git a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap
index 4d92092e5..6ce064d39 100644
--- a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,7 @@ exports[`test.js [espree] format 1`] = `
> 1 | const addOne = add(1, ?); // apply from the left
| ^
2 | addOne(2); // 3
- 3 |
+ 3 |
4 | const addTen = add(?, 10); // apply from the right"
`;
@@ -14,7 +14,7 @@ exports[`test.js [meriyah] format 1`] = `
> 1 | const addOne = add(1, ?); // apply from the left
| ^
2 | addOne(2); // 3
- 3 |
+ 3 |
4 | const addTen = add(?, 10); // apply from the right"
`;
diff --git a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
index a25032b01..7dcac40c0 100644
--- a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
@@ -163,18 +163,18 @@ exports[`minimal_pipeline_operator.js [espree] format 1`] = `
"Unexpected token > (1:4)
> 1 | a |> b |> c;
| ^
- 2 |
+ 2 |
3 | a |> (b |> c);
- 4 | "
+ 4 |"
`;
exports[`minimal_pipeline_operator.js [meriyah] format 1`] = `
"[1:4]: Unexpected token: '>' (1:4)
> 1 | a |> b |> c;
| ^
- 2 |
+ 2 |
3 | a |> (b |> c);
- 4 | "
+ 4 |"
`;
exports[`minimal_pipeline_operator.js format 1`] = `
@@ -292,7 +292,7 @@ exports[`smart_pipeline_operator.js [espree] format 1`] = `
"Unexpected token > (1:4)
> 1 | a |> await # |> # * 3;
| ^
- 2 |
+ 2 |
3 | foo
4 | |> await #"
`;
@@ -301,7 +301,7 @@ exports[`smart_pipeline_operator.js [meriyah] format 1`] = `
"[1:4]: Unexpected token: '>' (1:4)
> 1 | a |> await # |> # * 3;
| ^
- 2 |
+ 2 |
3 | foo
4 | |> await #"
`;
diff --git a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap
index d2d8b4cf8..c4a9c07ae 100644
--- a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,7 @@ exports[`private-in.js [espree] format 1`] = `
> 1 | if (#prop in obj) {
| ^
2 | }
- 3 |
+ 3 |
4 | #prop in obj;"
`;
diff --git a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
index 83682b792..23a2343d8 100644
--- a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`classes.js - {"quoteProps":"as-needed"} [espree] format 1`] = `
> 2 | a = \\"a\\"
| ^
3 | };
- 4 |
+ 4 |
5 | class B {"
`;
@@ -63,7 +63,7 @@ exports[`classes.js - {"quoteProps":"consistent","singleQuote":true} [espree] fo
> 2 | a = \\"a\\"
| ^
3 | };
- 4 |
+ 4 |
5 | class B {"
`;
@@ -121,7 +121,7 @@ exports[`classes.js - {"quoteProps":"consistent"} [espree] format 1`] = `
> 2 | a = \\"a\\"
| ^
3 | };
- 4 |
+ 4 |
5 | class B {"
`;
@@ -178,7 +178,7 @@ exports[`classes.js - {"quoteProps":"preserve"} [espree] format 1`] = `
> 2 | a = \\"a\\"
| ^
3 | };
- 4 |
+ 4 |
5 | class B {"
`;
diff --git a/tests/js/range/__snapshots__/jsfmt.spec.js.snap b/tests/js/range/__snapshots__/jsfmt.spec.js.snap
index 4378d8da2..6daa8552c 100644
--- a/tests/js/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/range/__snapshots__/jsfmt.spec.js.snap
@@ -12,11 +12,11 @@ rangeStart: 8
2 | ,
> 3 | ,,,,
| ^^^^
-> 4 |
+> 4 |
| ^
> 5 | ,
| ^
-> 6 |
+> 6 |
| ^
7 | ,
8 | a,
@@ -39,7 +39,7 @@ rangeStart: 13
2 | // The range will be 13~26
3 | // \`foo\` ends at 13, should not format
4 | // \`bar\` ends at 26, should format
- 5 |
+ 5 |
=====================================output=====================================
foo = 1.0000;bar = 1.0;baz=1.0000;
// The range will be 13~26
@@ -66,9 +66,9 @@ rangeStart: 28
| ^^^^^^^^^^^^^^^^^
7 | ); d(
8 | );
- 9 |
+ 9 |
10 | }
- 11 |
+ 11 |
=====================================output=====================================
function a(
){
@@ -96,7 +96,7 @@ rangeStart: 13
| ^^^^^^^^^^^^^^^^^
5 | ); d(
6 | );
- 7 |
+ 7 |
=====================================output=====================================
a (
);
@@ -116,14 +116,14 @@ rangeEnd: 26
rangeStart: 10
| | printWidth
=====================================input======================================
- 1 |
- 2 |
+ 1 |
+ 2 |
> 3 | class a {
| ^^^^
> 4 | b( ) {}
| ^^^^^^^^^^^
5 | }
- 6 |
+ 6 |
7 | let x
=====================================output=====================================
@@ -152,7 +152,7 @@ rangeStart: 19
> 4 | call(1,2,3)
| ^^^^^^^^^
5 | }
- 6 |
+ 6 |
=====================================output=====================================
call(1,2,3)
call(1, 2, 3);
@@ -174,7 +174,7 @@ rangeStart: 0
> 1 | 'aaa';
| ^
2 | 'bbb';
- 3 |
+ 3 |
=====================================output=====================================
"aaa";
'bbb';
@@ -192,7 +192,7 @@ rangeStart: 16
=====================================input======================================
> 1 | function ugly ( {a=1, b = 2 } ) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 2 |
+ 2 |
=====================================output=====================================
function ugly({ a = 1, b = 2 }) {}
@@ -216,7 +216,7 @@ rangeStart: 222
6 | }
7 | }
8 | }
- 9 |
+ 9 |
=====================================output=====================================
function ugly ( {a=1, b = 2 } ) {
function ugly ( {a=1, b = 2 } ) {
@@ -243,12 +243,12 @@ rangeStart: 17
| ^^^^^^^^^^^^^^
3 | return 1;
4 | }
- 5 |
+ 5 |
6 | dontTouchThis(){
7 | return 2 ;
8 | }
9 | }
- 10 |
+ 10 |
=====================================output=====================================
export class F {
reformatThis() {
@@ -276,12 +276,12 @@ rangeStart: 17
| ^
3 | return 1;
4 | }
- 5 |
+ 5 |
6 | dontTouchThis(){
7 | return 2 ;
8 | }
9 | }
- 10 |
+ 10 |
=====================================output=====================================
export class F {
reformatThis() {
@@ -309,7 +309,7 @@ rangeStart: 16
> 2 | /**/
| ^^^^
3 | }
- 4 |
+ 4 |
=====================================output=====================================
export default class Foo {
/**/
@@ -330,7 +330,7 @@ rangeStart: 16
| ^^^^^^^^^^^^^^
2 | /**/
3 | }
- 4 |
+ 4 |
=====================================output=====================================
export default function Foo() {
/**/
@@ -353,7 +353,7 @@ rangeStart: 16
| ^^^^
> 3 | }
| ^
- 4 |
+ 4 |
=====================================output=====================================
/* */ function Foo() {
/**/
@@ -375,7 +375,7 @@ rangeStart: 17
| ^^^^
> 3 | }
| ^
- 4 |
+ 4 |
=====================================output=====================================
/* */ class Foo {
/**/
@@ -397,7 +397,7 @@ rangeStart: 29
> 2 | color: blue;
| ^^^^^
3 | \`;
- 4 |
+ 4 |
=====================================output=====================================
export const Button = styled.button\`
color: blue;
@@ -425,7 +425,7 @@ rangeStart: 80
| ^^^^^^^^^^^^^^^^^^^
7 | };
8 | }
- 9 |
+ 9 |
=====================================output=====================================
function ugly() {
const dictWithSeveralEntries = {
@@ -448,16 +448,16 @@ rangeStart: 45
| | printWidth
=====================================input======================================
1 | import def , {named} from 'x'
- 2 |
+ 2 |
> 3 | export * from 'd'
| ^^^^^^^^^^^
- 4 |
+ 4 |
5 | export const x
6 | = 42
- 7 |
+ 7 |
8 | export default 42
- 9 |
- 10 |
+ 9 |
+ 10 |
=====================================output=====================================
import def , {named} from 'x'
@@ -481,18 +481,18 @@ rangeStart: 57
| | printWidth
=====================================input======================================
1 | import def , {named} from 'x'
- 2 |
+ 2 |
3 | export * from 'd'
-> 4 |
+> 4 |
| ^
> 5 | export const x
| ^^^^^^^^^^^^^^^^^^
> 6 | = 42
| ^^
- 7 |
+ 7 |
8 | export default 42
- 9 |
- 10 |
+ 9 |
+ 10 |
=====================================output=====================================
import def , {named} from 'x'
@@ -515,16 +515,16 @@ rangeStart: 104
| | printWidth
=====================================input======================================
1 | import def , {named} from 'x'
- 2 |
+ 2 |
3 | export * from 'd'
- 4 |
+ 4 |
5 | export const x
6 | = 42
- 7 |
+ 7 |
> 8 | export default 42
| ^^^^
- 9 |
- 10 |
+ 9 |
+ 10 |
=====================================output=====================================
import def , {named} from 'x'
@@ -549,15 +549,15 @@ rangeStart: 7
=====================================input======================================
> 1 | import def , {named} from 'x'
| ^^^^^^^^^^^^^^^
- 2 |
+ 2 |
3 | export * from 'd'
- 4 |
+ 4 |
5 | export const x
6 | = 42
- 7 |
+ 7 |
8 | export default 42
- 9 |
- 10 |
+ 9 |
+ 10 |
=====================================output=====================================
import def, { named } from "x";
@@ -583,24 +583,24 @@ rangeStart: 30
1 | call(
2 | 1, 2,3
3 | );
- 4 |
+ 4 |
5 | call(
> 6 | 1, 2,3
| ^^^
> 7 | );
| ^^
-> 8 |
+> 8 |
| ^^
> 9 | call(
| ^^
> 10 | 1, 2,3
| ^^^^^
11 | );
- 12 |
+ 12 |
13 | call(
14 | 1, 2,3
15 | );
- 16 |
+ 16 |
=====================================output=====================================
call(
1, 2,3
@@ -628,7 +628,7 @@ rangeStart: 18
1 | call(
2 | 1, 2,3
3 | );
-> 4 |
+> 4 |
| ^
> 5 | call(
| ^^^^^
@@ -636,7 +636,7 @@ rangeStart: 18
| ^^^^^
> 7 | );
| ^^^^^
-> 8 |
+> 8 |
| ^^^^^
> 9 | call(
| ^^^^^
@@ -644,12 +644,12 @@ rangeStart: 18
| ^^^^^
> 11 | );
| ^^^^^
-> 12 |
+> 12 |
| ^
13 | call(
14 | 1, 2,3
15 | );
- 16 |
+ 16 |
=====================================output=====================================
call(
1, 2,3
@@ -684,7 +684,7 @@ rangeStart: 0
| ^^^
5 | }
6 | catch (err) {}
- 7 |
+ 7 |
=====================================output=====================================
try {
if (condition) {
@@ -711,7 +711,7 @@ rangeStart: 28
> 4 | }
| ^^
5 | }
- 6 |
+ 6 |
=====================================output=====================================
function f() {
if (true) {
@@ -739,7 +739,7 @@ rangeStart: 9
| ^^^
5 | }
6 | catch (err) {}
- 7 |
+ 7 |
=====================================output=====================================
try {
if (condition) {
@@ -768,7 +768,7 @@ rangeStart: 9
| ^^^
5 | }
6 | catch (err) {}
- 7 |
+ 7 |
=====================================output=====================================
try {
1;if (condition) {
@@ -790,7 +790,7 @@ rangeStart: 11
=====================================input======================================
> 1 | const y = {a:1, b:2}
| ^^^
- 2 |
+ 2 |
=====================================output=====================================
const y = { a: 1, b: 2 };
@@ -805,7 +805,7 @@ rangeEnd: 104
rangeStart: 53
| | printWidth
=====================================input======================================
- 1 |
+ 1 |
2 | const y = [
3 | {
4 | a: 1,
@@ -820,7 +820,7 @@ rangeStart: 53
> 9 | },
| ^^^^^^
10 | ]
- 11 |
+ 11 |
=====================================output=====================================
const y = [
@@ -853,7 +853,7 @@ rangeStart: 224
6 | }
7 | }
8 | }
- 9 |
+ 9 |
=====================================output=====================================
function ugly ( {a=1, b = 2 } ) {
function ugly ( {a=1, b = 2 } ) {
@@ -879,8 +879,8 @@ rangeStart: 32
2 | call(
3 | 1, 2,3
4 | );
- 5 |
-> 6 |
+ 5 |
+> 6 |
| ^
> 7 | call(
| ^^^^^
@@ -913,14 +913,14 @@ rangeStart: 0
| ^^^^^^^^
> 3 | );
| ^^^^^^^^
-> 4 |
+> 4 |
| ^
- 5 |
+ 5 |
6 | // Unchanged
7 | call(
8 | 1, 2,3
9 | );
- 10 |
+ 10 |
=====================================output=====================================
call(1, 2, 3);
@@ -944,7 +944,7 @@ rangeStart: 26
> 1 | foo = 1.0000;bar = 1.0000;baz=1.0000;
| ^^^^^^^^^^^^^ [Reversed range]
2 | // The range will be 26~13, should not format anything
- 3 |
+ 3 |
=====================================output=====================================
foo = 1.0000;bar = 1.0000;baz=1.0000;
// The range will be 26~13, should not format anything
@@ -963,7 +963,7 @@ rangeStart: 13
> 1 | foo = 1.0000;bar = 1.0000;baz=1.0000;
| ^
2 | // The range will be 13~13, should not format anything
- 3 |
+ 3 |
=====================================output=====================================
foo = 1.0000;bar = 1.0000;baz=1.0000;
// The range will be 13~13, should not format anything
@@ -982,7 +982,7 @@ rangeStart: 7
1 | try {}
> 2 | catch (err) {}
| ^
- 3 |
+ 3 |
=====================================output=====================================
try {
} catch (err) {}
@@ -1000,7 +1000,7 @@ rangeStart: 0
=====================================input======================================
> 1 |
| ^
- 2 |
+ 2 |
=====================================output=====================================
diff --git a/tests/js/record/__snapshots__/jsfmt.spec.js.snap b/tests/js/record/__snapshots__/jsfmt.spec.js.snap
index 71e89b736..76ae79cde 100644
--- a/tests/js/record/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/record/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`computed.js [espree] format 1`] = `
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
- 4 |
+ 4 |
5 | assert(#{ [true]: 1 } === #{ true: 1 })"
`;
@@ -16,7 +16,7 @@ exports[`computed.js [meriyah] format 1`] = `
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
- 4 |
+ 4 |
5 | assert(#{ [true]: 1 } === #{ true: 1 })"
`;
@@ -56,7 +56,7 @@ exports[`destructuring.js [espree] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 | "
+ 4 |"
`;
exports[`destructuring.js [meriyah] format 1`] = `
@@ -65,7 +65,7 @@ exports[`destructuring.js [meriyah] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 | "
+ 4 |"
`;
exports[`destructuring.js format 1`] = `
@@ -101,7 +101,7 @@ assert(rest.c === 3);
exports[`invalid-record-method.js [espree] format 1`] = `
"Unexpected character '#' (3:1)
1 | // Invalid, https://github.com/babel/babel/pull/11652/
- 2 |
+ 2 |
> 3 | #{
| ^
4 | a() {},
@@ -112,7 +112,7 @@ exports[`invalid-record-method.js [espree] format 1`] = `
exports[`invalid-record-method.js [meriyah] format 1`] = `
"[3:1]: '#' not followed by identifier (3:1)
1 | // Invalid, https://github.com/babel/babel/pull/11652/
- 2 |
+ 2 |
> 3 | #{
| ^
4 | a() {},
@@ -218,7 +218,7 @@ exports[`shorthand.js [espree] format 1`] = `
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
- 4 | "
+ 4 |"
`;
exports[`shorthand.js [meriyah] format 1`] = `
@@ -227,7 +227,7 @@ exports[`shorthand.js [meriyah] format 1`] = `
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
- 4 | "
+ 4 |"
`;
exports[`shorthand.js format 1`] = `
@@ -254,7 +254,7 @@ exports[`spread.js [espree] format 1`] = `
| ^
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" }
- 4 | "
+ 4 |"
`;
exports[`spread.js [meriyah] format 1`] = `
@@ -263,7 +263,7 @@ exports[`spread.js [meriyah] format 1`] = `
| ^
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" }
- 4 | "
+ 4 |"
`;
exports[`spread.js format 1`] = `
@@ -296,7 +296,7 @@ exports[`syntax.js [espree] format 1`] = `
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
- 4 | "
+ 4 |"
`;
exports[`syntax.js [meriyah] format 1`] = `
@@ -305,7 +305,7 @@ exports[`syntax.js [meriyah] format 1`] = `
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
- 4 | "
+ 4 |"
`;
exports[`syntax.js format 1`] = `
diff --git a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
index 4d2513a7d..755a9af74 100644
--- a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,7 @@ exports[`throw_expression.js [espree] format 1`] = `
"Unexpected token throw (1:26)
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
| ^
- 2 |
+ 2 |
3 | lint(ast, {
4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")"
`;
@@ -13,7 +13,7 @@ exports[`throw_expression.js [meriyah] format 1`] = `
"[1:30]: Unexpected token: 'throw' (1:30)
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
| ^
- 2 |
+ 2 |
3 | lint(ast, {
4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")"
`;
diff --git a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap
index 937de6b84..1ab9ae795 100644
--- a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`example.js [espree] format 1`] = `
"Cannot use keyword 'await' outside an async function (1:1)
> 1 | await something();
| ^
- 2 | "
+ 2 |"
`;
exports[`example.js [meriyah] format 1`] = `
"[1:5]: 'Await' may not be used as an identifier in this context (1:5)
> 1 | await something();
| ^
- 2 | "
+ 2 |"
`;
exports[`example.js format 1`] = `
diff --git a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap
index f4f990be5..4f337ad8f 100644
--- a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,7 @@ exports[`trailing.js [espree] format 1`] = `
"Unexpected token type (1:8)
> 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
| ^
- 2 |
+ 2 |
3 | // Note: there are trailing whitespace in this file
4 | \`"
`;
@@ -13,7 +13,7 @@ exports[`trailing.js [meriyah] format 1`] = `
"[1:11]: Unexpected token: 'identifier' (1:11)
> 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
| ^
- 2 |
+ 2 |
3 | // Note: there are trailing whitespace in this file
4 | \`"
`;
diff --git a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap
index 0f922022f..8edda8574 100644
--- a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`destructuring.js [espree] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 | "
+ 4 |"
`;
exports[`destructuring.js [meriyah] format 1`] = `
@@ -15,7 +15,7 @@ exports[`destructuring.js [meriyah] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 | "
+ 4 |"
`;
exports[`destructuring.js format 1`] = `
@@ -52,21 +52,21 @@ exports[`invalid-tuple-holes.js [babel] format 1`] = `
"Unexpected token ',' (1:4)
> 1 | #[,]
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-tuple-holes.js [espree] format 1`] = `
"Unexpected character '#' (1:1)
> 1 | #[,]
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-tuple-holes.js [meriyah] format 1`] = `
"[1:1]: '#' not followed by identifier (1:1)
> 1 | #[,]
| ^
- 2 | "
+ 2 |"
`;
exports[`syntax.js [espree] format 1`] = `
@@ -75,7 +75,7 @@ exports[`syntax.js [espree] format 1`] = `
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
- 4 | "
+ 4 |"
`;
exports[`syntax.js [meriyah] format 1`] = `
@@ -84,7 +84,7 @@ exports[`syntax.js [meriyah] format 1`] = `
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
- 4 | "
+ 4 |"
`;
exports[`syntax.js format 1`] = `
@@ -109,18 +109,18 @@ exports[`tuple.js [espree] format 1`] = `
"Unexpected character '#' (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 |
+ 2 |
3 | assert(tuple1[0] === 1);
- 4 | "
+ 4 |"
`;
exports[`tuple.js [meriyah] format 1`] = `
"[1:16]: '#' not followed by identifier (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 |
+ 2 |
3 | assert(tuple1[0] === 1);
- 4 | "
+ 4 |"
`;
exports[`tuple.js format 1`] = `
@@ -173,14 +173,14 @@ exports[`tuple-trailing-comma.js [espree] format 1`] = `
"Unexpected character '#' (1:1)
> 1 | #[1,]
| ^
- 2 | "
+ 2 |"
`;
exports[`tuple-trailing-comma.js [meriyah] format 1`] = `
"[1:1]: '#' not followed by identifier (1:1)
> 1 | #[1,]
| ^
- 2 | "
+ 2 |"
`;
exports[`tuple-trailing-comma.js format 1`] = `
diff --git a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap
index 12ff04f0f..cdac36197 100644
--- a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,21 @@ exports[`invalid-const.js [espree] format 1`] = `
"Unexpected token ; (1:10)
> 1 | const foo;
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-const.js [flow] format 1`] = `
"Const must be initialized (1:7)
> 1 | const foo;
| ^^^
- 2 | "
+ 2 |"
`;
exports[`invalid-const.js [meriyah] format 1`] = `
"[1:10]: Missing initializer in const declaration (1:10)
> 1 | const foo;
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-const.js format 1`] = `
diff --git a/tests/json/range/__snapshots__/jsfmt.spec.js.snap b/tests/json/range/__snapshots__/jsfmt.spec.js.snap
index 53f26719a..dcdef5f99 100644
--- a/tests/json/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/json/range/__snapshots__/jsfmt.spec.js.snap
@@ -10,7 +10,7 @@ rangeStart: 1
=====================================input======================================
> 1 | {"a":1, "b":2}
| ^^^
- 2 |
+ 2 |
=====================================output=====================================
{"a":1, "b":2}
@@ -27,7 +27,7 @@ rangeStart: 5
=====================================input======================================
> 1 | {"a":1, "b":2}
| ^
- 2 |
+ 2 |
=====================================output=====================================
{"a":1, "b":2}
diff --git a/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap
index dbf1f0a6c..770a98581 100644
--- a/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap
@@ -3,17 +3,17 @@
exports[`async-arrow-invalid.js [babel] format 1`] = `
"Type parameters must come after the async keyword, e.g. instead of \` async (3:1)
1 | // https://github.com/babel/babel/pull/11979
- 2 |
+ 2 |
> 3 | async () => {}
| ^
- 4 | "
+ 4 |"
`;
exports[`async-arrow-invalid.js [babel-flow] format 1`] = `
"Type parameters must come after the async keyword, e.g. instead of \` async (3:1)
1 | // https://github.com/babel/babel/pull/11979
- 2 |
+ 2 |
> 3 | async () => {}
| ^
- 4 | "
+ 4 |"
`;
diff --git a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
index f700fa83d..1c74c1a0d 100644
--- a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,14 @@ exports[`type-annotation-expr-statement.ts [babel-ts] format 1`] = `
"Did not expect a type annotation here. (1:3)
> 1 | (a: T);
| ^
- 2 | "
+ 2 |"
`;
exports[`type-annotation-func.ts [babel-ts] format 1`] = `
"Did not expect a type annotation here. (1:10)
> 1 | func(a: T);
| ^
- 2 | "
+ 2 |"
`;
exports[`type-annotation-in-jsx.tsx [babel-ts] format 1`] = `
@@ -22,5 +22,5 @@ exports[`type-annotation-in-jsx.tsx [babel-ts] format 1`] = `
| ^
4 | );
5 | }
- 6 | "
+ 6 |"
`;
diff --git a/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap
index dc8b03d92..c781f4850 100644
--- a/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap
@@ -2,9 +2,9 @@
exports[`async-arrow-invalid.js [flow] format 1`] = `
"Unexpected token ILLEGAL (4:1)
- 2 |
+ 2 |
3 | async () => {}
-> 4 |
+> 4 |
| ^"
`;
@@ -12,14 +12,14 @@ exports[`default-escaped.js [flow] format 1`] = `
"Unexpected identifier, expected the token \`{\` (1:8)
> 1 | export asyn\\\\u{63} from \\"async\\";
| ^^^^^^^^^^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.js [flow] format 1`] = `
"Unexpected token \`,\`, expected the token \`)\` (1:24)
> 1 | import('./prettier.mjs', {})
| ^
- 2 | "
+ 2 |"
`;
exports[`function-async.js [flow] format 1`] = `
@@ -33,14 +33,14 @@ exports[`module-attributes-dynamic.js [flow] format 1`] = `
"Unexpected token \`,\`, expected the token \`)\` (1:18)
> 1 | import(\\"foo.json\\", { with: { type: \\"json\\" } })
| ^
- 2 | "
+ 2 |"
`;
exports[`module-attributes-static.js [flow] format 1`] = `
"Unexpected token \`with\`, expected the token \`;\` (1:28)
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
| ^^^^
- 2 | "
+ 2 |"
`;
exports[`newline-before-arrow.js [flow] format 1`] = `
@@ -48,14 +48,14 @@ exports[`newline-before-arrow.js [flow] format 1`] = `
1 | async x
> 2 | => x
| ^^
- 3 | "
+ 3 |"
`;
exports[`number.js [flow] format 1`] = `
"Unexpected token ILLEGAL (3:5)
1 | // https://github.com/babel/babel/pull/11854
- 2 |
+ 2 |
> 3 | a = 09e1_1;
| ^^^^
- 4 | "
+ 4 |"
`;
diff --git a/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap
index 0db971b0a..0e7fd398c 100644
--- a/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap
@@ -3,10 +3,10 @@
exports[`type-interfaces.graphql [graphql] format 1`] = `
"Syntax Error: Unexpected \\"|\\". (5:21)
3 | # which will break seperator detection added in #7305
- 4 |
+ 4 |
> 5 | type A implements A | B {
| ^
6 | a: a
7 | }
- 8 | "
+ 8 |"
`;
diff --git a/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap
index 5327f3acb..7d7866680 100644
--- a/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,7 @@ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SE
1 |
> 2 | x, {{@name}
| ^
- 3 | "
+ 3 |"
`;
exports[`invalid-2.hbs [glimmer] format 1`] = `
@@ -20,10 +20,10 @@ exports[`invalid-2.hbs [glimmer] format 1`] = `
(error occurred in 'an unknown module' @ line 3 : column 0) (3:0)
1 |
- 2 |
+ 2 |
> 3 | <{@name>
| ^^^^^^^^
- 4 | "
+ 4 |"
`;
exports[`invalid-3.hbs [glimmer] format 1`] = `
@@ -32,10 +32,10 @@ exports[`invalid-3.hbs [glimmer] format 1`] = `
-----^
Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (3:3)
1 |
- 2 |
+ 2 |
> 3 | {{}}
| ^
- 4 | "
+ 4 |"
`;
exports[`tilde-comments-1.hbs [glimmer] format 1`] = `
@@ -45,7 +45,7 @@ exports[`tilde-comments-1.hbs [glimmer] format 1`] = `
Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4)
> 1 | {{~}}
| ^
- 2 | "
+ 2 |"
`;
exports[`tilde-comments-2.hbs [glimmer] format 1`] = `
@@ -55,5 +55,5 @@ exports[`tilde-comments-2.hbs [glimmer] format 1`] = `
Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4)
> 1 | {{~~}}
| ^
- 2 | "
+ 2 |"
`;
diff --git a/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap
index 7a3f227b9..bc249a442 100644
--- a/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap
@@ -2,27 +2,27 @@
exports[`decorator.ts [babel-ts] format 1`] = `
"Leading decorators must be attached to a class declaration (4:1)
- 2 |
+ 2 |
3 | @dec
> 4 | enum E {}
| ^
- 5 | "
+ 5 |"
`;
exports[`decorator.ts [typescript] format 1`] = `
"Leading decorators must be attached to a class declaration (3:1)
1 | declare function dec(target: T): T;
- 2 |
+ 2 |
> 3 | @dec
| ^^^^
> 4 | enum E {}
| ^^^^^^^^^^
- 5 | "
+ 5 |"
`;
exports[`enums.ts [babel-ts] format 1`] = `
"Leading decorators must be attached to a class declaration (4:1)
- 2 |
+ 2 |
3 | @decorator()
> 4 | enum Direction {
| ^
@@ -34,7 +34,7 @@ exports[`enums.ts [babel-ts] format 1`] = `
exports[`enums.ts [typescript] format 1`] = `
"Leading decorators must be attached to a class declaration (3:1)
1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375
- 2 |
+ 2 |
> 3 | @decorator()
| ^^^^^^^^^^^^
> 4 | enum Direction {
@@ -49,50 +49,50 @@ exports[`enums.ts [typescript] format 1`] = `
| ^^^^^^^^^^^^^^^^
> 9 | }
| ^^
- 10 | "
+ 10 |"
`;
exports[`function.ts [babel-ts] format 1`] = `
"Leading decorators must be attached to a class declaration (4:1)
- 2 |
+ 2 |
3 | @decorator()
> 4 | function foo( ){}
| ^
- 5 | "
+ 5 |"
`;
exports[`function.ts [typescript] format 1`] = `
"Leading decorators must be attached to a class declaration (3:1)
1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375
- 2 |
+ 2 |
> 3 | @decorator()
| ^^^^^^^^^^^^
> 4 | function foo( ){}
| ^^^^^^^^^^^^^^^^^^^^^^^
- 5 | "
+ 5 |"
`;
exports[`interface.ts [babel-ts] format 1`] = `
"Leading decorators must be attached to a class declaration (5:1)
- 3 |
+ 3 |
4 | @hello()
> 5 | interface MyInterface {id: string;
| ^
6 | }
- 7 | "
+ 7 |"
`;
exports[`interface.ts [typescript] format 1`] = `
"Leading decorators must be attached to a class declaration (4:1)
2 | // #4632
- 3 |
+ 3 |
> 4 | @hello()
| ^^^^^^^^
> 5 | interface MyInterface {id: string;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 6 | }
| ^^
- 7 | "
+ 7 |"
`;
exports[`issue-9102.ts [babel-ts] format 1`] = `
@@ -101,7 +101,7 @@ exports[`issue-9102.ts [babel-ts] format 1`] = `
> 2 | type T = 1;
| ^
3 | class C {}
- 4 | "
+ 4 |"
`;
exports[`issue-9102.ts [typescript] format 1`] = `
@@ -111,5 +111,5 @@ exports[`issue-9102.ts [typescript] format 1`] = `
> 2 | type T = 1;
| ^^^^^^^^^^^^
3 | class C {}
- 4 | "
+ 4 |"
`;
diff --git a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
index 783e27cbf..55a3db305 100644
--- a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
@@ -8,42 +8,42 @@ exports[`html-like-comments.js [babel] format 1`] = `
| ^
4 | 'hello world'
5 | )
- 6 | "
+ 6 |"
`;
exports[`import-assertions-for-export-without-from.js [babel] format 1`] = `
"Unexpected token, expected \\";\\" (1:16)
> 1 | export { foo } assert { type: \\"json\\" };
| ^
- 2 | "
+ 2 |"
`;
exports[`import-assertions-with-parens.js [babel] format 1`] = `
"Unexpected token (1:19)
> 1 | import \\"x\\" assert ({type: 'json'});
| ^
- 2 | "
+ 2 |"
`;
exports[`module-attributes.js [babel] format 1`] = `
"Unexpected token, expected \\";\\" (1:28)
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
| ^
- 2 | "
+ 2 |"
`;
exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = `
"Unexpected token, expected \\")\\" (3:18)
1 | // https://github.com/babel/babel/pull/11931
- 2 |
+ 2 |
> 3 | for (() => x in y;;);
| ^
- 4 | "
+ 4 |"
`;
exports[`partial-template-strings.js [babel] format 1`] = `
"Unexpected token (6:42)
- 4 |
+ 4 |
5 | const Diagnostics = {
> 6 | unexpected_token: \`Unexpected token: \${?}\`,
| ^
@@ -90,7 +90,7 @@ exports[`snippet: #5 [babel] format 1`] = `
exports[`snippet: #6 [babel] format 1`] = `
"Unexpected token (5:12)
- 3 |
+ 3 |
4 | static isC(obj) {
> 5 | return try obj.#brand;
| ^
@@ -137,8 +137,8 @@ exports[`snippet: #12 [babel] format 1`] = `
exports[`static-import-source-should-not-has-extra-token.js [babel] format 1`] = `
"Unexpected token (4:16)
2 | // be parenthesized, that accidentally break #8016
- 3 |
+ 3 |
> 4 | import {} from (('a'));
| ^
- 5 | "
+ 5 |"
`;
diff --git a/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap
index 1d010b2d6..20833d225 100644
--- a/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap
@@ -17,7 +17,7 @@ exports[`open-double-quote.less [less] format 1`] = `
> 2 | background: url(\\"
| ^
3 | }
- 4 | "
+ 4 |"
`;
exports[`open-sigle-quote.less [less] format 1`] = `
@@ -26,5 +26,5 @@ exports[`open-sigle-quote.less [less] format 1`] = `
> 2 | background: url('
| ^
3 | }
- 4 | "
+ 4 |"
`;
diff --git a/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
index a5ea5bf94..8c9016456 100644
--- a/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
@@ -4,23 +4,23 @@ exports[`default-escaped.ts [typescript] format 1`] = `
"Declaration or statement expected. (1:1)
> 1 | export asyn\\\\u{63} from \\"async\\";
| ^
- 2 | "
+ 2 |"
`;
exports[`dynamic-import.ts [typescript] format 1`] = `
"Dynamic import must have one specifier as an argument. (1:8)
> 1 | import('./prettier.mjs', {})
| ^
- 2 | "
+ 2 |"
`;
exports[`invalid-jsx-1.ts [typescript] format 1`] = `
"Unexpected token. Did you mean \`{'>'}\` or \`>\`? (3:45)
1 | // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-and--are-now-invalid-jsx-text-characters
- 2 |
+ 2 |
> 3 | let directions = Navigate to: Menu Bar > Tools > Options
| ^
- 4 | "
+ 4 |"
`;
exports[`issue-8773.ts [typescript] format 1`] = `"Comment \\"comment\\" was not printed. Please report this error!"`;
@@ -29,14 +29,14 @@ exports[`module-attributes-dynamic.ts [typescript] format 1`] = `
"Dynamic import must have one specifier as an argument. (1:8)
> 1 | import(\\"foo.json\\", { with: { type: \\"json\\" } })
| ^
- 2 | "
+ 2 |"
`;
exports[`module-attributes-static.ts [typescript] format 1`] = `
"';' expected. (1:28)
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
| ^
- 2 | "
+ 2 |"
`;
exports[`newline-before-arrow.ts [typescript] format 1`] = `
@@ -44,7 +44,7 @@ exports[`newline-before-arrow.ts [typescript] format 1`] = `
> 1 | async x
| ^
2 | => x
- 3 | "
+ 3 |"
`;
exports[`snippet: #0 [typescript] format 1`] = `
diff --git a/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap
index b78064eac..6c157b5db 100644
--- a/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap
@@ -3,7 +3,7 @@
exports[`unclosed_tag.vue [vue] format 1`] = `
"Unexpected character \\"EOF\\" (2:1)
1 | 2 |
+> 2 |
| ^"
`;
@@ -13,7 +13,7 @@ exports[`unclosed_tag_in_template.vue [vue] format 1`] = `
3 |
> 4 |
| ^
- 5 | "
+ 5 |"
`;
exports[`upper-case.html [vue] format 1`] = `
diff --git a/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap
index f33b25c05..12fcb7cae 100644
--- a/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap
@@ -12,6 +12,6 @@ exports[`block-scalar-with-spaces-only.yml [yaml] format 1`] = `
| ^
> 5 | # comment
| ^
-> 6 |
+> 6 |
| ^"
`;
diff --git a/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap b/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap
index db7833334..abc995656 100644
--- a/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap
@@ -88,7 +88,7 @@ requirePragma: true
3 | */
> 4 | var test = true
| ^^^^^^^^^^^^^^^
- 5 |
+ 5 |
=====================================output=====================================
/**
* @prettier
@@ -109,7 +109,7 @@ requirePragma: true
=====================================input======================================
> 1 | var test = true
| ^^^^^^^^^^^^^^^
- 2 |
+ 2 |
=====================================output=====================================
var test = true
diff --git a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap
index 4b4f2a713..8179d2653 100644
--- a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`constructor.ts [babel-ts] format 1`] = `
> 2 | constructor(static a: number) {}
| ^
3 | }
- 4 |
+ 4 |
5 | class foo {"
`;
@@ -263,7 +263,7 @@ exports[`generics.ts [babel-ts] format 1`] = `
"A class name is required (1:6)
> 1 | class
implements Map {}
| ^
- 2 |
+ 2 |
3 | interface AudioBufferList {
4 | mBuffers: interop.Reference ;"
`;
@@ -292,12 +292,12 @@ interface AudioBufferList {
exports[`methods.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\";\\" (6:10)
- 4 |
+ 4 |
5 | interface Iterable {
> 6 | export [Symbol.iterator](): Iterator;
| ^
7 | }
- 8 |
+ 8 |
9 | export class Check {"
`;
diff --git a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap
index 21aa5587e..12029569c 100644
--- a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap
@@ -433,7 +433,7 @@ exports[`errorOnInitializerInInterfaceProperty.ts [babel-ts] format 1`] = `
> 2 | bar: number = 5;
| ^
3 | }
- 4 | "
+ 4 |"
`;
exports[`errorOnInitializerInInterfaceProperty.ts format 1`] = `
diff --git a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
index 055cf0afb..823cf5106 100644
--- a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
@@ -442,12 +442,12 @@ class E extends D {
exports[`readonlyInConstructorParameters.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\",\\" (7:33)
- 5 |
+ 5 |
6 | class E {
> 7 | constructor(readonly public x: number) {}
| ^
8 | }
- 9 |
+ 9 |
10 | class F {"
`;
diff --git a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap
index c6c038802..87fd2d2c9 100644
--- a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,7 @@ exports[`parserES5ForOfStatement2.ts [babel-ts] format 1`] = `
> 2 | for (var of X) {
| ^
3 | }
- 4 | "
+ 4 |"
`;
exports[`parserES5ForOfStatement2.ts format 1`] = `
@@ -32,7 +32,7 @@ exports[`parserES5ForOfStatement21.ts [babel-ts] format 1`] = `
1 | //@target: ES5
> 2 | for (var of of) { }
| ^
- 3 | "
+ 3 |"
`;
exports[`parserES5ForOfStatement21.ts format 1`] = `
@@ -57,7 +57,7 @@ exports[`parserForInStatement2.ts [babel-ts] format 1`] = `
> 1 | for (var in X) {
| ^
2 | }
- 3 | "
+ 3 |"
`;
exports[`parserForInStatement2.ts format 1`] = `
diff --git a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap
index 1d1ce60da..1d1d6d225 100644
--- a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,7 @@ exports[`abstractKeyword.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\";\\" (1:10)
> 1 | abstract interface I {}
| ^
- 2 | "
+ 2 |"
`;
exports[`abstractKeyword.ts format 1`] = `
diff --git a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap
index 098a018bd..71b7e0264 100644
--- a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap
@@ -594,12 +594,12 @@ function f(x: string): void {
exports[`functionOverloadErrorsSyntax.ts [babel-ts] format 1`] = `
"Rest element must be last element (9:36)
- 7 |
+ 7 |
8 | //Function overload signature with rest param followed by non-optional parameter
> 9 | function fn5(x: string, ...y: any[], z: string);
| ^
10 | function fn5() { }
- 11 | "
+ 11 |"
`;
exports[`functionOverloadErrorsSyntax.ts format 1`] = `
diff --git a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap
index b8f660e7a..a7946d8cb 100644
--- a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap
@@ -45,7 +45,7 @@ exports[`abstractProperties.ts [babel-ts] format 1`] = `
| ^
3 | private abstract b: 2;
4 | static abstract c: 3;
- 5 | "
+ 5 |"
`;
exports[`abstractProperties.ts format 1`] = `
diff --git a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap
index 48ea1c51c..5ff496cbd 100644
--- a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap
@@ -154,7 +154,7 @@ class f7<> {
exports[`index-signature.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\"]\\" (4:13)
- 2 |
+ 2 |
3 | type TwoParams = {
> 4 | [a: string, b: string]: string;
| ^
@@ -165,7 +165,7 @@ exports[`index-signature.ts [babel-ts] format 1`] = `
exports[`index-signature.ts - {"trailingComma":"all"} [babel-ts] format 1`] = `
"Unexpected token, expected \\"]\\" (4:13)
- 2 |
+ 2 |
3 | type TwoParams = {
> 4 | [a: string, b: string]: string;
| ^
@@ -239,7 +239,7 @@ type TooLongSingleParam = {
exports[`index-signature.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = `
"Unexpected token, expected \\"]\\" (4:13)
- 2 |
+ 2 |
3 | type TwoParams = {
> 4 | [a: string, b: string]: string;
| ^
diff --git a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap
index da391f150..ec8b9168f 100644
--- a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap
@@ -4,18 +4,18 @@ exports[`abstract.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\";\\" (1:10)
> 1 | abstract interface I {
| ^
- 2 |
+ 2 |
3 | }
- 4 | "
+ 4 |"
`;
exports[`abstract.ts - {"semi":false} [babel-ts] format 1`] = `
"Unexpected token, expected \\";\\" (1:10)
> 1 | abstract interface I {
| ^
- 2 |
+ 2 |
3 | }
- 4 | "
+ 4 |"
`;
exports[`abstract.ts - {"semi":false} format 1`] = `
diff --git a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap
index caf12a3c3..da283768a 100644
--- a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap
@@ -2,13 +2,13 @@
exports[`keywords.ts [babel-ts] format 1`] = `
"Unexpected token, expected \\";\\" (4:12)
- 2 |
+ 2 |
3 | module Y3 {
> 4 | public module Module {
| ^
5 | class A { s: string }
6 | }
- 7 | "
+ 7 |"
`;
exports[`keywords.ts format 1`] = `
diff --git a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap
index e3f995949..25aab4f2d 100644
--- a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap
@@ -12,7 +12,7 @@ rangeStart: 15
> 2 | export = f;
| ^^^
3 | g( )
- 4 |
+ 4 |
=====================================output=====================================
f ( );
export = f;
@@ -45,7 +45,7 @@ rangeStart: 102
> 9 | }
| ^^^^^
10 | }
- 11 |
+ 11 |
=====================================output=====================================
class Foo {
/** Does this key match a given MinimalKey extending object? */
@@ -73,7 +73,7 @@ rangeStart: 29
> 2 | private obj = { isTest: true }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | }
- 4 |
+ 4 |
=====================================output=====================================
export default class Test {
private obj = { isTest: true };
diff --git a/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap
index 7a227a5e0..642315afd 100644
--- a/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap
@@ -75,21 +75,21 @@ exports[`template-literal-types.ts [babel] format 1`] = `
"Unexpected token (1:84)
> 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a;
| ^
- 2 | "
+ 2 |"
`;
exports[`template-literal-types.ts [babel-flow] format 1`] = `
"Unexpected token (1:84)
> 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a;
| ^
- 2 | "
+ 2 |"
`;
exports[`template-literal-types.ts [flow] format 1`] = `
"Unexpected token \`\`\` (1:84)
> 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a;
| ^
- 2 | "
+ 2 |"
`;
exports[`template-literal-types.ts format 1`] = `
diff --git a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap
index 756e01e7b..1606454d4 100644
--- a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap
@@ -12,18 +12,18 @@ rangeStart: 73
2 | Templates are formatted as well...
3 |
4 |
- 5 |
+ 5 |
> 6 |
| ^^^^^^^^^
- 9 |
+ 9 |
10 |
- 13 |
+ 13 |
=====================================output=====================================
Templates are formatted as well...
diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js
index 8bb577930..24b9bd52f 100644
--- a/tests_config/run_spec.js
+++ b/tests_config/run_spec.js
@@ -280,7 +280,7 @@ function runTest({
rangeStart: rangeStartWithCursor,
rangeEnd: rangeEndWithCursor,
});
- codeOffset = codeForSnapshot.match(/^>?\s+1 \| /)[0].length;
+ codeOffset = codeForSnapshot.match(/^>?\s+1 \|/)[0].length + 1;
}
if (hasEndOfLine) {
diff --git a/tests_integration/__tests__/__snapshots__/format.js.snap b/tests_integration/__tests__/__snapshots__/format.js.snap
index 91d17660b..b4365a670 100644
--- a/tests_integration/__tests__/__snapshots__/format.js.snap
+++ b/tests_integration/__tests__/__snapshots__/format.js.snap
@@ -14,7 +14,7 @@ exports[`markdown parser should handle CRLF correctly 1`] = `"\\"\`\`\`\\\\r\\\\
exports[`typescript parser should throw the first error when both JSX and non-JSX mode failed 1`] = `
"Expression expected. (9:7)
7 | );
- 8 |
+ 8 |
> 9 | label:
| ^
10 | "
diff --git a/yarn.lock b/yarn.lock
index 31f3462ce..45143e227 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -16,14 +16,7 @@
dependencies:
"@babel/highlight" "^7.0.0"
-"@babel/code-frame@7.12.11":
- version "7.12.11"
- resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
- integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
- dependencies:
- "@babel/highlight" "^7.10.4"
-
-"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13":
+"@babel/code-frame@7.12.13", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658"
integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==
@@ -249,7 +242,7 @@
"@babel/traverse" "^7.12.13"
"@babel/types" "^7.12.13"
-"@babel/highlight@^7.0.0", "@babel/highlight@^7.10.4":
+"@babel/highlight@^7.0.0":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143"
integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==
@@ -3062,6 +3055,7 @@ eslint-plugin-jest@24.1.3:
"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
+ uid ""
eslint-plugin-react@7.22.0:
version "7.22.0"
From c15fc73dd0f0177ef5ed0ebfdffb679d45eb1671 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 4 Feb 2021 05:42:06 +0000
Subject: [PATCH 070/237] Build(deps-dev): Bump webpack from 5.20.0 to 5.20.1
in /website (#10243)
---
website/package.json | 2 +-
website/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/website/package.json b/website/package.json
index bfda79e4d..542da7d16 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.20.0",
+ "webpack": "5.20.1",
"webpack-cli": "4.5.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index 2fe24cd9d..11bda98e3 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -7365,10 +7365,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.0:
- version "5.20.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.0.tgz#7225c2e780f4332aef18e0b323b8b3ec01e16d66"
- integrity sha512-k7X/+gisrvirr4bzv8JVLzy2RhWiVzd3gA9qzS5je3lwqYrMc5F549vLOk34BoNkkUp4SIpt1rQp48pTxBMXvA==
+webpack@5.20.1:
+ version "5.20.1"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.1.tgz#dfecbcfb660544113a923479c8ca1044fdbf1533"
+ integrity sha512-cStILc8W14WZXsgfeJmNIQlmQU06F7THfCJ6id3pIB/EXuR6nquolJ2ZJoaLNb6zdec6O2jOAzVKtBYc7vGDjg==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 8c5523882befca27da702bd5fd97e56bcca54b2a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 4 Feb 2021 08:13:59 +0000
Subject: [PATCH 071/237] Build(deps-dev): Bump webpack from 5.20.0 to 5.20.1
(#10241)
---
package.json | 2 +-
yarn.lock | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
index b177a4abf..686b633c0 100644
--- a/package.json
+++ b/package.json
@@ -131,7 +131,7 @@
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
- "webpack": "5.20.0"
+ "webpack": "5.20.1"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
diff --git a/yarn.lock b/yarn.lock
index 45143e227..d05151f42 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3055,7 +3055,6 @@ eslint-plugin-jest@24.1.3:
"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
- uid ""
eslint-plugin-react@7.22.0:
version "7.22.0"
@@ -7299,10 +7298,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.0:
- version "5.20.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.0.tgz#7225c2e780f4332aef18e0b323b8b3ec01e16d66"
- integrity sha512-k7X/+gisrvirr4bzv8JVLzy2RhWiVzd3gA9qzS5je3lwqYrMc5F549vLOk34BoNkkUp4SIpt1rQp48pTxBMXvA==
+webpack@5.20.1:
+ version "5.20.1"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.1.tgz#dfecbcfb660544113a923479c8ca1044fdbf1533"
+ integrity sha512-cStILc8W14WZXsgfeJmNIQlmQU06F7THfCJ6id3pIB/EXuR6nquolJ2ZJoaLNb6zdec6O2jOAzVKtBYc7vGDjg==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 575be32c05e5bd465719a079f131be88d527c881 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Thu, 4 Feb 2021 13:42:47 +0200
Subject: [PATCH 072/237] Minor fixes in doc-debug
---
src/document/doc-debug.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index f824ceb12..0c90ab5f2 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -137,7 +137,7 @@ function printDocToDebug(doc) {
if (doc.expandedStates) {
return `conditionalGroup([${doc.expandedStates
- .map(printDoc)
+ .map((part) => printDoc(part))
.join(",")}]${options})`;
}
@@ -168,7 +168,8 @@ function printDocToDebug(doc) {
return printedSymbols[id];
}
- const prefix = id.description || "symbol";
+ // TODO: use Symbol.prototype.description instead of slice once Node 10 is dropped
+ const prefix = String(id).slice(7, -1) || "symbol";
for (let counter = 0; ; counter++) {
const key = prefix + (counter > 0 ? ` #${counter}` : "");
if (!usedKeysForSymbols.has(key)) {
From 5a33fec9041073d0a5fc17f72257e91a7af9a574 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Fri, 5 Feb 2021 01:03:40 +0200
Subject: [PATCH 073/237] RFC: indentIfBreak (#10221)
---
.eslintrc.yml | 5 +-
changelog_unreleased/api/10221.md | 3 +
commands.md | 17 +++++
.../index.js | 3 +-
.../prefer-indent-if-break.js | 67 +++++++++++++++++++
.../test.js | 29 ++++++++
src/document/doc-builders.js | 16 +++++
src/document/doc-debug.js | 17 +++++
src/document/doc-printer.js | 48 ++++++++++---
src/language-html/printer-html.js | 5 +-
src/language-js/print/binaryish.js | 13 +++-
src/language-js/print/class.js | 8 +--
src/language-js/print/interface.js | 7 +-
tests_integration/__tests__/debug-api.js | 14 +++-
14 files changed, 221 insertions(+), 31 deletions(-)
create mode 100644 changelog_unreleased/api/10221.md
create mode 100644 scripts/tools/eslint-plugin-prettier-internal-rules/prefer-indent-if-break.js
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 538619561..bee112d4a 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -116,9 +116,10 @@ overrides:
- files: src/**/*.js
rules:
prettier-internal-rules/no-doc-builder-concat: error
- prettier-internal-rules/prefer-fast-path-each: error
- prettier-internal-rules/prefer-is-non-empty-array: error
prettier-internal-rules/no-empty-flat-contents-for-if-break: error
+ prettier-internal-rules/prefer-fast-path-each: error
+ prettier-internal-rules/prefer-indent-if-break: error
+ prettier-internal-rules/prefer-is-non-empty-array: error
- files: src/document/*.js
rules:
prettier-internal-rules/no-doc-builder-concat: off
diff --git a/changelog_unreleased/api/10221.md b/changelog_unreleased/api/10221.md
new file mode 100644
index 000000000..5e4fecb18
--- /dev/null
+++ b/changelog_unreleased/api/10221.md
@@ -0,0 +1,3 @@
+#### Add `indentIfBreak` IR command (#10221 by @thorn)
+
+`indentIfBreak(doc, { groupId })` is an optimized version of `ifBreak(indent(doc), doc, { groupId })`.
diff --git a/commands.md b/commands.md
index 7fe0c4833..c9527be5e 100644
--- a/commands.md
+++ b/commands.md
@@ -254,6 +254,23 @@ declare const trim: Doc;
Trim all the indentation on the current line. This can be used for preprocessor directives. Should be placed after a line break.
+### `indentIfBreak`
+
+_Added in v2.3.0_
+
+```ts
+declare function indentIfBreak(
+ doc: Doc,
+ opts: { groupId: symbol; negate?: boolean }
+): Doc;
+```
+
+An optimized version of `ifBreak(indent(doc), doc, { groupId })`.
+
+With `negate: true`, corresponds to `ifBreak(doc, indent(doc), { groupId })`
+
+It doesn't make sense to apply `indentIfBreak` to the current group because "indent if the current group is broken" is the normal behavior of `indent`. That's why `groupId` is required.
+
### `hardlineWithoutBreakParent` and `literallineWithoutBreakParent`
_Added in v2.3.0_
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
index a8ab40ff2..ec56ee454 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
@@ -6,10 +6,11 @@ module.exports = {
"directly-loc-start-end": require("./directly-loc-start-end"),
"jsx-identifier-case": require("./jsx-identifier-case"),
"no-doc-builder-concat": require("./no-doc-builder-concat"),
+ "no-empty-flat-contents-for-if-break": require("./no-empty-flat-contents-for-if-break"),
"no-node-comments": require("./no-node-comments"),
"prefer-fast-path-each": require("./prefer-fast-path-each"),
+ "prefer-indent-if-break": require("./prefer-indent-if-break"),
"prefer-is-non-empty-array": require("./prefer-is-non-empty-array"),
"require-json-extensions": require("./require-json-extensions"),
- "no-empty-flat-contents-for-if-break": require("./no-empty-flat-contents-for-if-break"),
},
};
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-indent-if-break.js b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-indent-if-break.js
new file mode 100644
index 000000000..99673835d
--- /dev/null
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-indent-if-break.js
@@ -0,0 +1,67 @@
+"use strict";
+
+const selector = [
+ "CallExpression",
+ "[optional=false]",
+ '[callee.type="Identifier"]',
+ '[callee.name="ifBreak"]',
+ "[arguments.length=3]",
+ '[arguments.0.type="CallExpression"]',
+ "[arguments.0.optional=false]",
+ '[arguments.0.callee.type="Identifier"]',
+ '[arguments.0.callee.name="indent"]',
+ "[arguments.0.arguments.length=1]",
+ '[arguments.0.arguments.0.type!="SpreadElement"]',
+ '[arguments.1.type!="SpreadElement"]',
+ '[arguments.2.type!="SpreadElement"]',
+].join("");
+
+const messageId = "prefer-indent-if-break";
+
+module.exports = {
+ meta: {
+ type: "suggestion",
+ docs: {
+ url:
+ "https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/prefer-indent-if-break.js",
+ },
+ messages: {
+ [messageId]: "Prefer `indentIfBreak(β¦)` over `ifBreak(indent(β¦), β¦)`.",
+ },
+ fixable: "code",
+ },
+ create(context) {
+ const sourceCode = context.getSourceCode();
+
+ return {
+ [selector](node) {
+ const indentDoc = node.arguments[0].arguments[0];
+ const doc = node.arguments[1];
+
+ // Use text to compare same `doc`
+ if (sourceCode.getText(indentDoc) !== sourceCode.getText(doc)) {
+ return;
+ }
+
+ context.report({
+ node,
+ messageId,
+ *fix(fixer) {
+ yield fixer.replaceText(node.callee, "indentIfBreak");
+ const openingParenthesisToken = sourceCode.getTokenAfter(
+ node.callee
+ );
+ const commaToken = sourceCode.getTokenBefore(
+ doc,
+ ({ type, value }) => type === "Punctuator" && value === ","
+ );
+ yield fixer.replaceTextRange(
+ [openingParenthesisToken.range[1], commaToken.range[1]],
+ ""
+ );
+ },
+ });
+ },
+ };
+ },
+};
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
index 85ab03c21..932a9298b 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
@@ -155,6 +155,35 @@ test("prefer-fast-path-each", {
],
});
+test("prefer-indent-if-break", {
+ valid: [
+ "ifBreak(indent(doc))",
+ "notIfBreak(indent(doc), doc, options)",
+ "ifBreak(indent(doc), doc, )",
+ "ifBreak(...a, ...b, ...c)",
+ "ifBreak(notIndent(doc), doc, options)",
+ "ifBreak(indent(doc), notSameDoc, options)",
+ "ifBreak(indent(...a), a, options)",
+ "ifBreak(indent(a, b), a, options)",
+ ],
+ invalid: [
+ {
+ code: "ifBreak(indent(doc), doc, options)",
+ output: "indentIfBreak( doc, options)",
+ errors: [
+ {
+ message: "Prefer `indentIfBreak(β¦)` over `ifBreak(indent(β¦), β¦)`.",
+ },
+ ],
+ },
+ {
+ code: "ifBreak((indent(doc)), (doc), options)",
+ output: "indentIfBreak( (doc), options)",
+ errors: 1,
+ },
+ ],
+});
+
test("prefer-is-non-empty-array", {
valid: [
// `isNonEmptyArray` self is ignored
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index 31bff43cd..2a26cf0e4 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -172,6 +172,21 @@ function ifBreak(breakContents, flatContents, opts = {}) {
};
}
+/**
+ * Optimized version of `ifBreak(indent(doc), doc, { groupId: ... })`
+ * @param {Doc} contents
+ * @param {{ groupId: symbol, negate?: boolean }} opts
+ * @returns Doc
+ */
+function indentIfBreak(contents, opts) {
+ return {
+ type: "indent-if-break",
+ contents,
+ groupId: opts.groupId,
+ negate: opts.negate,
+ };
+}
+
/**
* @param {Doc} contents
* @returns Doc
@@ -258,6 +273,7 @@ module.exports = {
ifBreak,
trim,
indent,
+ indentIfBreak,
align,
addAlignmentToDoc,
markAsRoot,
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index 0c90ab5f2..e462313fb 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -121,6 +121,23 @@ function printDocToDebug(doc) {
);
}
+ if (doc.type === "indent-if-break") {
+ const optionsParts = [];
+
+ if (doc.negate) {
+ optionsParts.push("negate: true");
+ }
+
+ if (doc.groupId) {
+ optionsParts.push(`groupId: ${printGroupId(doc.groupId)}`);
+ }
+
+ const options =
+ optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : "";
+
+ return `indentIfBreak(${printDoc(doc.contents)}${options})`;
+ }
+
if (doc.type === "group") {
const optionsParts = [];
diff --git a/src/document/doc-printer.js b/src/document/doc-printer.js
index 5e2558f1a..cdcecaa93 100644
--- a/src/document/doc-printer.js
+++ b/src/document/doc-printer.js
@@ -2,7 +2,7 @@
const { getStringWidth } = require("../common/util");
const { convertEndOfLineToChars } = require("../common/end-of-line");
-const { concat, fill, cursor } = require("./doc-builders");
+const { concat, fill, cursor, indent } = require("./doc-builders");
const { isConcat, getDocParts } = require("./doc-utils");
/** @type {Record} */
@@ -203,16 +203,29 @@ function fits(next, restCommands, width, options, hasLineSuffix, mustBeFlat) {
}
break;
- case "if-break": {
+ case "if-break":
+ case "indent-if-break": {
const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
if (groupMode === MODE_BREAK) {
- if (doc.breakContents) {
- cmds.push([ind, mode, doc.breakContents]);
+ const breakContents =
+ doc.type === "if-break"
+ ? doc.breakContents
+ : doc.negate
+ ? doc.contents
+ : indent(doc.contents);
+ if (breakContents) {
+ cmds.push([ind, mode, breakContents]);
}
}
if (groupMode === MODE_FLAT) {
- if (doc.flatContents) {
- cmds.push([ind, mode, doc.flatContents]);
+ const flatContents =
+ doc.type === "if-break"
+ ? doc.flatContents
+ : doc.negate
+ ? indent(doc.contents)
+ : doc.contents;
+ if (flatContents) {
+ cmds.push([ind, mode, flatContents]);
}
}
@@ -459,16 +472,29 @@ function printDocToString(doc, options) {
}
break;
}
- case "if-break": {
+ case "if-break":
+ case "indent-if-break": {
const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
if (groupMode === MODE_BREAK) {
- if (doc.breakContents) {
- cmds.push([ind, mode, doc.breakContents]);
+ const breakContents =
+ doc.type === "if-break"
+ ? doc.breakContents
+ : doc.negate
+ ? doc.contents
+ : indent(doc.contents);
+ if (breakContents) {
+ cmds.push([ind, mode, breakContents]);
}
}
if (groupMode === MODE_FLAT) {
- if (doc.flatContents) {
- cmds.push([ind, mode, doc.flatContents]);
+ const flatContents =
+ doc.type === "if-break"
+ ? doc.flatContents
+ : doc.negate
+ ? indent(doc.contents)
+ : doc.contents;
+ if (flatContents) {
+ cmds.push([ind, mode, flatContents]);
}
}
diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js
index 46aec9c30..e3d22236d 100644
--- a/src/language-html/printer-html.js
+++ b/src/language-html/printer-html.js
@@ -9,6 +9,7 @@ const {
group,
hardline,
ifBreak,
+ indentIfBreak,
indent,
join,
line,
@@ -275,9 +276,7 @@ function genericPrint(path, options, print) {
forceBreakContent(node) ? breakParent : "",
((childrenDoc) =>
shouldHugContent
- ? ifBreak(indent(childrenDoc), childrenDoc, {
- groupId: attrGroupId,
- })
+ ? indentIfBreak(childrenDoc, { groupId: attrGroupId })
: (isScriptLikeTag(node) ||
isVueCustomBlock(node, options)) &&
node.parent.type === "root" &&
diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js
index fdad81b56..11e332f42 100644
--- a/src/language-js/print/binaryish.js
+++ b/src/language-js/print/binaryish.js
@@ -3,7 +3,16 @@
const { printComments } = require("../../main/comments");
const { getLast } = require("../../common/util");
const {
- builders: { join, line, softline, group, indent, align, ifBreak },
+ builders: {
+ join,
+ line,
+ softline,
+ group,
+ indent,
+ align,
+ ifBreak,
+ indentIfBreak,
+ },
utils: { cleanDoc, getDocParts },
} = require("../../document");
const {
@@ -160,7 +169,7 @@ function printBinaryishExpression(path, options, print) {
}
const jsxPart = getLast(parts);
- return group([chain, ifBreak(indent(jsxPart), jsxPart, { groupId })]);
+ return group([chain, indentIfBreak(jsxPart, { groupId })]);
}
// For binary expressions to be consistent, we need to group
diff --git a/src/language-js/print/class.js b/src/language-js/print/class.js
index f2d90dab8..a016ccbba 100644
--- a/src/language-js/print/class.js
+++ b/src/language-js/print/class.js
@@ -73,15 +73,11 @@ function printClass(path, options, print) {
);
if (groupMode) {
- const printedExtends = extendsParts;
let printedPartsGroup;
if (shouldIndentOnlyHeritageClauses(n)) {
- printedPartsGroup = [
- ...partsGroup,
- ifBreak(indent(printedExtends), printedExtends),
- ];
+ printedPartsGroup = [...partsGroup, indent(extendsParts)];
} else {
- printedPartsGroup = indent([...partsGroup, printedExtends]);
+ printedPartsGroup = indent([...partsGroup, extendsParts]);
}
parts.push(group(printedPartsGroup, { id: getHeritageGroupId(n) }));
} else {
diff --git a/src/language-js/print/interface.js b/src/language-js/print/interface.js
index 428fbd821..85aca9418 100644
--- a/src/language-js/print/interface.js
+++ b/src/language-js/print/interface.js
@@ -60,13 +60,10 @@ function printInterface(path, options, print) {
(n.id && hasComment(n.id, CommentCheckFlags.Trailing)) ||
isNonEmptyArray(n.extends)
) {
- const printedExtends = extendsParts;
if (shouldIndentOnlyHeritageClauses) {
- parts.push(
- group([...partsGroup, ifBreak(indent(printedExtends), printedExtends)])
- );
+ parts.push(group([...partsGroup, indent(extendsParts)]));
} else {
- parts.push(group(indent([...partsGroup, ...printedExtends])));
+ parts.push(group(indent([...partsGroup, ...extendsParts])));
}
} else {
parts.push(...partsGroup, ...extendsParts);
diff --git a/tests_integration/__tests__/debug-api.js b/tests_integration/__tests__/debug-api.js
index 69c556ef5..f7f3a1f59 100644
--- a/tests_integration/__tests__/debug-api.js
+++ b/tests_integration/__tests__/debug-api.js
@@ -58,7 +58,15 @@ describe("API", () => {
});
test("prettier.formatDoc prints things as expected", () => {
- const { indent, hardline, literalline, fill } = builders;
+ const {
+ indent,
+ hardline,
+ literalline,
+ fill,
+ indentIfBreak,
+ group,
+ line,
+ } = builders;
expect(formatDoc([indent(hardline), indent(literalline)])).toBe(
"[indent(hardline), indent(literalline)]"
@@ -74,5 +82,9 @@ describe("API", () => {
fill(cleanDoc(["foo", literalline, "bar"])) // invalid fill
)
).toBe('fill(["foo", literallineWithoutBreakParent, breakParent, "bar"])');
+
+ expect(
+ formatDoc(indentIfBreak(group(["1", line, "2"]), { groupId: "Q" }))
+ ).toBe('indentIfBreak(group(["1", line, "2"]), { groupId: "Q" })');
});
});
From 6ecb30a5ae670a4045b674bcf9ef2042d50b7b7f Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Fri, 5 Feb 2021 07:04:54 +0800
Subject: [PATCH 074/237] Refactor `ChainElement` related parts (#10245)
* Rename `isCallOrOptionalCallExpression` -> `isCallExpression`
* Replace use of `OptionalCallExpression`
* Fix
* Add `isMemberExpression`
* Check truly in `isCallExpression` and `isMemberExpression`
* Replace `OptionalMemberExpression`
* Remove unneeded check
* Fix type check
---
src/language-js/comments.js | 17 ++---
src/language-js/needs-parens.js | 13 ++--
src/language-js/print/binaryish.js | 13 ++--
src/language-js/print/call-arguments.js | 4 +-
src/language-js/print/call-expression.js | 4 +-
src/language-js/print/jsx.js | 7 +--
src/language-js/print/member-chain.js | 28 ++++-----
src/language-js/print/member.js | 8 +--
src/language-js/print/template-literal.js | 4 +-
src/language-js/print/ternary.js | 10 ++-
src/language-js/printer-estree.js | 10 ++-
src/language-js/utils.js | 75 +++++++++++------------
12 files changed, 87 insertions(+), 106 deletions(-)
diff --git a/src/language-js/comments.js b/src/language-js/comments.js
index e4e0caa09..f0a0ae6c1 100644
--- a/src/language-js/comments.js
+++ b/src/language-js/comments.js
@@ -20,6 +20,8 @@ const {
hasFlowShorthandAnnotationComment,
hasFlowAnnotationComment,
hasIgnoreComment,
+ isCallExpression,
+ isMemberExpression,
} = require("./utils");
const { locStart, locEnd } = require("./loc");
@@ -315,9 +317,7 @@ function handleMemberExpressionComments({
followingNode,
}) {
if (
- enclosingNode &&
- (enclosingNode.type === "MemberExpression" ||
- enclosingNode.type === "OptionalMemberExpression") &&
+ isMemberExpression(enclosingNode) &&
followingNode &&
followingNode.type === "Identifier"
) {
@@ -521,8 +521,7 @@ function handleCommentInEmptyParens({ comment, enclosingNode, text }) {
enclosingNode &&
((isRealFunctionLikeNode(enclosingNode) &&
getFunctionParameters(enclosingNode).length === 0) ||
- ((enclosingNode.type === "CallExpression" ||
- enclosingNode.type === "OptionalCallExpression" ||
+ ((isCallExpression(enclosingNode) ||
enclosingNode.type === "NewExpression") &&
enclosingNode.arguments.length === 0))
) {
@@ -644,9 +643,7 @@ function handleCallExpressionComments({
enclosingNode,
}) {
if (
- enclosingNode &&
- (enclosingNode.type === "CallExpression" ||
- enclosingNode.type === "OptionalCallExpression") &&
+ isCallExpression(enclosingNode) &&
precedingNode &&
enclosingNode.callee === precedingNode &&
enclosingNode.arguments.length > 0
@@ -958,9 +955,7 @@ function willPrintOwnComments(path /*, options */) {
((node &&
(isJsxNode(node) ||
hasFlowShorthandAnnotationComment(node) ||
- (parent &&
- (parent.type === "CallExpression" ||
- parent.type === "OptionalCallExpression") &&
+ (isCallExpression(parent) &&
(hasFlowAnnotationComment(node.leadingComments) ||
hasFlowAnnotationComment(node.trailingComments))))) ||
(parent &&
diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js
index 9ecb744b9..0dbd01a74 100644
--- a/src/language-js/needs-parens.js
+++ b/src/language-js/needs-parens.js
@@ -10,6 +10,8 @@ const {
startsWithNoLookaheadToken,
shouldFlatten,
getPrecedence,
+ isCallExpression,
+ isMemberExpression,
} = require("./utils");
function needsParens(path, options) {
@@ -675,9 +677,7 @@ function needsParens(path, options) {
(name === "callee" &&
(parent.type === "BindExpression" ||
parent.type === "NewExpression")) ||
- (name === "object" &&
- (parent.type === "MemberExpression" ||
- parent.type === "OptionalMemberExpression"))
+ (name === "object" && isMemberExpression(parent))
);
case "NGPipeExpression":
if (
@@ -687,9 +687,7 @@ function needsParens(path, options) {
// Preserve parens for compatibility with AngularJS expressions
!(node.extra && node.extra.parenthesized)) ||
parent.type === "ArrayExpression" ||
- ((parent.type === "CallExpression" ||
- parent.type === "OptionalCallExpression") &&
- parent.arguments[name] === node) ||
+ (isCallExpression(parent) && parent.arguments[name] === node) ||
(name === "right" && parent.type === "NGPipeExpression") ||
(name === "property" && parent.type === "MemberExpression") ||
parent.type === "AssignmentExpression"
@@ -709,7 +707,6 @@ function needsParens(path, options) {
parent.type !== "AssignmentExpression" &&
parent.type !== "AssignmentPattern" &&
parent.type !== "BinaryExpression" &&
- parent.type !== "CallExpression" &&
parent.type !== "NewExpression" &&
parent.type !== "ConditionalExpression" &&
parent.type !== "ExpressionStatement" &&
@@ -720,7 +717,7 @@ function needsParens(path, options) {
parent.type !== "JSXFragment" &&
parent.type !== "LogicalExpression" &&
parent.type !== "ObjectProperty" &&
- parent.type !== "OptionalCallExpression" &&
+ !isCallExpression(parent) &&
parent.type !== "Property" &&
parent.type !== "ReturnStatement" &&
parent.type !== "ThrowStatement" &&
diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js
index 11e332f42..fb911725c 100644
--- a/src/language-js/print/binaryish.js
+++ b/src/language-js/print/binaryish.js
@@ -22,6 +22,8 @@ const {
shouldFlatten,
hasComment,
CommentCheckFlags,
+ isCallExpression,
+ isMemberExpression,
} = require("../utils");
/** @typedef {import("../../document").Doc} Doc */
@@ -69,13 +71,9 @@ function printBinaryishExpression(path, options, print) {
// c
// ).call()
if (
- ((parent.type === "CallExpression" ||
- parent.type === "OptionalCallExpression") &&
- parent.callee === n) ||
+ (isCallExpression(parent) && parent.callee === n) ||
parent.type === "UnaryExpression" ||
- ((parent.type === "MemberExpression" ||
- parent.type === "OptionalMemberExpression") &&
- !parent.computed)
+ (isMemberExpression(parent) && !parent.computed)
) {
return group([indent([softline, ...parts]), softline]);
}
@@ -98,8 +96,7 @@ function printBinaryishExpression(path, options, print) {
(parent.type === "ConditionalExpression" &&
parentParent.type !== "ReturnStatement" &&
parentParent.type !== "ThrowStatement" &&
- parentParent.type !== "CallExpression" &&
- parentParent.type !== "OptionalCallExpression") ||
+ !isCallExpression(parentParent)) ||
parent.type === "TemplateLiteral";
const shouldIndentIfInlining =
diff --git a/src/language-js/print/call-arguments.js b/src/language-js/print/call-arguments.js
index 8121ec3a4..ed385406a 100644
--- a/src/language-js/print/call-arguments.js
+++ b/src/language-js/print/call-arguments.js
@@ -14,6 +14,7 @@ const {
getCallArguments,
iterateCallArgumentsPath,
isNextLineEmpty,
+ isCallExpression,
} = require("../utils");
const {
@@ -251,8 +252,7 @@ function couldGroupArg(arg) {
arg.body.type === "ArrowFunctionExpression" ||
arg.body.type === "ObjectExpression" ||
arg.body.type === "ArrayExpression" ||
- arg.body.type === "CallExpression" ||
- arg.body.type === "OptionalCallExpression" ||
+ isCallExpression(arg.body) ||
arg.body.type === "ConditionalExpression" ||
isJsxNode(arg.body)))
);
diff --git a/src/language-js/print/call-expression.js b/src/language-js/print/call-expression.js
index 2b5a0941e..6b33179fc 100644
--- a/src/language-js/print/call-expression.js
+++ b/src/language-js/print/call-expression.js
@@ -7,7 +7,7 @@ const pathNeedsParens = require("../needs-parens");
const {
getCallArguments,
hasFlowAnnotationComment,
- isCallOrOptionalCallExpression,
+ isCallExpression,
isMemberish,
isTemplateOnItsOwnLine,
isTestCall,
@@ -95,7 +95,7 @@ function printCallExpression(path, options, print) {
// We group here when the callee is itself a call expression.
// See `isLongCurriedCallExpression` for more info.
- if (isDynamicImport || isCallOrOptionalCallExpression(n.callee)) {
+ if (isDynamicImport || isCallExpression(n.callee)) {
return group(contents);
}
diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js
index 366afb9e2..1c67dc84c 100644
--- a/src/language-js/print/jsx.js
+++ b/src/language-js/print/jsx.js
@@ -22,7 +22,7 @@ const {
isJsxNode,
rawText,
isLiteral,
- isCallOrOptionalCallExpression,
+ isCallExpression,
isStringLiteral,
isBinaryish,
hasComment,
@@ -451,7 +451,7 @@ function maybeWrapJsxElementInParens(path, elem, options) {
const shouldBreak = path.match(
undefined,
(node) => node.type === "ArrowFunctionExpression",
- isCallOrOptionalCallExpression,
+ isCallExpression,
(node) => node.type === "JSXExpressionContainer"
);
@@ -505,8 +505,7 @@ function printJsxExpressionContainer(path, options, print) {
(n.expression.type === "ArrayExpression" ||
n.expression.type === "ObjectExpression" ||
n.expression.type === "ArrowFunctionExpression" ||
- n.expression.type === "CallExpression" ||
- n.expression.type === "OptionalCallExpression" ||
+ isCallExpression(n.expression) ||
n.expression.type === "FunctionExpression" ||
n.expression.type === "TemplateLiteral" ||
n.expression.type === "TaggedTemplateExpression" ||
diff --git a/src/language-js/print/member-chain.js b/src/language-js/print/member-chain.js
index b12c6c191..2564fa507 100644
--- a/src/language-js/print/member-chain.js
+++ b/src/language-js/print/member-chain.js
@@ -10,7 +10,8 @@ const {
} = require("../../common/util");
const pathNeedsParens = require("../needs-parens");
const {
- isCallOrOptionalCallExpression,
+ isCallExpression,
+ isMemberExpression,
isFunctionOrArrowExpression,
isLongCurriedCallExpression,
isMemberish,
@@ -85,8 +86,8 @@ function printMemberChain(path, options, print) {
function rec(path) {
const node = path.getValue();
if (
- isCallOrOptionalCallExpression(node) &&
- (isMemberish(node.callee) || isCallOrOptionalCallExpression(node.callee))
+ isCallExpression(node) &&
+ (isMemberish(node.callee) || isCallExpression(node.callee))
) {
printedNodes.unshift({
node,
@@ -111,8 +112,7 @@ function printMemberChain(path, options, print) {
printed: printComments(
path,
() =>
- node.type === "OptionalMemberExpression" ||
- node.type === "MemberExpression"
+ isMemberExpression(node)
? printMemberLookup(path, options, print)
: printBindExpressionCallee(path, options, print),
options
@@ -179,9 +179,8 @@ function printMemberChain(path, options, print) {
for (; i < printedNodes.length; ++i) {
if (
printedNodes[i].node.type === "TSNonNullExpression" ||
- isCallOrOptionalCallExpression(printedNodes[i].node) ||
- ((printedNodes[i].node.type === "MemberExpression" ||
- printedNodes[i].node.type === "OptionalMemberExpression") &&
+ isCallExpression(printedNodes[i].node) ||
+ (isMemberExpression(printedNodes[i].node) &&
printedNodes[i].node.computed &&
isNumericLiteral(printedNodes[i].node.property))
) {
@@ -190,7 +189,7 @@ function printMemberChain(path, options, print) {
break;
}
}
- if (!isCallOrOptionalCallExpression(printedNodes[0].node)) {
+ if (!isCallExpression(printedNodes[0].node)) {
for (; i + 1 < printedNodes.length; ++i) {
if (
isMemberish(printedNodes[i].node) &&
@@ -228,7 +227,7 @@ function printMemberChain(path, options, print) {
}
if (
- isCallOrOptionalCallExpression(printedNodes[i].node) ||
+ isCallExpression(printedNodes[i].node) ||
printedNodes[i].node.type === "ImportExpression"
) {
hasSeenCallExpression = true;
@@ -288,8 +287,7 @@ function printMemberChain(path, options, print) {
const lastNode = getLast(groups[0]).node;
return (
- (lastNode.type === "MemberExpression" ||
- lastNode.type === "OptionalMemberExpression") &&
+ isMemberExpression(lastNode) &&
lastNode.property.type === "Identifier" &&
(isFactory(lastNode.property.name) || hasComputed)
);
@@ -350,7 +348,7 @@ function printMemberChain(path, options, print) {
// empty line after
const lastNodeBeforeIndent = getLast(groups[shouldMerge ? 1 : 0]).node;
const shouldHaveEmptyLineBeforeIndent =
- !isCallOrOptionalCallExpression(lastNodeBeforeIndent) &&
+ !isCallExpression(lastNodeBeforeIndent) &&
shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
const expanded = [
@@ -362,13 +360,13 @@ function printMemberChain(path, options, print) {
const callExpressions = printedNodes
.map(({ node }) => node)
- .filter(isCallOrOptionalCallExpression);
+ .filter(isCallExpression);
function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
const lastGroupNode = getLast(getLast(groups)).node;
const lastGroupDoc = getLast(printedGroups);
return (
- isCallOrOptionalCallExpression(lastGroupNode) &&
+ isCallExpression(lastGroupNode) &&
willBreak(lastGroupDoc) &&
callExpressions
.slice(0, -1)
diff --git a/src/language-js/print/member.js b/src/language-js/print/member.js
index 01cc8b1eb..16d8ba603 100644
--- a/src/language-js/print/member.js
+++ b/src/language-js/print/member.js
@@ -3,7 +3,7 @@
const {
builders: { softline, group, indent },
} = require("../../document");
-const { isNumericLiteral } = require("../utils");
+const { isNumericLiteral, isMemberExpression } = require("../utils");
const { printOptionalToken } = require("./misc");
function printMemberExpression(path, options, print) {
@@ -17,8 +17,7 @@ function printMemberExpression(path, options, print) {
i++;
} while (
firstNonMemberParent &&
- (firstNonMemberParent.type === "MemberExpression" ||
- firstNonMemberParent.type === "OptionalMemberExpression" ||
+ (isMemberExpression(firstNonMemberParent) ||
firstNonMemberParent.type === "TSNonNullExpression")
);
@@ -33,8 +32,7 @@ function printMemberExpression(path, options, print) {
n.computed ||
(n.object.type === "Identifier" &&
n.property.type === "Identifier" &&
- parent.type !== "MemberExpression" &&
- parent.type !== "OptionalMemberExpression");
+ !isMemberExpression(parent));
return [
path.call(print, "object"),
diff --git a/src/language-js/print/template-literal.js b/src/language-js/print/template-literal.js
index 23e5d5692..9e7833296 100644
--- a/src/language-js/print/template-literal.js
+++ b/src/language-js/print/template-literal.js
@@ -20,6 +20,7 @@ const {
isJestEachTemplateLiteral,
isSimpleTemplateLiteral,
hasComment,
+ isMemberExpression,
} = require("../utils");
function printTemplateLiteral(path, print, options) {
@@ -85,8 +86,7 @@ function printTemplateLiteral(path, print, options) {
// in the middle of a MemberExpression
if (
hasComment(expression) ||
- expression.type === "MemberExpression" ||
- expression.type === "OptionalMemberExpression" ||
+ isMemberExpression(expression) ||
expression.type === "ConditionalExpression" ||
expression.type === "SequenceExpression" ||
expression.type === "TSAsExpression" ||
diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js
index 976f7b9cf..61d47d691 100644
--- a/src/language-js/print/ternary.js
+++ b/src/language-js/print/ternary.js
@@ -2,7 +2,12 @@
const flat = require("lodash/flatten");
const { hasNewlineInRange } = require("../../common/util");
-const { isJsxNode, isBlockComment, getComments } = require("../utils");
+const {
+ isJsxNode,
+ isBlockComment,
+ getComments,
+ isMemberExpression,
+} = require("../utils");
const { locStart, locEnd } = require("../loc");
const {
builders: {
@@ -304,8 +309,7 @@ function printTernary(path, options, print) {
// ).call()
const breakClosingParen =
!jsxMode &&
- (parent.type === "MemberExpression" ||
- parent.type === "OptionalMemberExpression" ||
+ (isMemberExpression(parent) ||
(parent.type === "NGPipeExpression" && parent.left === node)) &&
!parent.computed;
diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js
index 2222cd9a4..f65f02ef4 100644
--- a/src/language-js/printer-estree.js
+++ b/src/language-js/printer-estree.js
@@ -41,6 +41,8 @@ const {
rawText,
shouldPrintComma,
hasIgnoreComment,
+ isCallExpression,
+ isMemberExpression,
} = require("./utils");
const { locStart, locEnd } = require("./loc");
@@ -367,12 +369,8 @@ function printPathNoParens(path, options, print, args) {
}
const parent = path.getParentNode();
if (
- ((parent.type === "CallExpression" ||
- parent.type === "OptionalCallExpression") &&
- parent.callee === n) ||
- ((parent.type === "MemberExpression" ||
- parent.type === "OptionalMemberExpression") &&
- parent.object === n)
+ (isCallExpression(parent) && parent.callee === n) ||
+ (isMemberExpression(parent) && parent.object === n)
) {
return group([indent([softline, ...parts]), softline]);
}
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index e309db064..afbaa43b4 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -101,10 +101,8 @@ function hasNakedLeftSide(node) {
node.type === "LogicalExpression" ||
node.type === "NGPipeExpression" ||
node.type === "ConditionalExpression" ||
- node.type === "CallExpression" ||
- node.type === "OptionalCallExpression" ||
- node.type === "MemberExpression" ||
- node.type === "OptionalMemberExpression" ||
+ isCallExpression(node) ||
+ isMemberExpression(node) ||
node.type === "SequenceExpression" ||
node.type === "TaggedTemplateExpression" ||
node.type === "BindExpression" ||
@@ -309,13 +307,12 @@ function isTemplateLiteral(node) {
* Note: `inject` is used in AngularJS 1.x, `async` in Angular 2+
* example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
*
- * @param {Node} node
+ * @param {CallExpression} node
* @returns {boolean}
*/
function isAngularTestWrapper(node) {
return (
- (node.type === "CallExpression" ||
- node.type === "OptionalCallExpression") &&
+ isCallExpression(node) &&
node.callee.type === "Identifier" &&
(node.callee.name === "async" ||
node.callee.name === "inject" ||
@@ -352,15 +349,14 @@ function isTheOnlyJsxElementInMarkdown(options, path) {
* @returns {boolean}
*/
function isMemberExpressionChain(node) {
- if (
- node.type !== "MemberExpression" &&
- node.type !== "OptionalMemberExpression"
- ) {
+ if (!isMemberExpression(node)) {
return false;
}
+ // @ts-ignore
if (node.object.type === "Identifier") {
return true;
}
+ // @ts-ignore
return isMemberExpressionChain(node.object);
}
@@ -423,8 +419,7 @@ function isBinaryish(node) {
*/
function isMemberish(node) {
return (
- node.type === "MemberExpression" ||
- node.type === "OptionalMemberExpression" ||
+ isMemberExpression(node) ||
(node.type === "BindExpression" && Boolean(node.object))
);
}
@@ -500,13 +495,12 @@ function isSimpleType(node) {
const unitTestRe = /^(skip|[fx]?(it|describe|test))$/;
/**
- * @param {CallExpression} node
+ * @param {{callee: MemberExpression | OptionalMemberExpression}} node
* @returns {boolean}
*/
function isSkipOrOnlyBlock(node) {
return (
- (node.callee.type === "MemberExpression" ||
- node.callee.type === "OptionalMemberExpression") &&
+ isMemberExpression(node.callee) &&
node.callee.object.type === "Identifier" &&
node.callee.property.type === "Identifier" &&
unitTestRe.test(node.callee.object.name) &&
@@ -564,12 +558,25 @@ function isTestCall(n, parent) {
}
/**
- * @param {CallExpression | OptionalCallExpression} node
+ * @param {Node} node
* @returns {boolean}
*/
-function isCallOrOptionalCallExpression(node) {
+function isCallExpression(node) {
return (
- node.type === "CallExpression" || node.type === "OptionalCallExpression"
+ node &&
+ (node.type === "CallExpression" || node.type === "OptionalCallExpression")
+ );
+}
+
+/**
+ * @param {Node} node
+ * @returns {boolean}
+ */
+function isMemberExpression(node) {
+ return (
+ node &&
+ (node.type === "MemberExpression" ||
+ node.type === "OptionalMemberExpression")
);
}
@@ -601,15 +608,9 @@ function isSimpleTemplateLiteral(node) {
}
// Allow `a.b.c`, `a.b[c]`, and `this.x.y`
- if (
- expr.type === "MemberExpression" ||
- expr.type === "OptionalMemberExpression"
- ) {
+ if (isMemberExpression(expr)) {
let head = expr;
- while (
- head.type === "MemberExpression" ||
- head.type === "OptionalMemberExpression"
- ) {
+ while (isMemberExpression(head)) {
if (
head.property.type !== "Identifier" &&
head.property.type !== "Literal" &&
@@ -847,7 +848,7 @@ function isFunctionCompositionArgs(args) {
if (count > 1) {
return true;
}
- } else if (isCallOrOptionalCallExpression(arg)) {
+ } else if (isCallExpression(arg)) {
for (const childArg of arg.arguments) {
if (isFunctionOrArrowExpression(childArg)) {
return true;
@@ -872,8 +873,8 @@ function isLongCurriedCallExpression(path) {
const node = path.getValue();
const parent = path.getParentNode();
return (
- isCallOrOptionalCallExpression(node) &&
- isCallOrOptionalCallExpression(parent) &&
+ isCallExpression(node) &&
+ isCallExpression(parent) &&
parent.callee === node &&
node.arguments.length > parent.arguments.length &&
parent.arguments.length > 0
@@ -938,21 +939,14 @@ function isSimpleCallArgument(node, depth) {
return isChildSimple(node.source);
}
- if (
- node.type === "CallExpression" ||
- node.type === "OptionalCallExpression" ||
- node.type === "NewExpression"
- ) {
+ if (isCallExpression(node) || node.type === "NewExpression") {
return (
isSimpleCallArgument(node.callee, depth) &&
node.arguments.every(isChildSimple)
);
}
- if (
- node.type === "MemberExpression" ||
- node.type === "OptionalMemberExpression"
- ) {
+ if (isMemberExpression(node)) {
return (
isSimpleCallArgument(node.object, depth) &&
isSimpleCallArgument(node.property, depth)
@@ -1355,7 +1349,8 @@ module.exports = {
isBlockComment,
isLineComment,
isPrettierIgnoreComment,
- isCallOrOptionalCallExpression,
+ isCallExpression,
+ isMemberExpression,
isExportDeclaration,
isFlowAnnotationComment,
isFunctionCompositionArgs,
From 819cc01bfb2db315a131999d11c2b55feee91c2b Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Fri, 5 Feb 2021 09:24:44 +0800
Subject: [PATCH 075/237] Safer check before passing to `fill` (#10235)
---
src/document/doc-utils.js | 13 ++++++++++++-
src/language-html/printer-html.js | 8 ++++++--
src/language-js/print/binaryish.js | 10 +++++-----
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/document/doc-utils.js b/src/document/doc-utils.js
index 738527336..aac57de7f 100644
--- a/src/document/doc-utils.js
+++ b/src/document/doc-utils.js
@@ -3,7 +3,18 @@
const { literalline, concat } = require("./doc-builders");
const isConcat = (doc) => Array.isArray(doc) || (doc && doc.type === "concat");
-const getDocParts = (doc) => (Array.isArray(doc) ? doc : doc.parts);
+const getDocParts = (doc) => {
+ if (Array.isArray(doc)) {
+ return doc;
+ }
+
+ /* istanbul ignore next */
+ if (doc.type !== "concat" && doc.type !== "fill") {
+ throw new Error("Expect doc type to be `concat` or `fill`.");
+ }
+
+ return doc.parts;
+};
// Using a unique object to compare by reference.
const traverseDocOnExitStackMarker = {};
diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js
index e3d22236d..ce4fe70dc 100644
--- a/src/language-html/printer-html.js
+++ b/src/language-html/printer-html.js
@@ -16,7 +16,7 @@ const {
literalline,
softline,
},
- utils: { mapDoc, cleanDoc, getDocParts },
+ utils: { mapDoc, cleanDoc, getDocParts, isConcat },
} = require("../document");
const { replaceEndOfLineWith, isNonEmptyArray } = require("../common/util");
const { print: printFrontMatter } = require("../utils/front-matter");
@@ -366,7 +366,11 @@ function genericPrint(path, options, print) {
...getTextValueParts(node),
printClosingTagSuffix(node, options),
]);
- return typeof printed === "string" ? printed : fill(getDocParts(printed));
+ if (isConcat(printed) || printed.type === "fill") {
+ return fill(getDocParts(printed));
+ }
+ /* istanbul ignore next */
+ return printed;
}
case "docType":
return [
diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js
index fb911725c..338432cab 100644
--- a/src/language-js/print/binaryish.js
+++ b/src/language-js/print/binaryish.js
@@ -13,7 +13,7 @@ const {
ifBreak,
indentIfBreak,
},
- utils: { cleanDoc, getDocParts },
+ utils: { cleanDoc, getDocParts, isConcat },
} = require("../../document");
const {
hasLeadingOwnLineComment,
@@ -276,11 +276,11 @@ function printBinaryishExpressions(
// only for the left and right parts
if (isNested && hasComment(node)) {
const printed = cleanDoc(printComments(path, () => parts, options));
- /* istanbul ignore if */
- if (printed.type === "string") {
- parts = [printed];
- } else {
+ /* istanbul ignore else */
+ if (isConcat(printed) || printed.type === "fill") {
parts = getDocParts(printed);
+ } else {
+ parts = [printed];
}
}
} else {
From a8f35961c066de440ceb31c9b7414c88cf91e7af Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 5 Feb 2021 15:49:05 +0800
Subject: [PATCH 076/237] Build(deps-dev): Bump webpack from 5.20.1 to 5.20.2
(#10253)
Bumps [webpack](https://github.com/webpack/webpack) from 5.20.1 to 5.20.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.20.1...v5.20.2)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 686b633c0..eb609cea6 100644
--- a/package.json
+++ b/package.json
@@ -131,7 +131,7 @@
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
- "webpack": "5.20.1"
+ "webpack": "5.20.2"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
diff --git a/yarn.lock b/yarn.lock
index d05151f42..5e988ac5a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7298,10 +7298,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.1:
- version "5.20.1"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.1.tgz#dfecbcfb660544113a923479c8ca1044fdbf1533"
- integrity sha512-cStILc8W14WZXsgfeJmNIQlmQU06F7THfCJ6id3pIB/EXuR6nquolJ2ZJoaLNb6zdec6O2jOAzVKtBYc7vGDjg==
+webpack@5.20.2:
+ version "5.20.2"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.2.tgz#55a6e461e2a6e1ca7467a419886acf9c7b052d5f"
+ integrity sha512-gGPip54KK7DznaaPHVuNGqym3LAXXL+bPkZ9SlLTCdHmmk+m5x+D4UZdhWvw32CMahYlZwZYPsioFIw36/txYQ==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 0b5f259c082536e0adc0ebff9bdfb39f30a4d01f Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Sat, 6 Feb 2021 14:41:02 +0200
Subject: [PATCH 077/237] Another minor fix in doc-debug
---
src/document/doc-debug.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index e462313fb..41bda1c36 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -142,7 +142,7 @@ function printDocToDebug(doc) {
const optionsParts = [];
if (doc.break && doc.break !== "propagated") {
- optionsParts.push("break: true");
+ optionsParts.push("shouldBreak: true");
}
if (doc.id) {
From 05b5ba88e1f20dd0da2ac66d935eb32676b6242c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 7 Feb 2021 08:50:48 +0800
Subject: [PATCH 078/237] Build(deps-dev): Bump webpack from 5.20.1 to 5.20.2
in /website (#10254)
Bumps [webpack](https://github.com/webpack/webpack) from 5.20.1 to 5.20.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.20.1...v5.20.2)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
website/package.json | 2 +-
website/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/website/package.json b/website/package.json
index 542da7d16..a4598fc18 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.20.1",
+ "webpack": "5.20.2",
"webpack-cli": "4.5.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index 11bda98e3..663c24f8b 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -7365,10 +7365,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.1:
- version "5.20.1"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.1.tgz#dfecbcfb660544113a923479c8ca1044fdbf1533"
- integrity sha512-cStILc8W14WZXsgfeJmNIQlmQU06F7THfCJ6id3pIB/EXuR6nquolJ2ZJoaLNb6zdec6O2jOAzVKtBYc7vGDjg==
+webpack@5.20.2:
+ version "5.20.2"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.2.tgz#55a6e461e2a6e1ca7467a419886acf9c7b052d5f"
+ integrity sha512-gGPip54KK7DznaaPHVuNGqym3LAXXL+bPkZ9SlLTCdHmmk+m5x+D4UZdhWvw32CMahYlZwZYPsioFIw36/txYQ==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 93409294e65f83fcab56f522dee8d4405ad0ee4c Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Sun, 7 Feb 2021 08:51:19 +0800
Subject: [PATCH 079/237] CLI: clear printed long filenames (#10217)
---
changelog_unreleased/cli/10217.md | 17 +++++++++++
cspell.json | 1 +
package.json | 3 +-
src/cli/format.js | 24 +++++++++-------
src/cli/logger.js | 48 +++++++++++++++++++++++++++----
yarn.lock | 20 +++++++++++++
6 files changed, 97 insertions(+), 16 deletions(-)
create mode 100644 changelog_unreleased/cli/10217.md
diff --git a/changelog_unreleased/cli/10217.md b/changelog_unreleased/cli/10217.md
new file mode 100644
index 000000000..aba596519
--- /dev/null
+++ b/changelog_unreleased/cli/10217.md
@@ -0,0 +1,17 @@
+#### Clear printed long filenames of formatting file (#10217 by @fisker)
+
+
+```console
+# Prettier stable
+$ prettier tests/flow-repo/config_module_system_node_resolve_dirname --check
+Checking formatting...
+tests\flow-repo\config_module_system_node_resolve_dirname\custom_resolve_dir\tes
+tests\flow-repo\config_module_system_node_resolve_dirname\custom_resolve_dir\tes
+tests\flow-repo\config_module_system_node_resolve_dirname\subdir\custom_resolve_
+All matched files use Prettier code style!
+
+// Prettier main
+$ prettier tests/flow-repo/config_module_system_node_resolve_dirname --check
+Checking formatting...
+All matched files use Prettier code style!
+```
diff --git a/cspell.json b/cspell.json
index 81a7a1e1f..70cb29467 100644
--- a/cspell.json
+++ b/cspell.json
@@ -411,6 +411,7 @@
"Vue's",
"Wadler",
"Wadler's",
+ "wcwidth",
"webcompat",
"webstorm",
"Weixin",
diff --git a/package.json b/package.json
index eb609cea6..063213466 100644
--- a/package.json
+++ b/package.json
@@ -78,10 +78,12 @@
"resolve": "1.19.0",
"semver": "7.3.4",
"string-width": "4.2.0",
+ "strip-ansi": "6.0.0",
"typescript": "4.1.3",
"unicode-regex": "3.0.0",
"unified": "9.2.0",
"vnopts": "1.0.2",
+ "wcwidth": "1.0.1",
"yaml-unist-parser": "1.3.1"
},
"devDependencies": {
@@ -127,7 +129,6 @@
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.4",
"snapshot-diff": "0.8.1",
- "strip-ansi": "6.0.0",
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
diff --git a/src/cli/format.js b/src/cli/format.js
index d9fcc8d12..e611408cb 100644
--- a/src/cli/format.js
+++ b/src/cli/format.js
@@ -1,7 +1,6 @@
"use strict";
const fs = require("fs");
-const readline = require("readline");
const path = require("path");
const chalk = require("chalk");
@@ -22,13 +21,15 @@ function diff(a, b) {
});
}
-function handleError(context, filename, error) {
+function handleError(context, filename, error, printedFilename) {
if (error instanceof errors.UndefinedParserError) {
// Can't test on CI, `isTTY()` is always false, see ./is-tty.js
/* istanbul ignore next */
- if ((context.argv.write || context.argv["ignore-unknown"]) && isTTY()) {
- readline.clearLine(process.stdout, 0);
- readline.cursorTo(process.stdout, 0, null);
+ if (
+ (context.argv.write || context.argv["ignore-unknown"]) &&
+ printedFilename
+ ) {
+ printedFilename.clear();
}
if (context.argv["ignore-unknown"]) {
return;
@@ -308,8 +309,12 @@ function formatFiles(context) {
filepath: filename,
};
+ let printedFilename;
if (isTTY()) {
- context.logger.log(filename, { newline: false });
+ printedFilename = context.logger.log(filename, {
+ newline: false,
+ clearable: true,
+ });
}
let input;
@@ -347,16 +352,15 @@ function formatFiles(context) {
result = format(context, input, options);
output = result.formatted;
} catch (error) {
- handleError(context, filename, error);
+ handleError(context, filename, error, printedFilename);
continue;
}
const isDifferent = output !== input;
- if (isTTY()) {
+ if (printedFilename) {
// Remove previously printed filename to log it with duration.
- readline.clearLine(process.stdout, 0);
- readline.cursorTo(process.stdout, 0, null);
+ printedFilename.clear();
}
if (context.argv.write) {
diff --git a/src/cli/logger.js b/src/cli/logger.js
index c899381d5..f85a8df9a 100644
--- a/src/cli/logger.js
+++ b/src/cli/logger.js
@@ -1,7 +1,33 @@
"use strict";
+const readline = require("readline");
const chalk = require("chalk");
+const stripAnsi = require("strip-ansi");
+const wcwidth = require("wcwidth");
+const countLines = (stream, text) => {
+ const columns = stream.columns || 80;
+ let lineCount = 0;
+ for (const line of stripAnsi(text).split("\n")) {
+ lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
+ }
+ return lineCount;
+};
+
+const clear = (stream, text) => () => {
+ const lineCount = countLines(stream, text);
+
+ for (let line = 0; line < lineCount; line++) {
+ if (line > 0) {
+ readline.moveCursor(stream, 0, -1);
+ }
+
+ readline.clearLine(stream, 0);
+ readline.cursorTo(stream, 0);
+ }
+};
+
+const emptyLogResult = { clear() {} };
function createLogger(logLevel) {
return {
warn: createLogFunc("warn", "yellow"),
@@ -12,14 +38,26 @@ function createLogger(logLevel) {
function createLogFunc(loggerName, color) {
if (!shouldLog(loggerName)) {
- return () => {};
+ return () => emptyLogResult;
}
const prefix = color ? `[${chalk[color](loggerName)}] ` : "";
- return function (message, opts) {
- opts = { newline: true, ...opts };
- const stream = process[loggerName === "log" ? "stdout" : "stderr"];
- stream.write(message.replace(/^/gm, prefix) + (opts.newline ? "\n" : ""));
+ const stream = process[loggerName === "log" ? "stdout" : "stderr"];
+
+ return (message, options) => {
+ options = {
+ newline: true,
+ clearable: false,
+ ...options,
+ };
+ message = message.replace(/^/gm, prefix) + (options.newline ? "\n" : "");
+ stream.write(message);
+
+ if (options.clearable) {
+ return {
+ clear: clear(stream, message),
+ };
+ }
};
}
diff --git a/yarn.lock b/yarn.lock
index 5e988ac5a..591822cc6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2381,6 +2381,11 @@ cliui@^6.0.0:
strip-ansi "^6.0.0"
wrap-ansi "^6.2.0"
+clone@^1.0.2:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
+ integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4=
+
co@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
@@ -2731,6 +2736,13 @@ deepmerge@^4.2.2:
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==
+defaults@^1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
+ integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=
+ dependencies:
+ clone "^1.0.2"
+
define-properties@^1.1.2, define-properties@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
@@ -3055,6 +3067,7 @@ eslint-plugin-jest@24.1.3:
"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
+ uid ""
eslint-plugin-react@7.22.0:
version "7.22.0"
@@ -7280,6 +7293,13 @@ watchpack@^2.0.0:
glob-to-regexp "^0.4.1"
graceful-fs "^4.1.2"
+wcwidth@1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"
+ integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=
+ dependencies:
+ defaults "^1.0.3"
+
webidl-conversions@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
From 2a157bf7cb859c562c95acc3e7e999d9c514ba02 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Sun, 7 Feb 2021 08:52:32 +0800
Subject: [PATCH 080/237] CLI: Print error message when `--find-config-path`
can't find config file (#10208)
---
changelog_unreleased/cli/10208.md | 11 +++++++++++
src/cli/core.js | 7 +++----
.../__tests__/__snapshots__/config-resolution.js.snap | 7 +++++--
tests_integration/__tests__/config-resolution.js | 2 +-
4 files changed, 20 insertions(+), 7 deletions(-)
create mode 100644 changelog_unreleased/cli/10208.md
diff --git a/changelog_unreleased/cli/10208.md b/changelog_unreleased/cli/10208.md
new file mode 100644
index 000000000..c8dac1692
--- /dev/null
+++ b/changelog_unreleased/cli/10208.md
@@ -0,0 +1,11 @@
+#### Print an error message when `--find-config-path` can't find config file (#10208 by @fisker)
+
+```console
+# Prettier stable
+$ prettier --find-config-path /prettier.js
+# Silently failed
+
+# Prettier main
+$ prettier --find-config-path /prettier.js
+[error] Can not find configure file for "/prettier.js"
+```
diff --git a/src/cli/core.js b/src/cli/core.js
index c42304e48..0beffc60c 100644
--- a/src/cli/core.js
+++ b/src/cli/core.js
@@ -17,13 +17,12 @@ const { createDetailedUsage, createUsage } = require("./usage");
const { createLogger } = require("./logger");
function logResolvedConfigPathOrDie(context) {
- const configFile = prettier.resolveConfigFile.sync(
- context.argv["find-config-path"]
- );
+ const file = context.argv["find-config-path"];
+ const configFile = prettier.resolveConfigFile.sync(file);
if (configFile) {
context.logger.log(path.relative(process.cwd(), configFile));
} else {
- process.exit(1);
+ throw new Error(`Can not find configure file for "${file}"`);
}
}
diff --git a/tests_integration/__tests__/__snapshots__/config-resolution.js.snap b/tests_integration/__tests__/__snapshots__/config-resolution.js.snap
index 526868ace..fa4770760 100644
--- a/tests_integration/__tests__/__snapshots__/config-resolution.js.snap
+++ b/tests_integration/__tests__/__snapshots__/config-resolution.js.snap
@@ -106,9 +106,12 @@ exports[`accepts configuration from --config (stdout) 1`] = `
exports[`accepts configuration from --config (write) 1`] = `Array []`;
-exports[`prints nothing when no file found with --find-config-path (stderr) 1`] = `""`;
+exports[`prints error message when no file found with --find-config-path (stderr) 1`] = `
+"[error] Can not find configure file for \\"..\\"
+"
+`;
-exports[`prints nothing when no file found with --find-config-path (write) 1`] = `Array []`;
+exports[`prints error message when no file found with --find-config-path (write) 1`] = `Array []`;
exports[`resolves configuration file with --find-config-path file (stderr) 1`] = `""`;
diff --git a/tests_integration/__tests__/config-resolution.js b/tests_integration/__tests__/config-resolution.js
index e126fc0f7..10f231ebe 100644
--- a/tests_integration/__tests__/config-resolution.js
+++ b/tests_integration/__tests__/config-resolution.js
@@ -55,7 +55,7 @@ describe("resolves toml configuration file with --find-config-path file", () =>
});
});
-describe("prints nothing when no file found with --find-config-path", () => {
+describe("prints error message when no file found with --find-config-path", () => {
runPrettier("cli/config/", [
"--end-of-line",
"lf",
From 8198f40727a9db7b1039b0af19824d022ee638ca Mon Sep 17 00:00:00 2001
From: Cyrille David
Date: Sun, 7 Feb 2021 01:58:44 +0100
Subject: [PATCH 081/237] handlebars: Split text content on multiple lines
(#10179)
Co-authored-by: fisker Cheung
---
changelog_unreleased/handlebars/10179.md | 20 ++++
src/language-handlebars/clean.js | 5 +-
src/language-handlebars/printer-glimmer.js | 29 +++++-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 3 +-
.../__snapshots__/jsfmt.spec.js.snap | 63 ++++++------
.../__snapshots__/jsfmt.spec.js.snap | 12 +--
.../newline/__snapshots__/jsfmt.spec.js.snap | 20 +---
.../__snapshots__/jsfmt.spec.js.snap | 36 +++----
tests/handlebars/text-wrap/test.hbs | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 99 ++++++++++++-------
11 files changed, 180 insertions(+), 115 deletions(-)
create mode 100644 changelog_unreleased/handlebars/10179.md
diff --git a/changelog_unreleased/handlebars/10179.md b/changelog_unreleased/handlebars/10179.md
new file mode 100644
index 000000000..ad2fb046b
--- /dev/null
+++ b/changelog_unreleased/handlebars/10179.md
@@ -0,0 +1,20 @@
+#### Split text content on multiple lines (#10179 by @dcyriller)
+
+
+```handlebars
+{{!-- Input --}}
+
+ A long enough string to trigger a line break that would prevent wrapping more and more.
+
+
+{{!-- Prettier stable --}}
+
+ A long enough string to trigger a line break that would prevent wrapping more and more.
+
+
+{{!-- Prettier main --}}
+
+ A long enough string to trigger a line break that would prevent wrapping more
+ and more.
+
+```
diff --git a/src/language-handlebars/clean.js b/src/language-handlebars/clean.js
index 2ded535ca..7c3e12721 100644
--- a/src/language-handlebars/clean.js
+++ b/src/language-handlebars/clean.js
@@ -1,13 +1,13 @@
"use strict";
function clean(ast, newNode /*, parent*/) {
- // (Glimmer/HTML) ignore TextNode whitespace
+ // (Glimmer/HTML) ignore TextNode
if (ast.type === "TextNode") {
const trimmed = ast.chars.trim();
if (!trimmed) {
return null;
}
- newNode.chars = trimmed;
+ newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
}
// `class` is reformatted
@@ -15,6 +15,7 @@ function clean(ast, newNode /*, parent*/) {
delete newNode.value;
}
}
+
clean.ignoredProperties = new Set(["loc", "selfClosing"]);
module.exports = clean;
diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js
index fccfa2dea..abed3bfbe 100644
--- a/src/language-handlebars/printer-glimmer.js
+++ b/src/language-handlebars/printer-glimmer.js
@@ -1,7 +1,18 @@
"use strict";
const {
- builders: { dedent, group, hardline, ifBreak, indent, join, line, softline },
+ builders: {
+ dedent,
+ fill,
+ group,
+ hardline,
+ ifBreak,
+ indent,
+ join,
+ line,
+ softline,
+ },
+ utils: { getDocParts },
} = require("../document");
const { isNonEmptyArray, replaceEndOfLineWith } = require("../common/util");
@@ -282,7 +293,7 @@ function print(path, options, print) {
text = text.replace(trailingWhitespacesRE, "");
}
- return [...leadBreaks, text, ...trailBreaks];
+ return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
}
const maxLineBreaksToPreserve = 2;
@@ -345,9 +356,13 @@ function print(path, options, print) {
trailingSpace = "";
}
+ text = text
+ .replace(/^[\t\n\f\r ]+/g, leadingSpace)
+ .replace(/[\t\n\f\r ]+$/, trailingSpace);
+
return [
...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve),
- text.replace(/^\s+/g, leadingSpace).replace(/\s+$/, trailingSpace),
+ fill(getTextValueParts(text)),
...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve),
];
}
@@ -628,6 +643,14 @@ function printInverse(path, print, options) {
/* TextNode print helpers */
+function getTextValueParts(value) {
+ return getDocParts(join(line, splitByHtmlWhitespace(value)));
+}
+
+function splitByHtmlWhitespace(string) {
+ return string.split(/[\t\n\f\r ]+/);
+}
+
function getCurrentAttributeName(path) {
for (let depth = 0; depth < 2; depth++) {
const parentNode = path.getParentNode(depth);
diff --git a/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
index f4ba1e1ea..dd66782d2 100644
--- a/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
@@ -399,8 +399,7 @@ printWidth: 80
c
{{else}}
{{#if c}}
- a
- b
+ a b
c
@@ -408,8 +407,7 @@ printWidth: 80
a
- b
- c
+ b c
{{/if}}
{{~#if someCondition~}}
diff --git a/tests/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap
index a4ede7862..7d36706bc 100644
--- a/tests/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap
@@ -67,7 +67,8 @@ printWidth: 80
- A long enough string to trigger a line break that would prevent wrapping more and more.
+ A long enough string to trigger a line break that would prevent wrapping more
+ and more.
diff --git a/tests/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap
index 5cb12c015..a9d44a35b 100644
--- a/tests/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap
@@ -126,9 +126,8 @@ sometimes{{nogaps}}areimportant
=====================================output=====================================
- Hi {{firstName}} {{
- lastName
- }} , welcome!
+ Hi {{firstName}} {{lastName}} ,
+ welcome!
{{#component propA}}
for {{propB}} do {{propC}} f
@@ -152,25 +151,31 @@ sometimes{{nogaps}}areimportant
hey
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
@@ -178,10 +183,8 @@ hey
{{name}}
-Some sentence with {{dynamic
-}} expressions.
-
-sometimes{{nogaps
+Some sentence with {{dynamic}}
+expressions. sometimes{{nogaps
}}areimportant
@@ -459,21 +462,27 @@ sometimes{{nogaps}}areimportant
hey
-
Click here! Click here! Click here! Click here! Click here! Click here!
+
Click here! Click here! Click
+ here! Click here! Click here! Click
+ here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here! Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click
+ here! Click here! Click here! Click
+ here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click
+ here! Click here! Click here! Click
+ here!
+ Click here! Click here! Click
+ here! Click here! Click here! Click
+ here!
@@ -482,9 +491,7 @@ hey
Some sentence with
{{dynamic}}
-expressions.
-
-sometimes{{nogaps
+expressions. sometimes{{nogaps
}}areimportant
{{name}}
@@ -632,7 +639,7 @@ printWidth: 40
=====================================input======================================
β
β
=====================================output=====================================
-
β
β
+
β
β
================================================================================
`;
@@ -684,7 +691,7 @@ printWidth: 40
=====================================input======================================
β
β
=====================================output=====================================
-
β
β
+
β
β
================================================================================
`;
diff --git a/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
index c5aadaabb..8ef3442e7 100644
--- a/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/mustache-statement/__snapshots__/jsfmt.spec.js.snap
@@ -496,11 +496,9 @@ another non-escaped mustache:
=====================================output=====================================
an escaped mustache:
-\\{{my-component}}
-a non-escaped mustache:
+\\{{my-component}} a non-escaped mustache:
\\\\{{my-component}}
-another non-escaped mustache:
-\\\\\\{{my-component}}
+another non-escaped mustache: \\\\\\{{my-component}}
================================================================================
`;
@@ -519,10 +517,8 @@ another non-escaped mustache:
=====================================output=====================================
an escaped mustache:
-\\{{my-component}}
-a non-escaped mustache:
+\\{{my-component}} a non-escaped mustache:
\\\\{{my-component}}
-another non-escaped mustache:
-\\\\\\{{my-component}}
+another non-escaped mustache: \\\\\\{{my-component}}
================================================================================
`;
diff --git a/tests/handlebars/newline/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/newline/__snapshots__/jsfmt.spec.js.snap
index afb2f0335..9a1ed8e66 100644
--- a/tests/handlebars/newline/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/newline/__snapshots__/jsfmt.spec.js.snap
@@ -82,27 +82,17 @@ printWidth: 80
Ember.js Guides
- .
- This documentation will take you from total beginner to Ember expert.
+ . This documentation will take you from total beginner to Ember expert.
{{! newlines text }}
- hi
- there
- how
-
- are you
-
-
- are you fine today?
+ hi there how are you are you fine today?
{{! newlines text spaced }}
- space above
-
- space below
+ space above space below
{{! newlines elems spaced }}
@@ -123,9 +113,7 @@ printWidth: 80
there
- how
-
- are
+ how are
you
diff --git a/tests/handlebars/text-wrap/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/text-wrap/__snapshots__/jsfmt.spec.js.snap
index 6b196b202..dbd892589 100644
--- a/tests/handlebars/text-wrap/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/text-wrap/__snapshots__/jsfmt.spec.js.snap
@@ -58,7 +58,7 @@ printWidth: 80
- First
@@ -155,7 +155,8 @@ printWidth: 80
=====================================output=====================================
{{! Wrapping text }}
- Some text that would need to wrap on to a new line in order to display correctly and nicely
+ Some text that would need to wrap on to a new line in order to display
+ correctly and nicely
{{! Wrapping tags }}
@@ -221,7 +222,8 @@ printWidth: 80
before
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis lorem.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis
+ lorem.
after
@@ -272,7 +274,7 @@ printWidth: 80
- First
+ First
Second
@@ -281,17 +283,20 @@ printWidth: 80
{{! leading whitespace }}
- First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
+ Twelfth Thirteenth Fourteenth
{{! trailing whitespace }}
- First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
+ Twelfth Thirteenth Fourteenth
{{! no leading or trailing whitespace }}
- First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
+ Twelfth Thirteenth Fourteenth
{{! translation leave text around tag }}
@@ -299,8 +304,7 @@ printWidth: 80
First
- ,
- (
+ , (
Second
@@ -311,8 +315,7 @@ printWidth: 80
First second third fourth fifth sixth seventh
- ,
- (
+ , (
Second
@@ -358,7 +361,8 @@ printWidth: 80
Before
- {"Enough text to make this element wrap on to multiple lines when formatting"}
+ {"Enough text to make this element wrap on to multiple lines when
+ formatting"}
After
@@ -367,12 +371,10 @@ printWidth: 80
Before{" "}
- {
- "Enough text to make this element wrap on to multiple lines when formatting"
- }
+ { "Enough text to make this element wrap on to multiple lines when
+ formatting" }
- {" "}
- After
+ {" "} After
{{! dont preserve blank lines when contains text }}
diff --git a/tests/handlebars/text-wrap/test.hbs b/tests/handlebars/text-wrap/test.hbs
index 449053348..c153f5ba5 100644
--- a/tests/handlebars/text-wrap/test.hbs
+++ b/tests/handlebars/text-wrap/test.hbs
@@ -50,7 +50,7 @@
- First
diff --git a/tests/handlebars/whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/whitespace/__snapshots__/jsfmt.spec.js.snap
index a8fdb2834..0ec653cc1 100644
--- a/tests/handlebars/whitespace/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/whitespace/__snapshots__/jsfmt.spec.js.snap
@@ -118,9 +118,8 @@ hey
=====================================output=====================================
- Hi {{firstName}} {{
- lastName
- }} , welcome!
+ Hi {{firstName}} {{lastName}} ,
+ welcome!
{{#component propA}}
for {{propB}} do {{propC}} f
@@ -184,25 +183,31 @@ Click here! Click here! Click here! Click here! Click here! Click here!
=====================================output=====================================
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
- Click here! Click here! Click here! Click here! Click here! Click here!
+ Click here! Click here! Click here!
+ Click here! Click here! Click here!
@@ -261,11 +266,16 @@ printWidth: 40
We are a cooperative
- , one of the few seed companies so organized
- in the United States. Because we do not have an individual owner or beneficiary,
- profit is not our primary goal. Consumers own 60% of the cooperative and worker
- members 40%. Consumer and worker members share proportionately in the cooperativeβs
- profits through our annual patronage dividends.
+ , one of the few seed companies so
+ organized in the United States.
+ Because we do not have an individual
+ owner or beneficiary, profit is not
+ our primary goal. Consumers own 60% of
+ the cooperative and worker members
+ 40%. Consumer and worker members share
+ proportionately in the cooperativeβs
+ profits through our annual patronage
+ dividends.
================================================================================
`;
@@ -296,33 +306,51 @@ conubia nostra, per inceptos himenaeos. Donec in ornare velit.
=====================================output=====================================
{{! TO FIX }}
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue
-vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim.
-Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh.
-Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui.
-Sed eu scelerisque neque. Donec
+ Lorem ipsum dolor sit amet,
+ consectetur adipiscing elit. Fusce
+ cursus massa vel augue vestibulum
+ facilisis in porta turpis. Ut faucibus
+ lectus sit amet urna consectetur
+ dignissim. Sam vitae neque quis ex
+ dapibus faucibus at sed ligula. Nulla
+ sit amet aliquet nibh. Vestibulum at
+ congue mi. Suspendisse vitae odio
+ vitae massa hendrerit mattis sed eget
+ dui. Sed eu scelerisque neque. Donec
maximus
- rhoncus pellentesque. Aenean purus turpis, vehicula
-euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per
-conubia nostra, per inceptos himenaeos. Donec in ornare velit.
+ rhoncus pellentesque. Aenean purus
+ turpis, vehicula euismod ante vel,
+ ultricies eleifend dui. Class aptent
+ taciti sociosqu ad litora torquent per
+ conubia nostra, per inceptos
+ himenaeos. Donec in ornare velit.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue
-vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim.
-Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh.
-Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui.
-Sed eu scelerisque neque. Donec
+ Lorem ipsum dolor sit amet,
+ consectetur adipiscing elit. Fusce
+ cursus massa vel augue vestibulum
+ facilisis in porta turpis. Ut faucibus
+ lectus sit amet urna consectetur
+ dignissim. Sam vitae neque quis ex
+ dapibus faucibus at sed ligula. Nulla
+ sit amet aliquet nibh. Vestibulum at
+ congue mi. Suspendisse vitae odio
+ vitae massa hendrerit mattis sed eget
+ dui. Sed eu scelerisque neque. Donec
maximus
- rhoncus pellentesque. Aenean purus turpis, vehicula
-euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per
-conubia nostra, per inceptos himenaeos. Donec in ornare velit.
+ rhoncus pellentesque. Aenean purus
+ turpis, vehicula euismod ante vel,
+ ultricies eleifend dui. Class aptent
+ taciti sociosqu ad litora torquent per
+ conubia nostra, per inceptos
+ himenaeos. Donec in ornare velit.
================================================================================
`;
@@ -343,7 +371,10 @@ printWidth: 40
=====================================output=====================================
- Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error.
+ Nihil aut odit omnis. Quam maxime est
+ molestiae. Maxime dolorem dolores
+ voluptas quaerat ut qui sunt vitae
+ error.
@@ -411,10 +442,8 @@ sometimes{{nogaps}}areimportant
{{name}}
-Some sentence with {{dynamic
-}} expressions.
-
-sometimes{{nogaps
+Some sentence with {{dynamic}}
+expressions. sometimes{{nogaps
}}areimportant
From 75c6dcd6a15bed47122ced9b83820fc4b9eb26de Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Sun, 7 Feb 2021 08:59:30 +0800
Subject: [PATCH 082/237] Test: extract some code to `createSnapshot` (#10255)
---
tests_config/run_spec.js | 49 +---------
.../utils/compose-options-for-snapshot.js | 19 ----
tests_config/utils/create-snapshot.js | 93 ++++++++++++++-----
3 files changed, 77 insertions(+), 84 deletions(-)
delete mode 100644 tests_config/utils/compose-options-for-snapshot.js
diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js
index 24b9bd52f..aaf82db1a 100644
--- a/tests_config/run_spec.js
+++ b/tests_config/run_spec.js
@@ -8,9 +8,7 @@ const prettier = !TEST_STANDALONE
? require("prettier-local")
: require("prettier-standalone");
const checkParsers = require("./utils/check-parsers");
-const visualizeRange = require("./utils/visualize-range");
const createSnapshot = require("./utils/create-snapshot");
-const composeOptionsForSnapshot = require("./utils/compose-options-for-snapshot");
const visualizeEndOfLine = require("./utils/visualize-end-of-line");
const consistentEndOfLine = require("./utils/consistent-end-of-line");
const stringifyOptionsForTitle = require("./utils/stringify-options-for-title");
@@ -252,49 +250,12 @@ function runTest({
}
// All parsers have the same result, only snapshot the result from main parser
- // TODO: move this part to `createSnapshot`
- const hasEndOfLine = "endOfLine" in formatOptions;
- let codeForSnapshot = formatResult.inputWithCursor;
- let codeOffset = 0;
- let resultForSnapshot = formatResult.outputWithCursor;
- const { rangeStart, rangeEnd, cursorOffset } = formatResult.options;
-
- if (typeof rangeStart === "number" || typeof rangeEnd === "number") {
- let rangeStartWithCursor = rangeStart;
- let rangeEndWithCursor = rangeEnd;
- if (typeof cursorOffset === "number") {
- if (
- typeof rangeStartWithCursor === "number" &&
- rangeStartWithCursor > cursorOffset
- ) {
- rangeStartWithCursor += CURSOR_PLACEHOLDER.length;
- }
- if (
- typeof rangeEndWithCursor === "number" &&
- rangeEndWithCursor > cursorOffset
- ) {
- rangeEndWithCursor += CURSOR_PLACEHOLDER.length;
- }
- }
- codeForSnapshot = visualizeRange(codeForSnapshot, {
- rangeStart: rangeStartWithCursor,
- rangeEnd: rangeEndWithCursor,
- });
- codeOffset = codeForSnapshot.match(/^>?\s+1 \|/)[0].length + 1;
- }
-
- if (hasEndOfLine) {
- codeForSnapshot = visualizeEndOfLine(codeForSnapshot);
- resultForSnapshot = visualizeEndOfLine(resultForSnapshot);
- }
-
expect(
- createSnapshot(
- codeForSnapshot,
- resultForSnapshot,
- composeOptionsForSnapshot(formatResult.options, parsers),
- { codeOffset }
- )
+ createSnapshot(formatResult, {
+ parsers,
+ formatOptions,
+ CURSOR_PLACEHOLDER,
+ })
).toMatchSnapshot();
});
diff --git a/tests_config/utils/compose-options-for-snapshot.js b/tests_config/utils/compose-options-for-snapshot.js
deleted file mode 100644
index ad1f80dfd..000000000
--- a/tests_config/utils/compose-options-for-snapshot.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-
-function composeOptionsForSnapshot(baseOptions, parsers) {
- const {
- plugins,
- filepath,
- parser,
- errors,
-
- ...snapshotOptions
- } = baseOptions;
-
- return {
- ...snapshotOptions,
- parsers,
- };
-}
-
-module.exports = composeOptionsForSnapshot;
diff --git a/tests_config/utils/create-snapshot.js b/tests_config/utils/create-snapshot.js
index d700c305d..7a61acd2b 100644
--- a/tests_config/utils/create-snapshot.js
+++ b/tests_config/utils/create-snapshot.js
@@ -1,10 +1,13 @@
"use strict";
const raw = require("jest-snapshot-serializer-raw").wrap;
+const visualizeRange = require("./visualize-range");
+const visualizeEndOfLine = require("./visualize-end-of-line");
-function printSeparator(width, description = "") {
- const leftLength = Math.floor((width - description.length) / 2);
- const rightLength = width - leftLength - description.length;
+const SEPARATOR_WIDTH = 80;
+function printSeparator(description = "") {
+ const leftLength = Math.floor((SEPARATOR_WIDTH - description.length) / 2);
+ const rightLength = SEPARATOR_WIDTH - leftLength - description.length;
return "=".repeat(leftLength) + description + "=".repeat(rightLength);
}
@@ -15,31 +18,79 @@ function stringify(value) {
? `[${value.map((v) => JSON.stringify(v)).join(", ")}]`
: JSON.stringify(value);
}
+
function printOptions(options) {
- const keys = Object.keys(options).sort();
- return keys.map((key) => `${key}: ${stringify(options[key])}`).join("\n");
+ const {
+ plugins,
+ filepath,
+ errors,
+ parser,
+
+ ...snapshotOptions
+ } = options;
+
+ const keys = Object.keys(snapshotOptions).sort();
+ return keys
+ .map((key) => `${key}: ${stringify(snapshotOptions[key])}`)
+ .join("\n");
}
-function createSnapshot(input, output, options, { codeOffset }) {
- const separatorWidth = 80;
- const printWidthIndicator =
- options.printWidth > 0 && Number.isFinite(options.printWidth)
- ? [
- (codeOffset ? " ".repeat(codeOffset - 1) + "|" : "") +
- " ".repeat(options.printWidth) +
- "| printWidth",
- ]
- : [];
+function printWidthIndicator(printWidth, offset) {
+ if (!Number.isFinite(printWidth) || printWidth < 1) {
+ return "";
+ }
+
+ let before = "";
+ if (offset) {
+ before = " ".repeat(offset - 1) + "|";
+ }
+
+ return `${before}${" ".repeat(printWidth)}| printWidth`;
+}
+
+function createSnapshot(
+ formatResult,
+ { parsers, formatOptions, CURSOR_PLACEHOLDER }
+) {
+ let {
+ inputWithCursor: input,
+ outputWithCursor: output,
+ options,
+ } = formatResult;
+ let { rangeStart, rangeEnd, cursorOffset, printWidth } = options;
+
+ let codeOffset = 0;
+ if (typeof rangeStart === "number" || typeof rangeEnd === "number") {
+ if (typeof cursorOffset === "number") {
+ if (typeof rangeStart === "number" && rangeStart > cursorOffset) {
+ rangeStart += CURSOR_PLACEHOLDER.length;
+ }
+ if (typeof rangeEnd === "number" && rangeEnd > cursorOffset) {
+ rangeEnd += CURSOR_PLACEHOLDER.length;
+ }
+ }
+
+ input = visualizeRange(input, { rangeStart, rangeEnd });
+ codeOffset = input.match(/^>?\s+1 \|/)[0].length + 1;
+ }
+
+ if ("endOfLine" in formatOptions) {
+ input = visualizeEndOfLine(input);
+ output = visualizeEndOfLine(output);
+ }
+
+ const widthIndicator = printWidthIndicator(printWidth, codeOffset);
+
return raw(
[
- printSeparator(separatorWidth, "options"),
- printOptions(options),
- ...printWidthIndicator,
- printSeparator(separatorWidth, "input"),
+ printSeparator("options"),
+ printOptions({ ...options, parsers }),
+ ...(widthIndicator ? [widthIndicator] : []),
+ printSeparator("input"),
input,
- printSeparator(separatorWidth, "output"),
+ printSeparator("output"),
output,
- printSeparator(separatorWidth),
+ printSeparator(),
].join("\n")
);
}
From 22a10c55896aa83e7938abbb71bba618a2207fe7 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Sun, 7 Feb 2021 09:01:28 +0800
Subject: [PATCH 083/237] CLI: Handle `logLevel` parse error (#10207)
---
src/cli/context.js | 24 +++++++------------
src/cli/index.js | 15 +++++++++---
src/cli/logger.js | 3 ++-
.../__tests__/__snapshots__/loglevel.js.snap | 5 ++++
tests_integration/__tests__/loglevel.js | 8 +++++++
5 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/src/cli/context.js b/src/cli/context.js
index 8509dce77..7b88311ea 100644
--- a/src/cli/context.js
+++ b/src/cli/context.js
@@ -42,20 +42,14 @@ class Context {
const {
plugin: plugins,
"plugin-search-dir": pluginSearchDirs,
- } = parseArgvWithoutPlugins(
- rawArguments,
- ["plugin", "plugin-search-dir"],
- logger
- );
+ } = parseArgvWithoutPlugins(rawArguments, logger, [
+ "plugin",
+ "plugin-search-dir",
+ ]);
this.pushContextPlugins(plugins, pluginSearchDirs);
- const argv = parseArgv(
- rawArguments,
- this.detailedOptions,
- undefined,
- logger
- );
+ const argv = parseArgv(rawArguments, this.detailedOptions, logger);
this.argv = argv;
this.filePatterns = argv._.map((file) => String(file));
}
@@ -116,7 +110,7 @@ function getContextOptions(plugins, pluginSearchDirs) {
};
}
-function parseArgv(rawArguments, detailedOptions, keys, logger) {
+function parseArgv(rawArguments, detailedOptions, logger, keys) {
const minimistOptions = createMinimistOptions(detailedOptions);
let argv = minimist(rawArguments, minimistOptions);
@@ -131,12 +125,12 @@ function parseArgv(rawArguments, detailedOptions, keys, logger) {
}
const detailedOptionsWithoutPlugins = getContextOptions().detailedOptions;
-function parseArgvWithoutPlugins(rawArguments, keys, logger) {
+function parseArgvWithoutPlugins(rawArguments, logger, keys) {
return parseArgv(
rawArguments,
detailedOptionsWithoutPlugins,
- typeof keys === "string" ? [keys] : keys,
- logger
+ logger,
+ typeof keys === "string" ? [keys] : keys
);
}
diff --git a/src/cli/index.js b/src/cli/index.js
index d1517ac9f..b38f6f511 100644
--- a/src/cli/index.js
+++ b/src/cli/index.js
@@ -9,10 +9,19 @@ const prettier = require("../index");
const core = require("./core");
function run(rawArguments) {
- const logLevel = core.parseArgvWithoutPlugins(rawArguments, "loglevel")
- .loglevel;
- const logger = core.createLogger(logLevel);
+ // Create a default level logger, so we can log errors during `logLevel` parsing
+ let logger = core.createLogger();
+
try {
+ const logLevel = core.parseArgvWithoutPlugins(
+ rawArguments,
+ logger,
+ "loglevel"
+ ).loglevel;
+ if (logLevel !== logger.logLevel) {
+ logger = core.createLogger(logLevel);
+ }
+
main(rawArguments, logger);
} catch (error) {
logger.error(error.message);
diff --git a/src/cli/logger.js b/src/cli/logger.js
index f85a8df9a..88c97e820 100644
--- a/src/cli/logger.js
+++ b/src/cli/logger.js
@@ -28,8 +28,9 @@ const clear = (stream, text) => () => {
};
const emptyLogResult = { clear() {} };
-function createLogger(logLevel) {
+function createLogger(logLevel = "log") {
return {
+ logLevel,
warn: createLogFunc("warn", "yellow"),
error: createLogFunc("error", "red"),
debug: createLogFunc("debug", "blue"),
diff --git a/tests_integration/__tests__/__snapshots__/loglevel.js.snap b/tests_integration/__tests__/__snapshots__/loglevel.js.snap
index e1013f788..8e63b3cd6 100644
--- a/tests_integration/__tests__/__snapshots__/loglevel.js.snap
+++ b/tests_integration/__tests__/__snapshots__/loglevel.js.snap
@@ -13,3 +13,8 @@ Array [
},
]
`;
+
+exports[`Should use default level logger to log \`--loglevel\` error (stderr) 1`] = `
+"[error] Invalid --loglevel value. Expected \\"debug\\", \\"error\\", \\"log\\", \\"silent\\" or \\"warn\\", but received \\"a-unknown-log-level\\".
+"
+`;
diff --git a/tests_integration/__tests__/loglevel.js b/tests_integration/__tests__/loglevel.js
index 04b32154a..11280a8a9 100644
--- a/tests_integration/__tests__/loglevel.js
+++ b/tests_integration/__tests__/loglevel.js
@@ -29,6 +29,14 @@ describe("--write with --loglevel=silent doesn't log filenames", () => {
});
});
+describe("Should use default level logger to log `--loglevel` error", () => {
+ runPrettier("cli/loglevel", ["--loglevel", "a-unknown-log-level"]).test({
+ status: "non-zero",
+ write: [],
+ stdout: "",
+ });
+});
+
function runPrettierWithLogLevel(logLevel, patterns) {
const result = runPrettier("cli/loglevel", [
"--loglevel",
From cc1f0543e6fd5cf09fd82c25b393124aa5ef55ad Mon Sep 17 00:00:00 2001
From: Sosuke Suzuki
Date: Sun, 7 Feb 2021 23:53:05 +0900
Subject: [PATCH 084/237] Consistent indentations for conditional operators
(#10187)
---
changelog_unreleased/javascript/10187.md | 67 +
src/language-js/print/ternary.js | 62 +-
src/language-js/utils.js | 11 +
.../__snapshots__/jsfmt.spec.js.snap | 2140 +++++++++++++++++
tests/js/ternaries/indent-after-paren.js | 234 ++
.../as/__snapshots__/jsfmt.spec.js.snap | 102 +
tests/typescript/as/ternary.ts | 40 +
.../__snapshots__/jsfmt.spec.js.snap | 123 +
tests/typescript/ternaries/indent.ts | 50 +
tests/typescript/ternaries/jsfmt.spec.js | 1 +
10 files changed, 2828 insertions(+), 2 deletions(-)
create mode 100644 changelog_unreleased/javascript/10187.md
create mode 100644 tests/js/ternaries/indent-after-paren.js
create mode 100644 tests/typescript/as/ternary.ts
create mode 100644 tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap
create mode 100644 tests/typescript/ternaries/indent.ts
create mode 100644 tests/typescript/ternaries/jsfmt.spec.js
diff --git a/changelog_unreleased/javascript/10187.md b/changelog_unreleased/javascript/10187.md
new file mode 100644
index 000000000..30714a50e
--- /dev/null
+++ b/changelog_unreleased/javascript/10187.md
@@ -0,0 +1,67 @@
+#### Consistent indentations for conditional operators (#10187 by @sosukesuzuki)
+
+
+```ts
+// Input
+const dotNotationMemberExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+)[TSESTree.BinaryExpression];
+const callExpressionCallee = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+) as TSESTree.BinaryExpression;
+
+// Prettier stable
+const dotNotationMemberExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent)[TSESTree.BinaryExpression];
+const callExpressionCallee = (callNode.parent?.type ===
+ AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent) as TSESTree.BinaryExpression;
+
+// Prettier main
+const dotNotationMemberExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+)[TSESTree.BinaryExpression];
+const callExpressionCallee = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+) as TSESTree.BinaryExpression;
+```
diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js
index 61d47d691..ded3c4266 100644
--- a/src/language-js/print/ternary.js
+++ b/src/language-js/print/ternary.js
@@ -6,6 +6,8 @@ const {
isJsxNode,
isBlockComment,
getComments,
+ isChainElement,
+ isCallExpression,
isMemberExpression,
} = require("../utils");
const { locStart, locEnd } = require("../loc");
@@ -158,6 +160,56 @@ function printTernaryTest(path, options, print) {
return printed;
}
+const ancestorNameMap = new Map([
+ ["AssignmentExpression", "right"],
+ ["VariableDeclarator", "init"],
+ ["ReturnStatement", "argument"],
+ ["ThrowStatement", "argument"],
+ ["UnaryExpression", "argument"],
+ ["YieldExpression", "argument"],
+]);
+function shouldExtraIndentForConditionalExpression(path) {
+ const node = path.getValue();
+ if (node.type !== "ConditionalExpression") {
+ return false;
+ }
+
+ let ancestorCount = 1;
+ let ancestor = path.getParentNode(ancestorCount);
+ if (!ancestor) {
+ return false;
+ }
+ while (isChainElement(ancestor)) {
+ ancestor = path.getParentNode(++ancestorCount);
+ }
+ const checkAncestor = (node) => {
+ const name = ancestorNameMap.get(ancestor.type);
+ return ancestor[name] === node;
+ };
+
+ const parent = path.getParentNode();
+ const name = path.getName();
+
+ if (
+ ((name === "callee" && parent.type === "NewExpression") ||
+ (name === "expression" && parent.type === "TSAsExpression")) &&
+ checkAncestor(parent)
+ ) {
+ return true;
+ }
+
+ if (
+ ((name === "callee" && isCallExpression(parent)) ||
+ (name === "object" && isMemberExpression(parent)) ||
+ (name === "expression" && parent.type === "TSNonNullExpression")) &&
+ checkAncestor(path.getParentNode(ancestorCount - 1))
+ ) {
+ return true;
+ }
+
+ return false;
+}
+
/**
* The following is the shared logic for
* ternary operators, namely ConditionalExpression
@@ -313,13 +365,19 @@ function printTernary(path, options, print) {
(parent.type === "NGPipeExpression" && parent.left === node)) &&
!parent.computed;
+ const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
+
const result = maybeGroup([
printTernaryTest(path, options, print),
forceNoIndent ? parts : indent(parts),
- isConditionalExpression && breakClosingParen ? softline : "",
+ isConditionalExpression && breakClosingParen && !shouldExtraIndent
+ ? softline
+ : "",
]);
- return isParentTest ? group([indent([softline, result]), softline]) : result;
+ return isParentTest || shouldExtraIndent
+ ? group([indent([softline, result]), softline])
+ : result;
}
module.exports = { printTernary };
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index afbaa43b4..8f454752a 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -1327,6 +1327,16 @@ function getComments(node, flags, fn) {
const isNextLineEmpty = (node, { originalText }) =>
isNextLineEmptyAfterIndex(originalText, locEnd(node));
+function isChainElement(node) {
+ return (
+ node.type === "MemberExpression" ||
+ node.type === "OptionalMemberExpression" ||
+ node.type === "CallExpression" ||
+ node.type === "OptionalCallExpression" ||
+ node.type === "TSNonNullExpression"
+ );
+}
+
module.exports = {
getFunctionParameters,
iterateFunctionParametersPath,
@@ -1347,6 +1357,7 @@ module.exports = {
identity,
isBinaryish,
isBlockComment,
+ isChainElement,
isLineComment,
isPrettierIgnoreComment,
isCallExpression,
diff --git a/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap b/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
index b8fd647e7..27a6f6055 100644
--- a/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
@@ -1608,6 +1608,2146 @@ a
================================================================================
`;
+exports[`indent-after-paren.js - {"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+tabWidth: 4
+ | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo11() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo12() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+foo13 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js - {"useTabs":true,"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+tabWidth: 4
+useTabs: true
+ | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo11() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo12() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+foo13 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js - {"useTabs":true} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+useTabs: true
+ | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo11() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo12() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+foo13 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo11() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+function foo12() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo];
+}
+
+foo13 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )?.(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+ yield (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
+
+================================================================================
+`;
+
exports[`nested.js - {"tabWidth":4} format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
diff --git a/tests/js/ternaries/indent-after-paren.js b/tests/js/ternaries/indent-after-paren.js
new file mode 100644
index 000000000..35ebca828
--- /dev/null
+++ b/tests/js/ternaries/indent-after-paren.js
@@ -0,0 +1,234 @@
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+ void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+ yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+ return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+ throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+ void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+ foo.bar.baz[
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ];
+
+const decorated = (arg, ignoreRequestError) => {
+ return (
+ typeof arg === "string" ||
+ (arg && arg.valueOf && typeof arg.valueOf() === "string")
+ ? $delegate(arg, ignoreRequestError)
+ : handleAsyncOperations(arg, ignoreRequestError)
+ ).foo();
+};
diff --git a/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
index 942472481..0c5e54eb8 100644
--- a/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
@@ -333,3 +333,105 @@ function foo() {
================================================================================
`;
+
+exports[`ternary.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+function foo() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+ void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+=====================================output=====================================
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+) as Fooooooooooo;
+
+function foo() {
+ return (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ) as Fooooooooooo;
+}
+
+function foo() {
+ throw (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ) as Fooooooooooo;
+}
+
+function foo() {
+ void ((
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+ ) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+================================================================================
+`;
diff --git a/tests/typescript/as/ternary.ts b/tests/typescript/as/ternary.ts
new file mode 100644
index 000000000..723e464d6
--- /dev/null
+++ b/tests/typescript/as/ternary.ts
@@ -0,0 +1,40 @@
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+function foo() {
+ return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+ throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+ void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ ((glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
diff --git a/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..4b758daa4
--- /dev/null
+++ b/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,123 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`indent.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Foo!.foo;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)!;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)!!!!!;
+
+=====================================output=====================================
+foo = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (
+ glimseGlyphsHazardNoopsTieTie === 0 &&
+ kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Foo!.foo;
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)!;
+
+foo = (
+ coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz
+)!!!!!;
+
+================================================================================
+`;
diff --git a/tests/typescript/ternaries/indent.ts b/tests/typescript/ternaries/indent.ts
new file mode 100644
index 000000000..07e11147f
--- /dev/null
+++ b/tests/typescript/ternaries/indent.ts
@@ -0,0 +1,50 @@
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay();
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+ .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+ .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+ askTrovenaBeenaDependsRowans +
+ (glimseGlyphsHazardNoopsTieTie === 0
+ ? averredBathersBoxroomBuggyNurl
+ : anodyneCondosMalateOverateRetinol
+ ).Foo!.foo;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)!;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+ ? baaaaaaaaaaaaaaaaaaaaar
+ : baaaaaaaaaaaaaaaaaaaaaz)!!!!!;
diff --git a/tests/typescript/ternaries/jsfmt.spec.js b/tests/typescript/ternaries/jsfmt.spec.js
new file mode 100644
index 000000000..2ea3bb6eb
--- /dev/null
+++ b/tests/typescript/ternaries/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["typescript"]);
From bf3cabd2bb83d5ab5278c047d3c24c1909662276 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Mon, 8 Feb 2021 06:55:46 +0800
Subject: [PATCH 085/237] Refactor: Use `fromPairs` instead of `Array#reduce`
(#10262)
* Refactor: Use `fromPairs` instead of `Array#reduce`
* Restore unrelated change
---
src/language-html/ast.js | 7 +++----
src/main/options.js | 25 ++++++++++++-------------
src/main/support.js | 20 ++++++++++----------
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/src/language-html/ast.js b/src/language-html/ast.js
index 52b709ac6..1f57014ab 100644
--- a/src/language-html/ast.js
+++ b/src/language-html/ast.js
@@ -23,10 +23,9 @@ class Node {
this[key] = cloneAndUpdateNodes(nodes, this);
if (key === "attrs") {
setNonEnumerableProperties(this, {
- attrMap: this[key].reduce((reduced, attr) => {
- reduced[attr.fullName] = attr.value;
- return reduced;
- }, Object.create(null)),
+ attrMap: fromPairs(
+ this[key].map((attr) => [attr.fullName, attr.value])
+ ),
});
}
}
diff --git a/src/main/options.js b/src/main/options.js
index a12b5bcad..7ef963850 100644
--- a/src/main/options.js
+++ b/src/main/options.js
@@ -68,19 +68,18 @@ function normalize(options, opts = {}) {
const plugin = getPlugin(rawOptions);
rawOptions.printer = plugin.printers[rawOptions.astFormat];
- const pluginDefaults = supportOptions
- .filter(
- (optionInfo) =>
- optionInfo.pluginDefaults &&
- optionInfo.pluginDefaults[plugin.name] !== undefined
- )
- .reduce(
- (reduced, optionInfo) =>
- Object.assign(reduced, {
- [optionInfo.name]: optionInfo.pluginDefaults[plugin.name],
- }),
- {}
- );
+ const pluginDefaults = fromPairs(
+ supportOptions
+ .filter(
+ (optionInfo) =>
+ optionInfo.pluginDefaults &&
+ optionInfo.pluginDefaults[plugin.name] !== undefined
+ )
+ .map((optionInfo) => [
+ optionInfo.name,
+ optionInfo.pluginDefaults[plugin.name],
+ ])
+ );
const mixedDefaults = { ...defaults, ...pluginDefaults };
diff --git a/src/main/support.js b/src/main/support.js
index a6aa0d83f..613403152 100644
--- a/src/main/support.js
+++ b/src/main/support.js
@@ -1,5 +1,6 @@
"use strict";
+const fromPairs = require("lodash/fromPairs");
const semver = {
compare: require("semver/functions/compare"),
lt: require("semver/functions/lt"),
@@ -64,16 +65,15 @@ function getSupportInfo({
}
}
- const pluginDefaults = plugins
- .filter(
- (plugin) =>
- plugin.defaultOptions &&
- plugin.defaultOptions[option.name] !== undefined
- )
- .reduce((reduced, plugin) => {
- reduced[plugin.name] = plugin.defaultOptions[option.name];
- return reduced;
- }, {});
+ const pluginDefaults = fromPairs(
+ plugins
+ .filter(
+ (plugin) =>
+ plugin.defaultOptions &&
+ plugin.defaultOptions[option.name] !== undefined
+ )
+ .map((plugin) => [plugin.name, plugin.defaultOptions[option.name]])
+ );
return { ...option, pluginDefaults };
});
From ba3930d63e41343fba1637a3cb4ceabdc839e2cf Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Mon, 8 Feb 2021 09:48:25 +0800
Subject: [PATCH 086/237] Replace `concat` in `src/document/` with array
(#10185)
---
.eslintrc.yml | 3 ---
package.json | 2 +-
src/document/doc-builders.js | 3 +++
src/document/doc-printer.js | 4 ++--
src/document/doc-utils.js | 8 ++------
5 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/.eslintrc.yml b/.eslintrc.yml
index bee112d4a..51a35b1a8 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -120,9 +120,6 @@ overrides:
prettier-internal-rules/prefer-fast-path-each: error
prettier-internal-rules/prefer-indent-if-break: error
prettier-internal-rules/prefer-is-non-empty-array: error
- - files: src/document/*.js
- rules:
- prettier-internal-rules/no-doc-builder-concat: off
- files:
- src/language-*/**/*.js
rules:
diff --git a/package.json b/package.json
index 063213466..7912cc880 100644
--- a/package.json
+++ b/package.json
@@ -150,7 +150,7 @@
"lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
"lint:changelog": "node ./scripts/lint-changelog.js",
"lint:prettier": "prettier . \"!test*\" --check",
- "lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2018 \"dist/!(bin-prettier|index|third-party).js\"",
+ "lint:dist": "eslint --no-eslintrc --no-ignore --no-inline-config --env=es6,browser --parser-options=ecmaVersion:2018 \"dist/!(bin-prettier|index|third-party).js\"",
"lint:spellcheck": "cspell \"**/*\" \".github/**/*\"",
"lint:deps": "node ./scripts/check-deps.js",
"fix": "run-s fix:eslint fix:prettier",
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index 2a26cf0e4..9747dcd18 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -211,7 +211,9 @@ const literallineWithoutBreakParent = {
const line = { type: "line" };
const softline = { type: "line", soft: true };
+// eslint-disable-next-line prettier-internal-rules/no-doc-builder-concat
const hardline = concat([hardlineWithoutBreakParent, breakParent]);
+// eslint-disable-next-line prettier-internal-rules/no-doc-builder-concat
const literalline = concat([literallineWithoutBreakParent, breakParent]);
const cursor = { type: "cursor", placeholder: Symbol("cursor") };
@@ -232,6 +234,7 @@ function join(sep, arr) {
res.push(arr[i]);
}
+ // eslint-disable-next-line prettier-internal-rules/no-doc-builder-concat
return concat(res);
}
diff --git a/src/document/doc-printer.js b/src/document/doc-printer.js
index cdcecaa93..64509a440 100644
--- a/src/document/doc-printer.js
+++ b/src/document/doc-printer.js
@@ -2,7 +2,7 @@
const { getStringWidth } = require("../common/util");
const { convertEndOfLineToChars } = require("../common/end-of-line");
-const { concat, fill, cursor, indent } = require("./doc-builders");
+const { fill, cursor, indent } = require("./doc-builders");
const { isConcat, getDocParts } = require("./doc-utils");
/** @type {Record} */
@@ -452,7 +452,7 @@ function printDocToString(doc, options) {
const firstAndSecondContentFlatCmd = [
ind,
MODE_FLAT,
- concat([content, whitespace, secondContent]),
+ [content, whitespace, secondContent],
];
const firstAndSecondContentFits = fits(
firstAndSecondContentFlatCmd,
diff --git a/src/document/doc-utils.js b/src/document/doc-utils.js
index aac57de7f..29333a4b2 100644
--- a/src/document/doc-utils.js
+++ b/src/document/doc-utils.js
@@ -1,6 +1,6 @@
"use strict";
-const { literalline, concat } = require("./doc-builders");
+const { literalline } = require("./doc-builders");
const isConcat = (doc) => Array.isArray(doc) || (doc && doc.type === "concat");
const getDocParts = (doc) => {
@@ -371,11 +371,7 @@ function normalizeDoc(doc) {
function replaceNewlinesWithLiterallines(doc) {
return mapDoc(doc, (currentDoc) =>
typeof currentDoc === "string" && currentDoc.includes("\n")
- ? concat(
- currentDoc
- .split(/(\n)/g)
- .map((v, i) => (i % 2 === 0 ? v : literalline))
- )
+ ? currentDoc.split(/(\n)/g).map((v, i) => (i % 2 === 0 ? v : literalline))
: currentDoc
);
}
From a1ba8fb812ef0ac771fcea2c458e4a7d3aebfa62 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Mon, 8 Feb 2021 09:50:43 +0800
Subject: [PATCH 087/237] Build: Add `rollup-plugin-polyfill-node` (#10249)
---
package.json | 2 +-
scripts/build/bundler.js | 10 ++-
scripts/build/config.js | 3 +
scripts/build/rollup-plugins/native-shims.js | 34 ---------
yarn.lock | 72 +++++---------------
5 files changed, 24 insertions(+), 97 deletions(-)
delete mode 100644 scripts/build/rollup-plugins/native-shims.js
diff --git a/package.json b/package.json
index 7912cc880..839c38e70 100644
--- a/package.json
+++ b/package.json
@@ -125,7 +125,7 @@
"pretty-bytes": "5.5.0",
"rimraf": "3.0.2",
"rollup": "2.38.4",
- "rollup-plugin-node-globals": "1.4.0",
+ "rollup-plugin-polyfill-node": "0.5.0",
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.4",
"snapshot-diff": "0.8.1",
diff --git a/scripts/build/bundler.js b/scripts/build/bundler.js
index 69349bb32..08d66c1e1 100644
--- a/scripts/build/bundler.js
+++ b/scripts/build/bundler.js
@@ -7,12 +7,11 @@ const webpack = require("webpack");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const rollupPluginAlias = require("@rollup/plugin-alias");
const commonjs = require("@rollup/plugin-commonjs");
-const nodeGlobals = require("rollup-plugin-node-globals");
+const rollupPluginPolyfillNode = require("rollup-plugin-polyfill-node");
const json = require("@rollup/plugin-json");
const replace = require("@rollup/plugin-replace");
const { terser } = require("rollup-plugin-terser");
const { babel } = require("@rollup/plugin-babel");
-const nativeShims = require("./rollup-plugins/native-shims");
const executable = require("./rollup-plugins/executable");
const evaluate = require("./rollup-plugins/evaluate");
const externals = require("./rollup-plugins/externals");
@@ -130,7 +129,8 @@ function getRollupConfig(bundle) {
// ignore `MIXED_EXPORTS` warn
warning.code === "MIXED_EXPORTS" ||
(warning.code === "CIRCULAR_DEPENDENCY" &&
- warning.importer.startsWith("node_modules"))
+ (warning.importer.startsWith("node_modules") ||
+ warning.importer.startsWith("polyfill-node:")))
) {
return;
}
@@ -183,8 +183,6 @@ function getRollupConfig(bundle) {
evaluate(),
json(),
rollupPluginAlias(alias),
- bundle.target === "universal" &&
- nativeShims(path.resolve(__dirname, "shims")),
nodeResolve({
extensions: [".js", ".json"],
preferBuiltins: bundle.target === "node",
@@ -199,7 +197,7 @@ function getRollupConfig(bundle) {
requireReturnsDefault: "preferred",
}),
externals(bundle.externals),
- bundle.target === "universal" && nodeGlobals(),
+ bundle.target === "universal" && rollupPluginPolyfillNode(),
babel(babelConfig),
bundle.minify !== false &&
bundle.target === "universal" &&
diff --git a/scripts/build/config.js b/scripts/build/config.js
index b99ecd2f1..990734255 100644
--- a/scripts/build/config.js
+++ b/scripts/build/config.js
@@ -45,6 +45,9 @@ const parsers = [
"extra.projects = prepareAndTransformProjects(":
"extra.projects = [] || prepareAndTransformProjects(",
"process.versions.node": "'999.999.999'",
+ // `rollup-plugin-polyfill-node` don't have polyfill for these modules
+ 'require("perf_hooks")': "{}",
+ 'require("inspector")': "{}",
},
},
{
diff --git a/scripts/build/rollup-plugins/native-shims.js b/scripts/build/rollup-plugins/native-shims.js
deleted file mode 100644
index b05ac7d76..000000000
--- a/scripts/build/rollup-plugins/native-shims.js
+++ /dev/null
@@ -1,34 +0,0 @@
-"use strict";
-
-const fs = require("fs");
-const path = require("path");
-const builtins = require("builtin-modules");
-
-const EMPTY = "export default {};";
-const PREFIX = "\0shim:";
-
-module.exports = function (dir) {
- return {
- resolveId(importee) {
- if (importee.startsWith(PREFIX)) {
- return importee;
- }
-
- if (/\0/.test(importee) || !builtins.includes(importee)) {
- return null;
- }
-
- const shim = path.resolve(dir, importee + ".mjs");
- if (fs.existsSync(shim)) {
- return shim;
- }
- return PREFIX + importee;
- },
-
- load(id) {
- if (id.startsWith(PREFIX)) {
- return EMPTY;
- }
- },
- };
-};
diff --git a/yarn.lock b/yarn.lock
index 591822cc6..585e07f64 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1365,6 +1365,15 @@
magic-string "^0.25.7"
resolve "^1.17.0"
+"@rollup/plugin-inject@^4.0.0":
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-4.0.2.tgz#55b21bb244a07675f7fdde577db929c82fc17395"
+ integrity sha512-TSLMA8waJ7Dmgmoc8JfPnwUwVZgLjjIAM6MqeIFqPO2ODK36JqE0Cf2F54UTgCUuW8da93Mvoj75a6KAVWgylw==
+ dependencies:
+ "@rollup/pluginutils" "^3.0.4"
+ estree-walker "^1.0.1"
+ magic-string "^0.25.5"
+
"@rollup/plugin-json@4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
@@ -1392,7 +1401,7 @@
"@rollup/pluginutils" "^3.1.0"
magic-string "^0.25.7"
-"@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0":
+"@rollup/pluginutils@^3.0.4", "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
@@ -1814,11 +1823,6 @@ acorn-walk@^7.1.1:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
-acorn@^5.7.3:
- version "5.7.4"
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
- integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
-
acorn@^7.1.1, acorn@^7.4.0:
version "7.4.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c"
@@ -2222,11 +2226,6 @@ bser@2.1.1:
dependencies:
node-int64 "^0.4.0"
-buffer-es6@^4.9.3:
- version "4.9.3"
- resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404"
- integrity sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ=
-
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
@@ -3225,16 +3224,6 @@ estraverse@^5.2.0:
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880"
integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==
-estree-walker@^0.5.2:
- version "0.5.2"
- resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39"
- integrity sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig==
-
-estree-walker@^0.6.1:
- version "0.6.1"
- resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
- integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
-
estree-walker@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
@@ -5095,14 +5084,7 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"
-magic-string@^0.22.5:
- version "0.22.5"
- resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e"
- integrity sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w==
- dependencies:
- vlq "^0.2.2"
-
-magic-string@^0.25.7:
+magic-string@^0.25.5, magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
@@ -5847,11 +5829,6 @@ pretty-format@^26.6.2:
ansi-styles "^4.0.0"
react-is "^17.0.1"
-process-es6@^0.11.6:
- version "0.11.6"
- resolved "https://registry.yarnpkg.com/process-es6/-/process-es6-0.11.6.tgz#c6bb389f9a951f82bd4eb169600105bd2ff9c778"
- integrity sha1-xrs4n5qVH4K9TrFpYAEFvS/5x3g=
-
progress@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
@@ -6220,17 +6197,12 @@ rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
-rollup-plugin-node-globals@1.4.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/rollup-plugin-node-globals/-/rollup-plugin-node-globals-1.4.0.tgz#5e1f24a9bb97c0ef51249f625e16c7e61b7c020b"
- integrity sha512-xRkB+W/m1KLIzPUmG0ofvR+CPNcvuCuNdjVBVS7ALKSxr3EDhnzNceGkGi1m8MToSli13AzKFYH4ie9w3I5L3g==
+rollup-plugin-polyfill-node@0.5.0:
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.5.0.tgz#afa87f9105233963b89b0f74a2baaac53ab8a232"
+ integrity sha512-CYPf4vKeZG5w/Ut7TR1lEMKiBT2pHfj1RLnk92whXKFtT8IGkm+TydwgDNpgTXBCI4V528YijyFVMz4dKcR3AA==
dependencies:
- acorn "^5.7.3"
- buffer-es6 "^4.9.3"
- estree-walker "^0.5.2"
- magic-string "^0.22.5"
- process-es6 "^0.11.6"
- rollup-pluginutils "^2.3.1"
+ "@rollup/plugin-inject" "^4.0.0"
rollup-plugin-terser@7.0.2:
version "7.0.2"
@@ -6242,13 +6214,6 @@ rollup-plugin-terser@7.0.2:
serialize-javascript "^4.0.0"
terser "^5.0.0"
-rollup-pluginutils@^2.3.1:
- version "2.8.2"
- resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e"
- integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==
- dependencies:
- estree-walker "^0.6.1"
-
rollup@2.38.4:
version "2.38.4"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.38.4.tgz#1b84ea8728c73b1a00a6a6e9c630ec8c3fe48cea"
@@ -7245,11 +7210,6 @@ vfile@^4.0.0:
unist-util-stringify-position "^2.0.0"
vfile-message "^2.0.0"
-vlq@^0.2.2:
- version "0.2.3"
- resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"
- integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==
-
vnopts@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/vnopts/-/vnopts-1.0.2.tgz#f6a331473de0179d1679112cc090572b695202f7"
From 64628a1e3882bac4c29100b9a42629371d798ed5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 8 Feb 2021 05:56:11 +0000
Subject: [PATCH 088/237] Build(deps-dev): Bump webpack from 5.20.2 to 5.21.2
in /website (#10270)
---
website/package.json | 2 +-
website/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/website/package.json b/website/package.json
index a4598fc18..f8e7bbf67 100644
--- a/website/package.json
+++ b/website/package.json
@@ -23,7 +23,7 @@
"docusaurus": "1.14.6",
"js-yaml": "4.0.0",
"svgo": "1.3.2",
- "webpack": "5.20.2",
+ "webpack": "5.21.2",
"webpack-cli": "4.5.0"
}
}
diff --git a/website/yarn.lock b/website/yarn.lock
index 663c24f8b..1e628b8af 100644
--- a/website/yarn.lock
+++ b/website/yarn.lock
@@ -7365,10 +7365,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.2:
- version "5.20.2"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.2.tgz#55a6e461e2a6e1ca7467a419886acf9c7b052d5f"
- integrity sha512-gGPip54KK7DznaaPHVuNGqym3LAXXL+bPkZ9SlLTCdHmmk+m5x+D4UZdhWvw32CMahYlZwZYPsioFIw36/txYQ==
+webpack@5.21.2:
+ version "5.21.2"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.2.tgz#647507e50d3637695be28af58a6a8246050394e7"
+ integrity sha512-xHflCenx+AM4uWKX71SWHhxml5aMXdy2tu/vdi4lClm7PADKxlyDAFFN1rEFzNV0MAoPpHtBeJnl/+K6F4QBPg==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From fda0c4c87ad0c0334be360ac41f59fa42f378579 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 8 Feb 2021 06:16:44 +0000
Subject: [PATCH 089/237] Build(deps): Bump actions/cache from v2 to v2.1.4
(#10272)
---
.github/workflows/prod-test.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml
index 2776158f5..631e52024 100644
--- a/.github/workflows/prod-test.yml
+++ b/.github/workflows/prod-test.yml
@@ -23,7 +23,7 @@ jobs:
- name: Cache Build Results
id: build-cache
- uses: actions/cache@v2
+ uses: actions/cache@v2.1.4
with:
path: .cache
key: v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-${{ github.ref }}-
From 1d805826ec9b0da0195cab1c78c290e7ef23b483 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 8 Feb 2021 06:24:25 +0000
Subject: [PATCH 090/237] Build(deps-dev): Bump rollup from 2.38.4 to 2.38.5
(#10271)
---
package.json | 2 +-
yarn.lock | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
index 839c38e70..3f4eab4c4 100644
--- a/package.json
+++ b/package.json
@@ -124,7 +124,7 @@
"prettier": "2.2.1",
"pretty-bytes": "5.5.0",
"rimraf": "3.0.2",
- "rollup": "2.38.4",
+ "rollup": "2.38.5",
"rollup-plugin-polyfill-node": "0.5.0",
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.4",
diff --git a/yarn.lock b/yarn.lock
index 585e07f64..3b1198f71 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3066,7 +3066,6 @@ eslint-plugin-jest@24.1.3:
"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
- uid ""
eslint-plugin-react@7.22.0:
version "7.22.0"
@@ -6214,10 +6213,10 @@ rollup-plugin-terser@7.0.2:
serialize-javascript "^4.0.0"
terser "^5.0.0"
-rollup@2.38.4:
- version "2.38.4"
- resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.38.4.tgz#1b84ea8728c73b1a00a6a6e9c630ec8c3fe48cea"
- integrity sha512-B0LcJhjiwKkTl79aGVF/u5KdzsH8IylVfV56Ut6c9ouWLJcUK17T83aZBetNYSnZtXf2OHD4+2PbmRW+Fp5ulg==
+rollup@2.38.5:
+ version "2.38.5"
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.38.5.tgz#be41ad4fe0c103a8794377afceb5f22b8f603d6a"
+ integrity sha512-VoWt8DysFGDVRGWuHTqZzT02J0ASgjVq/hPs9QcBOGMd7B+jfTr/iqMVEyOi901rE3xq+Deq66GzIT1yt7sGwQ==
optionalDependencies:
fsevents "~2.3.1"
From 6a55d918de006ee928a1ebf854e71718f97f3e4b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 8 Feb 2021 09:26:34 +0000
Subject: [PATCH 091/237] Build(deps-dev): Bump webpack from 5.20.2 to 5.21.2
(#10268)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 3f4eab4c4..15e9eb75d 100644
--- a/package.json
+++ b/package.json
@@ -132,7 +132,7 @@
"synchronous-promise": "2.0.15",
"tempy": "1.0.0",
"terser-webpack-plugin": "5.1.1",
- "webpack": "5.20.2"
+ "webpack": "5.21.2"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
diff --git a/yarn.lock b/yarn.lock
index 3b1198f71..856095221 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7277,10 +7277,10 @@ webpack-sources@^2.1.1:
source-list-map "^2.0.1"
source-map "^0.6.1"
-webpack@5.20.2:
- version "5.20.2"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.2.tgz#55a6e461e2a6e1ca7467a419886acf9c7b052d5f"
- integrity sha512-gGPip54KK7DznaaPHVuNGqym3LAXXL+bPkZ9SlLTCdHmmk+m5x+D4UZdhWvw32CMahYlZwZYPsioFIw36/txYQ==
+webpack@5.21.2:
+ version "5.21.2"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.2.tgz#647507e50d3637695be28af58a6a8246050394e7"
+ integrity sha512-xHflCenx+AM4uWKX71SWHhxml5aMXdy2tu/vdi4lClm7PADKxlyDAFFN1rEFzNV0MAoPpHtBeJnl/+K6F4QBPg==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
From 2245e9390066d7d227be93a7da996b685a98f03d Mon Sep 17 00:00:00 2001
From: Anna Shishlyakova
Date: Mon, 8 Feb 2021 21:46:00 +0100
Subject: [PATCH 092/237] Don't skip file paths contains special words like
`constructor` (#10256)
Co-authored-by: fisker
Co-authored-by: Georgii Dolzhykov
---
changelog_unreleased/cli/10256.md | 14 ++++++++++++++
src/cli/expand-patterns.js | 19 +++++++------------
.../__snapshots__/patterns-glob.js.snap | 9 +++++++++
tests_integration/__tests__/patterns-glob.js | 7 +++++++
.../constructor/should-be-formatted.js | 1 +
5 files changed, 38 insertions(+), 12 deletions(-)
create mode 100644 changelog_unreleased/cli/10256.md
create mode 100644 tests_integration/cli/patterns-glob/fixtures-5/constructor/should-be-formatted.js
diff --git a/changelog_unreleased/cli/10256.md b/changelog_unreleased/cli/10256.md
new file mode 100644
index 000000000..1ac6e1126
--- /dev/null
+++ b/changelog_unreleased/cli/10256.md
@@ -0,0 +1,14 @@
+#### Don't skip file paths containing special words like `constructor` (#10256 by @ashlkv)
+
+Directories whose names happened to coincide with the properties of `Object.prototype` were ignored by Prettier CLI because of a classic bug (introduced in Prettier 2.0.0) with object properties not being checked for being own.
+
+
+```sh
+# Prettier stable
+$ prettier 'js/constructor/*.js' --write
+[error] No matching files. Patterns: js/constructor/*.js
+
+# Prettier main
+prettier 'js/constructor/*.js' --write
+js/constructor/test.js 42ms
+```
diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js
index b840ce723..b8f3bbc55 100644
--- a/src/cli/expand-patterns.js
+++ b/src/cli/expand-patterns.js
@@ -46,18 +46,13 @@ function* expandPatterns(context) {
*/
function* expandPatternsInternal(context) {
// Ignores files in version control systems directories and `node_modules`
- const silentlyIgnoredDirs = {
- ".git": true,
- ".svn": true,
- ".hg": true,
- node_modules: context.argv["with-node-modules"] !== true,
- };
-
+ const silentlyIgnoredDirs = [".git", ".svn", ".hg"];
+ if (context.argv["with-node-modules"] !== true) {
+ silentlyIgnoredDirs.push("node_modules");
+ }
const globOptions = {
dot: true,
- ignore: Object.entries(silentlyIgnoredDirs)
- .filter(([, ignored]) => ignored)
- .map(([dir]) => "**/" + dir),
+ ignore: silentlyIgnoredDirs.map((dir) => "**/" + dir),
};
let supportedFilesGlob;
@@ -157,13 +152,13 @@ const errorMessages = {
/**
* @param {string} absolutePath
* @param {string} cwd
- * @param {Record} ignoredDirectories
+ * @param {string[]} ignoredDirectories
*/
function containsIgnoredPathSegment(absolutePath, cwd, ignoredDirectories) {
return path
.relative(cwd, absolutePath)
.split(path.sep)
- .some((dir) => ignoredDirectories[dir]);
+ .some((dir) => ignoredDirectories.includes(dir));
}
/**
diff --git a/tests_integration/__tests__/__snapshots__/patterns-glob.js.snap b/tests_integration/__tests__/__snapshots__/patterns-glob.js.snap
index d147c39a1..d852e8b1d 100644
--- a/tests_integration/__tests__/__snapshots__/patterns-glob.js.snap
+++ b/tests_integration/__tests__/__snapshots__/patterns-glob.js.snap
@@ -117,3 +117,12 @@ exports[`fixtures-4: Should match \`level-1.js\` (stdout) 1`] = `
`;
exports[`fixtures-4: Should match \`level-1.js\` (write) 1`] = `Array []`;
+
+exports[`should not ignore file paths contains object prototype keys (stderr) 1`] = `""`;
+
+exports[`should not ignore file paths contains object prototype keys (stdout) 1`] = `
+"constructor/should-be-formatted.js
+"
+`;
+
+exports[`should not ignore file paths contains object prototype keys (write) 1`] = `Array []`;
diff --git a/tests_integration/__tests__/patterns-glob.js b/tests_integration/__tests__/patterns-glob.js
index 34506c0b2..430a62a59 100644
--- a/tests_integration/__tests__/patterns-glob.js
+++ b/tests_integration/__tests__/patterns-glob.js
@@ -133,3 +133,10 @@ describe("fixtures-4: Should match `level-1.js` #3", () => {
status: 1,
});
});
+
+describe("should not ignore file paths contains object prototype keys", () => {
+ runPrettier("cli/patterns-glob/fixtures-5", [
+ "./constructor/should-be-formatted.js",
+ "-l",
+ ]).test({ status: 1 });
+});
diff --git a/tests_integration/cli/patterns-glob/fixtures-5/constructor/should-be-formatted.js b/tests_integration/cli/patterns-glob/fixtures-5/constructor/should-be-formatted.js
new file mode 100644
index 000000000..9c266697c
--- /dev/null
+++ b/tests_integration/cli/patterns-glob/fixtures-5/constructor/should-be-formatted.js
@@ -0,0 +1 @@
+console.log( "*");
From 03a43ae55f64142bc21591fd1c47d9dea8cb61bd Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Tue, 9 Feb 2021 11:08:14 +0200
Subject: [PATCH 093/237] Fix error thrown on expressions like `a(b => c =>
function (){})` (#10278)
---
changelog_unreleased/javascript/10278.md | 15 +++++++++++++++
src/language-js/printer-estree.js | 19 ++++++++++---------
.../function/__snapshots__/jsfmt.spec.js.snap | 18 ++++++++++++++++++
tests/js/function/issue-10277.js | 1 +
4 files changed, 44 insertions(+), 9 deletions(-)
create mode 100644 changelog_unreleased/javascript/10278.md
create mode 100644 tests/js/function/issue-10277.js
diff --git a/changelog_unreleased/javascript/10278.md b/changelog_unreleased/javascript/10278.md
new file mode 100644
index 000000000..c6e3505c6
--- /dev/null
+++ b/changelog_unreleased/javascript/10278.md
@@ -0,0 +1,15 @@
+#### Fix error thrown on expressions like `a(b => c => function (){})` (#10278 by @thorn0)
+
+Regression from v2.2.0.
+
+
+```jsx
+// Input
+a(b => c => function (){})
+
+// Prettier stable
+TypeError: Cannot read property 'length' of undefined
+
+// Prettier main
+a((b) => (c) => function () {});
+```
diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js
index f65f02ef4..e419dfcc1 100644
--- a/src/language-js/printer-estree.js
+++ b/src/language-js/printer-estree.js
@@ -340,15 +340,16 @@ function printPathNoParens(path, options, print, args) {
printTypeAnnotation(path, options, print),
];
case "FunctionDeclaration":
- case "FunctionExpression":
- return printFunctionDeclaration(
- path,
- print,
- options,
- args &&
- args.expandLastArg &&
- getCallArguments(path.getParentNode()).length > 1
- );
+ case "FunctionExpression": {
+ let expandArg = false;
+ if (args && args.expandLastArg) {
+ const parent = path.getParentNode();
+ if (isCallExpression(parent) && getCallArguments(parent).length > 1) {
+ expandArg = true;
+ }
+ }
+ return printFunctionDeclaration(path, print, options, expandArg);
+ }
case "ArrowFunctionExpression":
return printArrowFunctionExpression(path, options, print, args);
case "YieldExpression":
diff --git a/tests/js/function/__snapshots__/jsfmt.spec.js.snap b/tests/js/function/__snapshots__/jsfmt.spec.js.snap
index 5cb573c3a..64b01a8cc 100644
--- a/tests/js/function/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/function/__snapshots__/jsfmt.spec.js.snap
@@ -33,3 +33,21 @@ new (function () {})();
================================================================================
`;
+
+exports[`issue-10277.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+(fold => fold)(fmap => algebra => function doFold(v) {return algebra(fmap(doFold)(v))})
+
+=====================================output=====================================
+((fold) => fold)((fmap) => (algebra) =>
+ function doFold(v) {
+ return algebra(fmap(doFold)(v));
+ }
+);
+
+================================================================================
+`;
diff --git a/tests/js/function/issue-10277.js b/tests/js/function/issue-10277.js
new file mode 100644
index 000000000..8f8c3996f
--- /dev/null
+++ b/tests/js/function/issue-10277.js
@@ -0,0 +1 @@
+(fold => fold)(fmap => algebra => function doFold(v) {return algebra(fmap(doFold)(v))})
From 091e91e50ded2fdcf922358b7a8c919b20e4127f Mon Sep 17 00:00:00 2001
From: Cyrille David
Date: Tue, 9 Feb 2021 20:49:31 +0100
Subject: [PATCH 094/237] Handlebars printer: two small refactorings (#10285)
* Refactor generateHardlines
* Move variables
* Fix isWhitespaceOnly regex
---
src/language-handlebars/printer-glimmer.js | 26 ++++++++++++----------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js
index abed3bfbe..1bc709feb 100644
--- a/src/language-handlebars/printer-glimmer.js
+++ b/src/language-handlebars/printer-glimmer.js
@@ -32,6 +32,8 @@ const {
isWhitespaceNode,
} = require("./utils");
+const NEWLINES_TO_PRESERVE_MAX = 2;
+
// Formatter based on @glimmerjs/syntax's built-in test formatter:
// https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts
@@ -241,18 +243,20 @@ function print(path, options, print) {
return replaceEndOfLineWith(text, literalline);
}
+ const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
+ const isWhitespaceOnly = whitespacesOnlyRE.test(text);
+
if (options.htmlWhitespaceSensitivity === "strict") {
// https://infra.spec.whatwg.org/#ascii-whitespace
const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
- const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
- if (whitespacesOnlyRE.test(text)) {
+ if (isWhitespaceOnly) {
let breaks = [line];
const newlines = countNewLines(text);
if (newlines) {
- breaks = generateHardlines(newlines, 2);
+ breaks = generateHardlines(newlines);
}
if (isLastNodeOfSiblings(path)) {
@@ -271,7 +275,7 @@ function print(path, options, print) {
const leadingNewlines = countNewLines(lead);
if (leadingNewlines) {
- leadBreaks = generateHardlines(countNewLines(lead) || 1, 2);
+ leadBreaks = generateHardlines(countNewLines(lead) || 1);
}
text = text.replace(leadingWhitespacesRE, "");
@@ -283,7 +287,7 @@ function print(path, options, print) {
const trailingNewlines = countNewLines(tail);
if (trailingNewlines) {
- trailBreaks = generateHardlines(trailingNewlines || 1, 2);
+ trailBreaks = generateHardlines(trailingNewlines || 1);
if (isLastNodeOfSiblings(path)) {
trailBreaks = trailBreaks.map((hardline) => dedent(hardline));
@@ -296,10 +300,8 @@ function print(path, options, print) {
return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
}
- const maxLineBreaksToPreserve = 2;
const isFirstElement = !getPreviousNode(path);
const isLastElement = !getNextNode(path);
- const isWhitespaceOnly = !/\S/.test(text);
const lineBreaksCount = countNewLines(text);
let leadingLineBreaksCount = countLeadingNewLines(text);
@@ -316,7 +318,7 @@ function print(path, options, print) {
if (isWhitespaceOnly && lineBreaksCount) {
leadingLineBreaksCount = Math.min(
lineBreaksCount,
- maxLineBreaksToPreserve
+ NEWLINES_TO_PRESERVE_MAX
);
trailingLineBreaksCount = 0;
} else {
@@ -361,9 +363,9 @@ function print(path, options, print) {
.replace(/[\t\n\f\r ]+$/, trailingSpace);
return [
- ...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve),
+ ...generateHardlines(leadingLineBreaksCount),
fill(getTextValueParts(text)),
- ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve),
+ ...generateHardlines(trailingLineBreaksCount),
];
}
case "MustacheCommentStatement": {
@@ -680,8 +682,8 @@ function countTrailingNewLines(string) {
return countNewLines(newLines);
}
-function generateHardlines(number = 0, max = 0) {
- return new Array(Math.min(number, max)).fill(hardline);
+function generateHardlines(number = 0) {
+ return new Array(Math.min(number, NEWLINES_TO_PRESERVE_MAX)).fill(hardline);
}
/* StringLiteral print helpers */
From a55fe2d9618763686a0ed60d0bb97c13e5b71d57 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 10 Feb 2021 01:06:14 +0200
Subject: [PATCH 095/237] Add tests for #2239 (#10286)
---
.../__snapshots__/jsfmt.spec.js.snap | 21 +++++++++++++++++++
.../function-expression-issue-2239.js | 3 +++
2 files changed, 24 insertions(+)
create mode 100644 tests/js/last-argument-expansion/function-expression-issue-2239.js
diff --git a/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap b/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
index 54cf63cff..7988c9b81 100644
--- a/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
@@ -361,6 +361,27 @@ function mySagas2() {
================================================================================
`;
+exports[`function-expression-issue-2239.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+someFunctionCallWithBigArgumentsAndACallback(thisArgumentIsQuiteLong, function(cool) {
+ return cool
+})
+
+=====================================output=====================================
+someFunctionCallWithBigArgumentsAndACallback(
+ thisArgumentIsQuiteLong,
+ function (cool) {
+ return cool;
+ }
+);
+
+================================================================================
+`;
+
exports[`jsx.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
diff --git a/tests/js/last-argument-expansion/function-expression-issue-2239.js b/tests/js/last-argument-expansion/function-expression-issue-2239.js
new file mode 100644
index 000000000..d4ee56f64
--- /dev/null
+++ b/tests/js/last-argument-expansion/function-expression-issue-2239.js
@@ -0,0 +1,3 @@
+someFunctionCallWithBigArgumentsAndACallback(thisArgumentIsQuiteLong, function(cool) {
+ return cool
+})
From fd020fc9bd3c429bdbf8393df3fb03c315753633 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 10 Feb 2021 19:36:40 +0800
Subject: [PATCH 096/237] Build(deps): Bump @glimmer/syntax from 0.74.2 to
0.75.0 (#10287)
Bumps [@glimmer/syntax](https://github.com/glimmerjs/glimmer-vm) from 0.74.2 to 0.75.0.
- [Release notes](https://github.com/glimmerjs/glimmer-vm/releases)
- [Changelog](https://github.com/glimmerjs/glimmer-vm/blob/master/CHANGELOG.md)
- [Commits](https://github.com/glimmerjs/glimmer-vm/compare/v0.74.2...v0.75.0)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 28 ++++++++++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index 15e9eb75d..d7c67a086 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"@angular/compiler": "11.1.1",
"@babel/code-frame": "7.12.13",
"@babel/parser": "7.12.11",
- "@glimmer/syntax": "0.74.2",
+ "@glimmer/syntax": "0.75.0",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "4.14.2",
"angular-estree-parser": "2.3.0",
diff --git a/yarn.lock b/yarn.lock
index 856095221..b2ba8bc74 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1059,6 +1059,13 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
+"@glimmer/interfaces@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.75.0.tgz#ae8559a2ab906d7ab131741398c27f0c6dd1b0f7"
+ integrity sha512-vyIXi/e2yf3C0AfYMJQXdqwmnGOH7GxDRZ2c70UNYHoSCUtjvgyGWKc6rAXzmhRVG1YFyDzoc2wYxGYdx+MMmA==
+ dependencies:
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/reference@0.74.2":
version "0.74.2"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.2.tgz#368520445b931769bf3624591b18a2680d36aacd"
@@ -1070,13 +1077,13 @@
"@glimmer/util" "0.74.2"
"@glimmer/validator" "0.74.2"
-"@glimmer/syntax@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.74.2.tgz#84efc2555356118a4a275bb8310e261afcf9b048"
- integrity sha512-G+E2eL0xeo81zBMSkrfobejL/V4YjlAv6Uu8qubwYu/QIHj/UiyxHEMZzN1H88rWcu8iPLzTC4GzFr9Chiu2Jw==
+"@glimmer/syntax@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.75.0.tgz#eeefe5f27ba56aebce2ee09bd91de847a610dd8f"
+ integrity sha512-v+sK7lv8eAoTJmFM8MjRsUG7/8NxhrtN8F0PTUZKIpgfBBWQ5JxtWOypbFNJR3cAo8gggRduEOoELCc7b9e4/g==
dependencies:
- "@glimmer/interfaces" "0.74.2"
- "@glimmer/util" "0.74.2"
+ "@glimmer/interfaces" "0.75.0"
+ "@glimmer/util" "0.75.0"
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
@@ -1089,6 +1096,15 @@
"@glimmer/interfaces" "0.74.2"
"@simple-dom/interface" "^1.4.0"
+"@glimmer/util@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.75.0.tgz#412956227c08e1a1e11500c7bd746947056924e5"
+ integrity sha512-dngZXP0TsGPyJ2kj40TJHcVhWpkBecH6BD93pZKUEsHuXMPxQQeyCuEQBKRPcG3PMi/iHjzOqSMXROh8kyiY/Q==
+ dependencies:
+ "@glimmer/env" "0.1.7"
+ "@glimmer/interfaces" "0.75.0"
+ "@simple-dom/interface" "^1.4.0"
+
"@glimmer/validator@0.74.2":
version "0.74.2"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.2.tgz#e60f165345c7eb9e2ee3b4ed021d10ce6cbd262f"
From cf80f0a6816f763d7fd49aa59bbdf60469b4fdeb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 10 Feb 2021 19:38:20 +0800
Subject: [PATCH 097/237] Build(deps): Bump
@typescript-eslint/typescript-estree from 4.14.2 to 4.15.0 (#10280)
Bumps [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-estree) from 4.14.2 to 4.15.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/typescript-estree/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.0/packages/typescript-estree)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/package.json b/package.json
index d7c67a086..886451a05 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.75.0",
"@iarna/toml": "2.2.5",
- "@typescript-eslint/typescript-estree": "4.14.2",
+ "@typescript-eslint/typescript-estree": "4.15.0",
"angular-estree-parser": "2.3.0",
"angular-html-parser": "1.7.1",
"camelcase": "6.2.0",
diff --git a/yarn.lock b/yarn.lock
index b2ba8bc74..3933bc0d0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1641,6 +1641,11 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.2.tgz#d96da62be22dc9dc6a06647f3633815350fb3174"
integrity sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q==
+"@typescript-eslint/types@4.15.0":
+ version "4.15.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.0.tgz#3011ae1ac3299bb9a5ac56bdd297cccf679d3662"
+ integrity sha512-su4RHkJhS+iFwyqyXHcS8EGPlUVoC+XREfy5daivjLur9JP8GhvTmDipuRpcujtGC4M+GYhUOJCPDE3rC5NJrg==
+
"@typescript-eslint/typescript-estree@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f"
@@ -1655,17 +1660,16 @@
semver "^7.3.2"
tsutils "^3.17.1"
-"@typescript-eslint/typescript-estree@4.14.2":
- version "4.14.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.2.tgz#9c5ebd8cae4d7b014f890acd81e8e17f309c9df9"
- integrity sha512-ESiFl8afXxt1dNj8ENEZT12p+jl9PqRur+Y19m0Z/SPikGL6rqq4e7Me60SU9a2M28uz48/8yct97VQYaGl0Vg==
+"@typescript-eslint/typescript-estree@4.15.0":
+ version "4.15.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.0.tgz#402c86a7d2111c1f7a2513022f22a38a395b7f93"
+ integrity sha512-jG6xTmcNbi6xzZq0SdWh7wQ9cMb2pqXaUp6bUZOMsIlu5aOlxGxgE/t6L/gPybybQGvdguajXGkZKSndZJpksA==
dependencies:
- "@typescript-eslint/types" "4.14.2"
- "@typescript-eslint/visitor-keys" "4.14.2"
+ "@typescript-eslint/types" "4.15.0"
+ "@typescript-eslint/visitor-keys" "4.15.0"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
- lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"
@@ -1677,12 +1681,12 @@
"@typescript-eslint/types" "4.0.1"
eslint-visitor-keys "^2.0.0"
-"@typescript-eslint/visitor-keys@4.14.2":
- version "4.14.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.2.tgz#997cbe2cb0690e1f384a833f64794e98727c70c6"
- integrity sha512-KBB+xLBxnBdTENs/rUgeUKO0UkPBRs2vD09oMRRIkj5BEN8PX1ToXV532desXfpQnZsYTyLLviS7JrPhdL154w==
+"@typescript-eslint/visitor-keys@4.15.0":
+ version "4.15.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.0.tgz#2a07768df30c8a5673f1bce406338a07fdec38ca"
+ integrity sha512-RnDtJwOwFucWFAMjG3ghCG/ikImFJFEg20DI7mn4pHEx3vC48lIAoyjhffvfHmErRDboUPC7p9Z2il4CLb7qxA==
dependencies:
- "@typescript-eslint/types" "4.14.2"
+ "@typescript-eslint/types" "4.15.0"
eslint-visitor-keys "^2.0.0"
"@webassemblyjs/ast@1.11.0":
From f3906d84d47bb5f0142cb28ba40fc1600e77c88b Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 10 Feb 2021 13:42:06 +0200
Subject: [PATCH 098/237] =?UTF-8?q?Refactor:=20rename=20FastPath=20?=
=?UTF-8?q?=E2=86=92=20AstPath=20(#10276)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.eslintrc.yml | 2 +-
docs/plugins.md | 12 ++++++------
.../eslint-plugin-prettier-internal-rules/index.js | 2 +-
...fer-fast-path-each.js => prefer-ast-path-each.js} | 4 ++--
.../eslint-plugin-prettier-internal-rules/test.js | 2 +-
src/common/{fast-path.js => ast-path.js} | 10 +++++-----
src/language-js/comments.js | 4 ++--
src/language-js/print/angular.js | 4 ++--
src/language-js/print/jsx.js | 4 ++--
src/language-js/print/statement.js | 2 +-
src/language-js/print/ternary.js | 4 ++--
src/language-js/print/type-annotation.js | 2 +-
src/language-js/utils.js | 6 +++---
src/main/ast-to-doc.js | 8 ++++----
website/versioned_docs/version-stable/plugins.md | 12 ++++++------
15 files changed, 39 insertions(+), 39 deletions(-)
rename scripts/tools/eslint-plugin-prettier-internal-rules/{prefer-fast-path-each.js => prefer-ast-path-each.js} (86%)
rename src/common/{fast-path.js => ast-path.js} (93%)
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 51a35b1a8..d9496df3d 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -117,7 +117,7 @@ overrides:
rules:
prettier-internal-rules/no-doc-builder-concat: error
prettier-internal-rules/no-empty-flat-contents-for-if-break: error
- prettier-internal-rules/prefer-fast-path-each: error
+ prettier-internal-rules/prefer-ast-path-each: error
prettier-internal-rules/prefer-indent-if-break: error
prettier-internal-rules/prefer-is-non-empty-array: error
- files:
diff --git a/docs/plugins.md b/docs/plugins.md
index 480dd79f4..83e8ee1a5 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -177,7 +177,7 @@ The printing process works as follows:
1. `preprocess(ast: AST, options: object): AST`, if available, is called. It is passed the AST from the _parser_. The AST returned by `preprocess` will be used by Prettier. If `preprocess` is not defined, the AST returned from the _parser_ will be used.
2. Comments are attached to the AST (see _Handling comments in a printer_ for details).
-3. A Doc is recursively constructed from the AST. i) `embed(path: FastPath, print, textToDoc, options: object): Doc | null` is called on each AST node. If `embed` returns a Doc, that Doc is used. ii) If `embed` is undefined or returns a falsy value, `print(path: FastPath, options: object, print): Doc` is called on each AST node.
+3. A Doc is recursively constructed from the AST. i) `embed(path: AstPath, print, textToDoc, options: object): Doc | null` is called on each AST node. If `embed` returns a Doc, that Doc is used. ii) If `embed` is undefined or returns a falsy value, `print(path: AstPath, options: object, print): Doc` is called on each AST node.
#### `print`
@@ -186,10 +186,10 @@ Most of the work of a plugin's printer will take place in its `print` function,
```ts
function print(
// Path to the AST node to print
- path: FastPath,
+ path: AstPath,
options: object,
// Recursively print a child node
- print: (path: FastPath) => Doc
+ print: (path: AstPath) => Doc
): Doc;
```
@@ -217,9 +217,9 @@ The `embed` function is called when the plugin needs to print one language insid
```ts
function embed(
// Path to the current AST node
- path: FastPath,
+ path: AstPath,
// Print a node with the current printer
- print: (path: FastPath) => Doc,
+ print: (path: AstPath) => Doc,
// Parse and print some text using a different parser.
// You should set `options.parser` to specify which parser to use.
textToDoc: (text: string, options: object) => Doc,
@@ -271,7 +271,7 @@ Called whenever a comment node needs to be printed. It has the signature:
```ts
function printComment(
// Path to the current comment node
- commentPath: FastPath,
+ commentPath: AstPath,
// Current options
options: object
): Doc;
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
index ec56ee454..e5adaf87a 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js
@@ -8,7 +8,7 @@ module.exports = {
"no-doc-builder-concat": require("./no-doc-builder-concat"),
"no-empty-flat-contents-for-if-break": require("./no-empty-flat-contents-for-if-break"),
"no-node-comments": require("./no-node-comments"),
- "prefer-fast-path-each": require("./prefer-fast-path-each"),
+ "prefer-ast-path-each": require("./prefer-ast-path-each"),
"prefer-indent-if-break": require("./prefer-indent-if-break"),
"prefer-is-non-empty-array": require("./prefer-is-non-empty-array"),
"require-json-extensions": require("./require-json-extensions"),
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-ast-path-each.js
similarity index 86%
rename from scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js
rename to scripts/tools/eslint-plugin-prettier-internal-rules/prefer-ast-path-each.js
index 12bd32ed4..5cffcc174 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-ast-path-each.js
@@ -14,7 +14,7 @@ const selector = [
'[name="map"]',
].join("");
-const messageId = "prefer-fast-path-each";
+const messageId = "prefer-ast-path-each";
module.exports = {
meta: {
@@ -24,7 +24,7 @@ module.exports = {
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js",
},
messages: {
- [messageId]: "Prefer `FastPath#each()` over `FastPath#map()`.",
+ [messageId]: "Prefer `AstPath#each()` over `AstPath#map()`.",
},
fixable: "code",
},
diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
index 932a9298b..5b3a09b1f 100644
--- a/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
+++ b/scripts/tools/eslint-plugin-prettier-internal-rules/test.js
@@ -144,7 +144,7 @@ test("no-node-comments", {
],
});
-test("prefer-fast-path-each", {
+test("prefer-ast-path-each", {
valid: ["const foo = path.map()"],
invalid: [
{
diff --git a/src/common/fast-path.js b/src/common/ast-path.js
similarity index 93%
rename from src/common/fast-path.js
rename to src/common/ast-path.js
index 02ad5893a..d460ac897 100644
--- a/src/common/fast-path.js
+++ b/src/common/ast-path.js
@@ -16,7 +16,7 @@ function getNodeStackIndexHelper(stack, count) {
return -1;
}
-class FastPath {
+class AstPath {
constructor(value) {
this.stack = [value];
}
@@ -51,7 +51,7 @@ class FastPath {
// Temporarily push properties named by string arguments given after the
// callback function onto this.stack, then call the callback with a
- // reference to this (modified) FastPath object. Note that the stack will
+ // reference to this (modified) AstPath object. Note that the stack will
// be restored to its original state after the callback is finished, so it
// is probably a mistake to retain a reference to the path.
call(callback, ...names) {
@@ -76,7 +76,7 @@ class FastPath {
return result;
}
- // Similar to FastPath.prototype.call, except that the value obtained by
+ // Similar to AstPath.prototype.call, except that the value obtained by
// accessing this.getValue()[name1][name2]... should be array. The
// callback will be called with a reference to this path object for each
// element of the array.
@@ -99,7 +99,7 @@ class FastPath {
stack.length = length;
}
- // Similar to FastPath.prototype.each, except that the results of the
+ // Similar to AstPath.prototype.each, except that the results of the
// callback function invocations are stored in an array and returned at
// the end of the iteration.
map(callback, ...names) {
@@ -148,4 +148,4 @@ class FastPath {
}
}
-module.exports = FastPath;
+module.exports = AstPath;
diff --git a/src/language-js/comments.js b/src/language-js/comments.js
index f0a0ae6c1..53b7111e3 100644
--- a/src/language-js/comments.js
+++ b/src/language-js/comments.js
@@ -28,7 +28,7 @@ const { locStart, locEnd } = require("./loc");
/**
* @typedef {import("./types/estree").Node} Node
* @typedef {import("./types/estree").Comment} Comment
- * @typedef {import("../common/fast-path")} FastPath
+ * @typedef {import("../common/ast-path")} AstPath
*
* @typedef {Object} CommentContext
* @property {Comment} comment
@@ -944,7 +944,7 @@ function isTypeCastComment(comment) {
}
/**
- * @param {FastPath} path
+ * @param {AstPath} path
* @returns {boolean}
*/
function willPrintOwnComments(path /*, options */) {
diff --git a/src/language-js/print/angular.js b/src/language-js/print/angular.js
index d95da9c40..33bec62c8 100644
--- a/src/language-js/print/angular.js
+++ b/src/language-js/print/angular.js
@@ -6,7 +6,7 @@ const {
const { hasNode, hasComment, getComments } = require("../utils");
const { printBinaryishExpression } = require("./binaryish");
-/** @typedef {import("../../common/fast-path")} FastPath */
+/** @typedef {import("../../common/ast-path")} AstPath */
function printAngular(path, options, print) {
const n = path.getValue();
@@ -99,7 +99,7 @@ function isNgForOf(node, index, parentNode) {
/** identify if an angular expression seems to have side effects */
/**
- * @param {FastPath} path
+ * @param {AstPath} path
* @returns {boolean}
*/
function hasNgSideEffect(path) {
diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js
index 1c67dc84c..05c1a8426 100644
--- a/src/language-js/print/jsx.js
+++ b/src/language-js/print/jsx.js
@@ -33,7 +33,7 @@ const pathNeedsParens = require("../needs-parens");
const { willPrintOwnComments } = require("../comments");
/**
- * @typedef {import("../../common/fast-path")} FastPath
+ * @typedef {import("../../common/ast-path")} AstPath
* @typedef {import("../types/estree").Node} Node
* @typedef {import("../types/estree").JSXElement} JSXElement
*/
@@ -812,7 +812,7 @@ function isJsxWhitespaceExpression(node) {
}
/**
- * @param {FastPath} path
+ * @param {AstPath} path
* @returns {boolean}
*/
function hasJsxIgnoreComment(path) {
diff --git a/src/language-js/print/statement.js b/src/language-js/print/statement.js
index 8c15f1e1b..cc70d2f38 100644
--- a/src/language-js/print/statement.js
+++ b/src/language-js/print/statement.js
@@ -17,7 +17,7 @@ const { shouldPrintParamsWithoutParens } = require("./function");
/**
* @typedef {import("../../document").Doc} Doc
- * @typedef {import("../../common/fast-path")} FastPath
+ * @typedef {import("../../common/ast-path")} AstPath
*/
function printStatementSequence(path, options, print, property) {
diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js
index ded3c4266..cfad3acd8 100644
--- a/src/language-js/print/ternary.js
+++ b/src/language-js/print/ternary.js
@@ -26,7 +26,7 @@ const {
/**
* @typedef {import("../../document").Doc} Doc
- * @typedef {import("../../common/fast-path")} FastPath
+ * @typedef {import("../../common/ast-path")} AstPath
*
* @typedef {any} Options - Prettier options (TBD ...)
*/
@@ -214,7 +214,7 @@ function shouldExtraIndentForConditionalExpression(path) {
* The following is the shared logic for
* ternary operators, namely ConditionalExpression
* and TSConditionalType
- * @param {FastPath} path - The path to the ConditionalExpression/TSConditionalType node.
+ * @param {AstPath} path - The path to the ConditionalExpression/TSConditionalType node.
* @param {Options} options - Prettier options
* @param {Function} print - Print function to call recursively
* @returns {Doc}
diff --git a/src/language-js/print/type-annotation.js b/src/language-js/print/type-annotation.js
index 101143a0d..b5ad4afc2 100644
--- a/src/language-js/print/type-annotation.js
+++ b/src/language-js/print/type-annotation.js
@@ -233,7 +233,7 @@ function printFunctionType(path, options, print) {
isArrowFunctionTypeAnnotation &&
(parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation");
- // Sadly we can't put it inside of FastPath::needsColon because we are
+ // Sadly we can't put it inside of AstPath::needsColon because we are
// printing ":" as part of the expression and it would put parenthesis
// around :(
const needsParens =
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index 8f454752a..15ce8dd97 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -25,7 +25,7 @@ const { locStart, locEnd, hasSameLocStart } = require("./loc");
* @typedef {import("./types/estree").TaggedTemplateExpression} TaggedTemplateExpression
* @typedef {import("./types/estree").Literal} Literal
*
- * @typedef {import("../common/fast-path")} FastPath
+ * @typedef {import("../common/ast-path")} AstPath
*/
// We match any whitespace except line terminators because
@@ -201,7 +201,7 @@ function isExportDeclaration(node) {
}
/**
- * @param {FastPath} path
+ * @param {AstPath} path
* @returns {Node | null}
*/
function getParentExportDeclaration(path) {
@@ -866,7 +866,7 @@ function isFunctionCompositionArgs(args) {
// In the above call expression, the second call is the parent node and the
// first call is the current node.
/**
- * @param {FastPath} path
+ * @param {AstPath} path
* @returns {boolean}
*/
function isLongCurriedCallExpression(path) {
diff --git a/src/main/ast-to-doc.js b/src/main/ast-to-doc.js
index 369e6fc50..4af37ec0e 100644
--- a/src/main/ast-to-doc.js
+++ b/src/main/ast-to-doc.js
@@ -1,7 +1,7 @@
"use strict";
const assert = require("assert");
-const FastPath = require("../common/fast-path");
+const AstPath = require("../common/ast-path");
const doc = require("../document");
const { printComments } = require("./comments");
const multiparser = require("./multiparser");
@@ -27,7 +27,7 @@ const docUtils = doc.utils;
* plugin function again, and so on.
*
* All the while, these functions pass a "path" variable around, which
- * is a stack-like data structure (FastPath) that maintains the current
+ * is a stack-like data structure (AstPath) that maintains the current
* state of the recursion. It is called "path", because it represents
* the path to the current node through the Abstract Syntax Tree.
*/
@@ -74,7 +74,7 @@ function printAstToDoc(ast, options, alignmentSize = 0) {
return res;
}
- let doc = printGenerically(new FastPath(ast));
+ let doc = printGenerically(new AstPath(ast));
if (alignmentSize > 0) {
// Add a hardline to make the indents take effect
// It should be removed in index.js format()
@@ -106,7 +106,7 @@ function printPrettierIgnoredNode(node, options) {
}
function callPluginPrintFunction(path, options, printPath, args) {
- assert.ok(path instanceof FastPath);
+ assert.ok(path instanceof AstPath);
const node = path.getValue();
const { printer } = options;
diff --git a/website/versioned_docs/version-stable/plugins.md b/website/versioned_docs/version-stable/plugins.md
index ac88ebdaa..c91da7508 100644
--- a/website/versioned_docs/version-stable/plugins.md
+++ b/website/versioned_docs/version-stable/plugins.md
@@ -178,7 +178,7 @@ The printing process works as follows:
1. `preprocess(ast: AST, options: object): AST`, if available, is called. It is passed the AST from the _parser_. The AST returned by `preprocess` will be used by Prettier. If `preprocess` is not defined, the AST returned from the _parser_ will be used.
2. Comments are attached to the AST (see _Handling comments in a printer_ for details).
-3. A Doc is recursively constructed from the AST. i) `embed(path: FastPath, print, textToDoc, options: object): Doc | null` is called on each AST node. If `embed` returns a Doc, that Doc is used. ii) If `embed` is undefined or returns a falsy value, `print(path: FastPath, options: object, print): Doc` is called on each AST node.
+3. A Doc is recursively constructed from the AST. i) `embed(path: AstPath, print, textToDoc, options: object): Doc | null` is called on each AST node. If `embed` returns a Doc, that Doc is used. ii) If `embed` is undefined or returns a falsy value, `print(path: AstPath, options: object, print): Doc` is called on each AST node.
#### `print`
@@ -187,10 +187,10 @@ Most of the work of a plugin's printer will take place in its `print` function,
```ts
function print(
// Path to the AST node to print
- path: FastPath,
+ path: AstPath,
options: object,
// Recursively print a child node
- print: (path: FastPath) => Doc
+ print: (path: AstPath) => Doc
): Doc;
```
@@ -218,9 +218,9 @@ The `embed` function is called when the plugin needs to print one language insid
```ts
function embed(
// Path to the current AST node
- path: FastPath,
+ path: AstPath,
// Print a node with the current printer
- print: (path: FastPath) => Doc,
+ print: (path: AstPath) => Doc,
// Parse and print some text using a different parser.
// You should set `options.parser` to specify which parser to use.
textToDoc: (text: string, options: object) => Doc,
@@ -272,7 +272,7 @@ Called whenever a comment node needs to be printed. It has the signature:
```ts
function printComment(
// Path to the current comment node
- commentPath: FastPath,
+ commentPath: AstPath,
// Current options
options: object
): Doc;
From bc2b8fda34ac98df7b66ab6592dd722db5e574fd Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 10 Feb 2021 13:19:31 +0000
Subject: [PATCH 099/237] Build(deps-dev): Bump @glimmer/reference from 0.74.2
to 0.75.0 (#10289)
---
package.json | 2 +-
yarn.lock | 50 +++++++++++++++++---------------------------------
2 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/package.json b/package.json
index 886451a05..5f0394eda 100644
--- a/package.json
+++ b/package.json
@@ -90,7 +90,7 @@
"@babel/core": "7.12.13",
"@babel/preset-env": "7.12.13",
"@babel/types": "7.12.13",
- "@glimmer/reference": "0.74.2",
+ "@glimmer/reference": "0.75.0",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-babel": "5.2.3",
"@rollup/plugin-commonjs": "16.0.0",
diff --git a/yarn.lock b/yarn.lock
index 3933bc0d0..524300265 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1045,20 +1045,13 @@
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=
-"@glimmer/global-context@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.74.2.tgz#8005d63c47ead669f9246f516a0d68ce6e52896c"
- integrity sha512-ecD254DqF3HWrML1YAU0WThrGfjFvJ17JFSb486zEMQk4DPFWhjEr5DaFSB/YEw6Vz7NtnC31VS0guW3ct/r7A==
+"@glimmer/global-context@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.75.0.tgz#04367c4c05b66f69f77323463ed2ed38ec888031"
+ integrity sha512-uPGWl7ThQTWF+tn2jocSPCQcLWiSlQRVwVWq8zq3D1J6hVgK/QtWiCPZGNzHPb6F4UzDrNGgzSBMuNK9DyTuSw==
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/interfaces@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.74.2.tgz#0a6571b67153d6c31b248ab8ddf59b4f16a4fec5"
- integrity sha512-iemaya221twVsOEUD7McNWjHRQ7hij7rosgQI6hHQQyi8/R50f8ZevXo3MVWhni6Gkb9HKReP4Fkru7TpBjySw==
- dependencies:
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/interfaces@0.75.0":
version "0.75.0"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.75.0.tgz#ae8559a2ab906d7ab131741398c27f0c6dd1b0f7"
@@ -1066,16 +1059,16 @@
dependencies:
"@simple-dom/interface" "^1.4.0"
-"@glimmer/reference@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.74.2.tgz#368520445b931769bf3624591b18a2680d36aacd"
- integrity sha512-NVuI4k55SVSOcRkhM4qKPMNFaVmPnC7pIew0MufFZuPjsvCQm68ovtsJJkHo84BgtY4foy+9Q33cBhQz1BKK0Q==
+"@glimmer/reference@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.75.0.tgz#f8feb086a34399d224fc1c4ddcfc16061b9d13c6"
+ integrity sha512-stYpNfRxHGlzbVbxp9qN1n0GbxIKgCraYDb13E7bI430FmX0zjwtiL5wuDJo/WPAIa6g6VORqJ5tDRV9j584tw==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.74.2"
- "@glimmer/interfaces" "0.74.2"
- "@glimmer/util" "0.74.2"
- "@glimmer/validator" "0.74.2"
+ "@glimmer/global-context" "0.75.0"
+ "@glimmer/interfaces" "0.75.0"
+ "@glimmer/util" "0.75.0"
+ "@glimmer/validator" "0.75.0"
"@glimmer/syntax@0.75.0":
version "0.75.0"
@@ -1087,15 +1080,6 @@
"@handlebars/parser" "^2.0.0"
simple-html-tokenizer "^0.5.10"
-"@glimmer/util@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.74.2.tgz#11781773f17e7dfbc15b9e28966563557dd8630e"
- integrity sha512-miWIwAPJ3i3/7qq4ycI/yJw3mKeN4woUn1ev3/ESTMmELKUNBeIXAnVjlANDTseoTCetgHVw6PFqy/WS6qdtVw==
- dependencies:
- "@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.74.2"
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/util@0.75.0":
version "0.75.0"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.75.0.tgz#412956227c08e1a1e11500c7bd746947056924e5"
@@ -1105,13 +1089,13 @@
"@glimmer/interfaces" "0.75.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/validator@0.74.2":
- version "0.74.2"
- resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.74.2.tgz#e60f165345c7eb9e2ee3b4ed021d10ce6cbd262f"
- integrity sha512-mRRjY5lcpD5IQvPGpAiuqS3EOOaC3xMYby70McH6lzH62tQffFDlqDV4uB6Z+OYVq0q+xUVvHTsLJ5ixo+BfAA==
+"@glimmer/validator@0.75.0":
+ version "0.75.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.75.0.tgz#aee57df8a64a0701462333def6f69bc2c3937156"
+ integrity sha512-6L782LD8aS7V5zSuFliZiY2zlEIMkuyFjsCoFotpaEkU0km/ywTxciW2JthYTQW5vqRmQ9wv96JNDsN1GUhj+Q==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.74.2"
+ "@glimmer/global-context" "0.75.0"
"@handlebars/parser@^2.0.0":
version "2.0.0"
From 91c0d58c4a5129529cf473aa1b6aa83288c7a8ae Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 10 Feb 2021 13:31:20 +0000
Subject: [PATCH 100/237] Build(deps): Bump @angular/compiler from 11.1.1 to
11.1.2 (#10242)
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 5f0394eda..94d6828ed 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"bin"
],
"dependencies": {
- "@angular/compiler": "11.1.1",
+ "@angular/compiler": "11.1.2",
"@babel/code-frame": "7.12.13",
"@babel/parser": "7.12.11",
"@glimmer/syntax": "0.75.0",
diff --git a/yarn.lock b/yarn.lock
index 524300265..59718667c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,10 +2,10 @@
# yarn lockfile v1
-"@angular/compiler@11.1.1":
- version "11.1.1"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.1.tgz#cafe43b52fb69f0b9493e597baec14fcffd13d7d"
- integrity sha512-kybGddMBL6E2BFBOHIX39VsKVxH3yD7NA1g2mQUE9KIqLAavH0KLBr8B03R9MKb6+BElGpk/5yCyCkzkwQES7w==
+"@angular/compiler@11.1.2":
+ version "11.1.2"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.2.tgz#1bfec2892c7ddbc40331de3a1bb6ea3997f3e436"
+ integrity sha512-+GyKPAdwkXVq6xfSRVhF2tlheDLGf2ziTzaMcpjRk8sM0VeJAqrbDI/vqpZq9y6GXceKGDPrXdPY7bPwBPpDYg==
dependencies:
tslib "^2.0.0"
From 662cdb04db17e706e153a3fc1e1bd422f4eccad3 Mon Sep 17 00:00:00 2001
From: Georgii Dolzhykov
Date: Wed, 10 Feb 2021 17:08:54 +0200
Subject: [PATCH 101/237] RFC: label doc (#10275)
* RFC: label doc
* Update functions in doc-utils
---
commands.md | 12 ++++++++++
src/document/doc-builders.js | 5 ++++
src/document/doc-debug.js | 4 ++++
src/document/doc-printer.js | 6 +++++
src/document/doc-utils.js | 5 +++-
src/language-js/print/member-chain.js | 30 +++++++++++++++++-------
tests_integration/__tests__/debug-api.js | 5 ++++
7 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/commands.md b/commands.md
index c9527be5e..28d32b4b4 100644
--- a/commands.md
+++ b/commands.md
@@ -271,6 +271,18 @@ With `negate: true`, corresponds to `ifBreak(doc, indent(doc), { groupId })`
It doesn't make sense to apply `indentIfBreak` to the current group because "indent if the current group is broken" is the normal behavior of `indent`. That's why `groupId` is required.
+### `label`
+
+_Added in v2.3.0_
+
+```ts
+declare function label(label: string, doc: Doc): Doc;
+```
+
+Mark a doc with a string label. This doesn't affect how the doc is printed, but can be useful for heuristics based on doc introspection.
+
+E.g., to decide how to print an assignment expression, we might want to know whether its right-hand side has been printed as a method call chain, not as a plain function call. If the method chain printing code uses `label` to mark its result, checking that condition can be as easy as `rightHandSideDoc.label === 'method-chain'`.
+
### `hardlineWithoutBreakParent` and `literallineWithoutBreakParent`
_Added in v2.3.0_
diff --git a/src/document/doc-builders.js b/src/document/doc-builders.js
index 9747dcd18..4b0315070 100644
--- a/src/document/doc-builders.js
+++ b/src/document/doc-builders.js
@@ -259,6 +259,10 @@ function addAlignmentToDoc(doc, size, tabWidth) {
return aligned;
}
+function label(label, contents) {
+ return { type: "label", label, contents };
+}
+
module.exports = {
concat,
join,
@@ -284,4 +288,5 @@ module.exports = {
dedent,
hardlineWithoutBreakParent,
literallineWithoutBreakParent,
+ label,
};
diff --git a/src/document/doc-debug.js b/src/document/doc-debug.js
index 41bda1c36..2499d323f 100644
--- a/src/document/doc-debug.js
+++ b/src/document/doc-debug.js
@@ -173,6 +173,10 @@ function printDocToDebug(doc) {
return "lineSuffixBoundary";
}
+ if (doc.type === "label") {
+ return `label(${JSON.stringify(doc.label)}, ${printDoc(doc.contents)})`;
+ }
+
throw new Error("Unknown doc type " + doc.type);
}
diff --git a/src/document/doc-printer.js b/src/document/doc-printer.js
index 64509a440..29f7a3c84 100644
--- a/src/document/doc-printer.js
+++ b/src/document/doc-printer.js
@@ -258,6 +258,9 @@ function fits(next, restCommands, width, options, hasLineSuffix, mustBeFlat) {
return false;
}
break;
+ case "label":
+ cmds.push([ind, mode, doc.contents]);
+ break;
}
}
}
@@ -553,6 +556,9 @@ function printDocToString(doc, options) {
break;
}
break;
+ case "label":
+ cmds.push([ind, mode, doc.contents]);
+ break;
default:
}
}
diff --git a/src/document/doc-utils.js b/src/document/doc-utils.js
index 29333a4b2..796944900 100644
--- a/src/document/doc-utils.js
+++ b/src/document/doc-utils.js
@@ -227,8 +227,10 @@ function stripDocTrailingHardlineFromDoc(doc) {
switch (doc.type) {
case "align":
case "indent":
+ case "indent-if-break":
case "group":
- case "line-suffix": {
+ case "line-suffix":
+ case "label": {
const contents = stripDocTrailingHardlineFromDoc(doc.contents);
return { ...doc, contents };
}
@@ -270,6 +272,7 @@ function cleanDocFn(doc) {
break;
case "align":
case "indent":
+ case "indent-if-break":
case "line-suffix":
if (!doc.contents) {
return "";
diff --git a/src/language-js/print/member-chain.js b/src/language-js/print/member-chain.js
index 2564fa507..07a9f9b77 100644
--- a/src/language-js/print/member-chain.js
+++ b/src/language-js/print/member-chain.js
@@ -24,7 +24,15 @@ const {
const { locEnd } = require("../loc");
const {
- builders: { join, hardline, group, indent, conditionalGroup, breakParent },
+ builders: {
+ join,
+ hardline,
+ group,
+ indent,
+ conditionalGroup,
+ breakParent,
+ label,
+ },
utils: { willBreak },
} = require("../../document");
const printCallArguments = require("./call-arguments");
@@ -374,6 +382,8 @@ function printMemberChain(path, options, print) {
);
}
+ let result;
+
// We don't want to print in one line if at least one of these conditions occurs:
// * the chain has comments,
// * the chain is an expression statement and all the arguments are literal-like ("fluent configuration" pattern),
@@ -389,16 +399,18 @@ function printMemberChain(path, options, print) {
printedGroups.slice(0, -1).some(willBreak) ||
lastGroupWillBreakAndOtherCallsHaveFunctionArguments()
) {
- return group(expanded);
+ result = group(expanded);
+ } else {
+ result = [
+ // We only need to check `oneLine` because if `expanded` is chosen
+ // that means that the parent group has already been broken
+ // naturally
+ willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "",
+ conditionalGroup([oneLine, expanded]),
+ ];
}
- return [
- // We only need to check `oneLine` because if `expanded` is chosen
- // that means that the parent group has already been broken
- // naturally
- willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "",
- conditionalGroup([oneLine, expanded]),
- ];
+ return label("member-chain", result);
}
module.exports = printMemberChain;
diff --git a/tests_integration/__tests__/debug-api.js b/tests_integration/__tests__/debug-api.js
index f7f3a1f59..776f8e070 100644
--- a/tests_integration/__tests__/debug-api.js
+++ b/tests_integration/__tests__/debug-api.js
@@ -66,6 +66,7 @@ describe("API", () => {
indentIfBreak,
group,
line,
+ label,
} = builders;
expect(formatDoc([indent(hardline), indent(literalline)])).toBe(
@@ -86,5 +87,9 @@ describe("API", () => {
expect(
formatDoc(indentIfBreak(group(["1", line, "2"]), { groupId: "Q" }))
).toBe('indentIfBreak(group(["1", line, "2"]), { groupId: "Q" })');
+
+ expect(formatDoc(label("foo", group(["1", line, "2"])))).toBe(
+ 'label("foo", group(["1", line, "2"]))'
+ );
});
});
From 2f4140ff180452faab2170ba50db5d3c3ac281e4 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 11 Feb 2021 00:50:59 +0800
Subject: [PATCH 102/237] Test: Skip install for standalone test (#10273)
---
jest.config.js | 14 +++++++++++---
scripts/install-prettier.js | 5 +----
tests_config/require_prettier.js | 4 +---
tests_integration/env.js | 12 +++++-------
4 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/jest.config.js b/jest.config.js
index 24e278d81..bfe8eb1fb 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,13 +1,21 @@
"use strict";
+const path = require("path");
const installPrettier = require("./scripts/install-prettier");
+const PROJECT_ROOT = __dirname;
const isProduction = process.env.NODE_ENV === "production";
const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
-if (isProduction || process.env.INSTALL_PACKAGE) {
- process.env.PRETTIER_DIR = installPrettier();
+const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
+const INSTALL_PACKAGE = Boolean(process.env.INSTALL_PACKAGE);
+
+let PRETTIER_DIR = isProduction
+ ? path.join(PROJECT_ROOT, "dist")
+ : PROJECT_ROOT;
+if (INSTALL_PACKAGE || (isProduction && !TEST_STANDALONE)) {
+ PRETTIER_DIR = installPrettier(PRETTIER_DIR);
}
-const { TEST_STANDALONE } = process.env;
+process.env.PRETTIER_DIR = PRETTIER_DIR;
const testPathIgnorePatterns = [];
let transform;
diff --git a/scripts/install-prettier.js b/scripts/install-prettier.js
index ddd565f1f..d435defa6 100644
--- a/scripts/install-prettier.js
+++ b/scripts/install-prettier.js
@@ -6,12 +6,9 @@ const tempy = require("tempy");
shell.config.fatal = true;
-const rootDir = path.join(__dirname, "..");
const client = process.env.NPM_CLIENT || "yarn";
-const packageDir =
- process.env.NODE_ENV === "production" ? path.join(rootDir, "dist") : rootDir;
-module.exports = () => {
+module.exports = (packageDir) => {
const tmpDir = tempy.directory();
const file = shell.exec("npm pack", { cwd: packageDir }).stdout.trim();
shell.mv(path.join(packageDir, file), tmpDir);
diff --git a/tests_config/require_prettier.js b/tests_config/require_prettier.js
index 7a1cfaf9b..e18cf8c6e 100644
--- a/tests_config/require_prettier.js
+++ b/tests_config/require_prettier.js
@@ -1,7 +1,5 @@
"use strict";
-const prettierRootDir = process.env.PRETTIER_DIR || "../";
-
-const prettier = require(prettierRootDir);
+const prettier = require(process.env.PRETTIER_DIR);
module.exports = prettier;
diff --git a/tests_integration/env.js b/tests_integration/env.js
index 09409e3d0..746cca8cd 100644
--- a/tests_integration/env.js
+++ b/tests_integration/env.js
@@ -2,18 +2,16 @@
const path = require("path");
const isProduction = process.env.NODE_ENV === "production";
-const prettierRootDir = isProduction
- ? process.env.PRETTIER_DIR
- : path.join(__dirname, "..");
-const { bin } = require(path.join(prettierRootDir, "package.json"));
+const { PRETTIER_DIR } = process.env;
+const { bin } = require(path.join(PRETTIER_DIR, "package.json"));
const prettierCli = path.join(
- prettierRootDir,
+ PRETTIER_DIR,
typeof bin === "object" ? bin.prettier : bin
);
const thirdParty = isProduction
- ? path.join(prettierRootDir, "./third-party")
- : path.join(prettierRootDir, "./src/common/third-party");
+ ? path.join(PRETTIER_DIR, "./third-party")
+ : path.join(PRETTIER_DIR, "./src/common/third-party");
const projectRoot = path.join(__dirname, "..");
From d0829f8b95dbb60790a109c34471c0e7890a726f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 11 Feb 2021 00:51:41 +0800
Subject: [PATCH 103/237] Build(deps): Bump meriyah from 4.0.0 to 4.1.1
(#10283)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung
---
package.json | 2 +-
.../__snapshots__/jsfmt.spec.js.snap | 11 -----
tests/js/babel-plugins/jsfmt.spec.js | 1 -
.../__snapshots__/jsfmt.spec.js.snap | 13 +----
tests/js/logical-assignment/jsfmt.spec.js | 2 +-
.../invalid/__snapshots__/jsfmt.spec.js.snap | 48 +++++++++++++++++++
tests/misc/errors/invalid/jsfmt.spec.js | 4 +-
yarn.lock | 8 ++--
8 files changed, 58 insertions(+), 31 deletions(-)
diff --git a/package.json b/package.json
index 94d6828ed..48ade6754 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"linguist-languages": "7.12.2",
"lodash": "4.17.20",
"mem": "8.0.0",
- "meriyah": "4.0.0",
+ "meriyah": "4.1.1",
"minimatch": "3.0.4",
"minimist": "1.2.5",
"n-readlines": "1.0.1",
diff --git a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
index 4adcb644e..18b08ab76 100644
--- a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
@@ -1014,17 +1014,6 @@ var profile = (
================================================================================
`;
-exports[`logical-assignment-operators.js [meriyah] format 1`] = `
-"[3:5]: Unexpected token: '=' (3:5)
- 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators
- 2 |
-> 3 | a ||= b;
- | ^
- 4 | obj.a.b ||= c;
- 5 |
- 6 | a &&= b;"
-`;
-
exports[`logical-assignment-operators.js format 1`] = `
====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"]
diff --git a/tests/js/babel-plugins/jsfmt.spec.js b/tests/js/babel-plugins/jsfmt.spec.js
index 0d5680faa..ff2862524 100644
--- a/tests/js/babel-plugins/jsfmt.spec.js
+++ b/tests/js/babel-plugins/jsfmt.spec.js
@@ -36,7 +36,6 @@ run_spec(__dirname, ["babel", "babel-ts", "babel-flow"], {
"flow.js",
"function-bind.js",
"function-sent.js",
- "logical-assignment-operators.js",
"module-attributes-dynamic.js",
"module-attributes-static.js",
"partial-application.js",
diff --git a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
index 4ea6b04c8..8155473c9 100644
--- a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap
@@ -8,9 +8,9 @@ exports[`invalid.js [espree] format 1`] = `
`;
exports[`invalid.js [meriyah] format 1`] = `
-"[1:19]: Unexpected token: '=' (1:19)
+"[1:51]: Invalid left-hand side in assignment (1:51)
> 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
- | ^
+ | ^
2 |"
`;
@@ -28,15 +28,6 @@ c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
================================================================================
`;
-exports[`logical-assignment.js [meriyah] format 1`] = `
-"[1:5]: Unexpected token: '=' (1:5)
-> 1 | a ||= b;
- | ^
- 2 |
- 3 | a &&= \\"foo\\";
- 4 | b ||= \\"foo\\";"
-`;
-
exports[`logical-assignment.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
diff --git a/tests/js/logical-assignment/jsfmt.spec.js b/tests/js/logical-assignment/jsfmt.spec.js
index 77c17c6e6..35c487da3 100644
--- a/tests/js/logical-assignment/jsfmt.spec.js
+++ b/tests/js/logical-assignment/jsfmt.spec.js
@@ -1,3 +1,3 @@
run_spec(__dirname, ["babel", "typescript"], {
- errors: { espree: ["invalid.js"], meriyah: true },
+ errors: { espree: ["invalid.js"], meriyah: ["invalid.js"] },
});
diff --git a/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap
index 80ad23314..8200a92dd 100644
--- a/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap
@@ -30,8 +30,56 @@ exports[`snippet: #0 [flow] format 1`] = `
| ^^^^"
`;
+exports[`snippet: #0 [meriyah] format 1`] = `
+"[1:8]: Expected '(' (1:8)
+> 1 | for each (a in b) {}
+ | ^"
+`;
+
exports[`snippet: #0 [typescript] format 1`] = `
"'(' expected. (1:5)
> 1 | for each (a in b) {}
| ^"
`;
+
+exports[`snippet: #1 [babel] format 1`] = `
+"A class name is required (1:7)
+> 1 | class switch() {}
+ | ^"
+`;
+
+exports[`snippet: #1 [babel-flow] format 1`] = `
+"A class name is required (1:7)
+> 1 | class switch() {}
+ | ^"
+`;
+
+exports[`snippet: #1 [babel-ts] format 1`] = `
+"A class name is required (1:7)
+> 1 | class switch() {}
+ | ^"
+`;
+
+exports[`snippet: #1 [espree] format 1`] = `
+"Unexpected token switch (1:7)
+> 1 | class switch() {}
+ | ^"
+`;
+
+exports[`snippet: #1 [flow] format 1`] = `
+"Unexpected token \`switch\` (1:7)
+> 1 | class switch() {}
+ | ^^^^^^"
+`;
+
+exports[`snippet: #1 [meriyah] format 1`] = `
+"[1:12]: Unexpected strict mode reserved word (1:12)
+> 1 | class switch() {}
+ | ^"
+`;
+
+exports[`snippet: #1 [typescript] format 1`] = `
+"'{' expected. (1:7)
+> 1 | class switch() {}
+ | ^"
+`;
diff --git a/tests/misc/errors/invalid/jsfmt.spec.js b/tests/misc/errors/invalid/jsfmt.spec.js
index 7912c9794..52247a568 100644
--- a/tests/misc/errors/invalid/jsfmt.spec.js
+++ b/tests/misc/errors/invalid/jsfmt.spec.js
@@ -1,7 +1,7 @@
run_spec(
{
dirname: __dirname,
- snippets: ["for each (a in b) {}"],
+ snippets: ["for each (a in b) {}", "class switch() {}"],
},
- ["babel", "flow", "typescript", "babel-flow", "babel-ts", "espree"]
+ ["babel", "flow", "typescript", "babel-flow", "babel-ts", "espree", "meriyah"]
);
diff --git a/yarn.lock b/yarn.lock
index 59718667c..2dccafbeb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5155,10 +5155,10 @@ merge2@^1.3.0:
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
-meriyah@4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/meriyah/-/meriyah-4.0.0.tgz#8aebc64f09a9ec16a3040b754b85f7131770c4a1"
- integrity sha512-FJ3WMKlHJTKH6tazLOTw16bnTWV8vfAy08K3hR+6PnOJpciWaxMDZdA0PhGyWZyHbtiNdfQOc2+Tm8bEt/1TTA==
+meriyah@4.1.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/meriyah/-/meriyah-4.1.1.tgz#9101e4b597b3e1a0f85c230c5134293cf8a02b8d"
+ integrity sha512-Awk9n/HTyIZWhtpZkb8HvlrU7q7fBGl24wm4HXxVFm5IV3ov2PacmR41SL+LZ9EtuhRCudw5MkGaXUcUEcOBZg==
micromatch@^3.1.4:
version "3.1.10"
From 73065806e6a9357e4600ee9b40f933b9a3be2585 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 11 Feb 2021 00:52:20 +0800
Subject: [PATCH 104/237] Build(deps): Bump flow-parser from 0.143.1 to 0.144.0
(#10251)
Bumps [flow-parser](https://github.com/facebook/flow) from 0.143.1 to 0.144.0.
- [Release notes](https://github.com/facebook/flow/releases)
- [Changelog](https://github.com/facebook/flow/blob/master/Changelog.md)
- [Commits](https://github.com/facebook/flow/compare/v0.143.1...v0.144.0)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 48ade6754..a256080ec 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.143.1",
+ "flow-parser": "0.144.0",
"get-stdin": "8.0.0",
"globby": "11.0.2",
"graphql": "15.5.0",
diff --git a/yarn.lock b/yarn.lock
index 2dccafbeb..7ab5914c5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3493,10 +3493,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.143.1:
- version "0.143.1"
- resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.143.1.tgz#c18e1745df97d1132e60036e88cbf1925b5094e4"
- integrity sha512-DWmnt0P1tieuQErYeWmxCNIkzm5Fqd5sMH685v/jCtu8CAvdLEwKi45jqYhij178k+NAy+FNe2jDvQNs7WLBIA==
+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==
for-in@^1.0.2:
version "1.0.2"
From 930d73daa6bad3741868ae05671603fad180e9f6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 11 Feb 2021 00:52:37 +0800
Subject: [PATCH 105/237] Build(deps-dev): Bump @typescript-eslint/types from
4.14.2 to 4.15.0 (#10281)
Bumps [@typescript-eslint/types](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/visitor-keys) from 4.14.2 to 4.15.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/visitor-keys/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.0/packages/visitor-keys)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/package.json b/package.json
index a256080ec..ddd23f8e6 100644
--- a/package.json
+++ b/package.json
@@ -99,7 +99,7 @@
"@rollup/plugin-replace": "2.3.4",
"@types/estree": "0.0.46",
"@types/node": "14.14.0",
- "@typescript-eslint/types": "4.14.2",
+ "@typescript-eslint/types": "4.15.0",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"benchmark": "2.1.4",
diff --git a/yarn.lock b/yarn.lock
index 7ab5914c5..d61b142c7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1620,11 +1620,6 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2"
integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==
-"@typescript-eslint/types@4.14.2":
- version "4.14.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.2.tgz#d96da62be22dc9dc6a06647f3633815350fb3174"
- integrity sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q==
-
"@typescript-eslint/types@4.15.0":
version "4.15.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.0.tgz#3011ae1ac3299bb9a5ac56bdd297cccf679d3662"
From 9ff161d4824bdd642f1e0c691946f83e6ce5a648 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 11 Feb 2021 00:52:59 +0800
Subject: [PATCH 106/237] Build(deps): Bump typescript from 4.1.3 to 4.1.4
(#10288)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.1.3...v4.1.4)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index ddd23f8e6..5a5c1930c 100644
--- a/package.json
+++ b/package.json
@@ -79,7 +79,7 @@
"semver": "7.3.4",
"string-width": "4.2.0",
"strip-ansi": "6.0.0",
- "typescript": "4.1.3",
+ "typescript": "4.1.4",
"unicode-regex": "3.0.0",
"unified": "9.2.0",
"vnopts": "1.0.2",
diff --git a/yarn.lock b/yarn.lock
index d61b142c7..ab9a52b75 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6988,10 +6988,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
-typescript@4.1.3:
- version "4.1.3"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
- integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
+typescript@4.1.4:
+ version "4.1.4"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.4.tgz#f058636e2f4f83f94ddaae07b20fd5e14598432f"
+ integrity sha512-+Uru0t8qIRgjuCpiSPpfGuhHecMllk5Zsazj5LZvVsEStEjmIRRBZe+jHjGQvsgS7M1wONy2PQXd67EMyV6acg==
unherit@^1.0.4:
version "1.1.3"
From 36d3a0c784111affb1781f058a2ca71ae0043bb2 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 11 Feb 2021 10:36:10 +0800
Subject: [PATCH 107/237] Remove `isEmpty` (#10295)
---
src/document/doc-utils.js | 5 -----
src/language-js/print/jsx.js | 8 ++++----
src/language-js/printer-estree.js | 10 ++++------
3 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/document/doc-utils.js b/src/document/doc-utils.js
index 796944900..b34b9caf4 100644
--- a/src/document/doc-utils.js
+++ b/src/document/doc-utils.js
@@ -104,10 +104,6 @@ function findInDoc(doc, fn, defaultValue) {
return result;
}
-function isEmpty(n) {
- return typeof n === "string" && n.length === 0;
-}
-
function isLineNextFn(doc) {
if (typeof doc === "string") {
return false;
@@ -382,7 +378,6 @@ function replaceNewlinesWithLiterallines(doc) {
module.exports = {
isConcat,
getDocParts,
- isEmpty,
willBreak,
isLineNext,
traverseDoc,
diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js
index 05c1a8426..77fb7b5c8 100644
--- a/src/language-js/print/jsx.js
+++ b/src/language-js/print/jsx.js
@@ -14,7 +14,7 @@ const {
lineSuffixBoundary,
join,
},
- utils: { willBreak, isLineNext, isEmpty },
+ utils: { willBreak, isLineNext },
} = require("../../document");
const { getLast, getPreferredQuote } = require("../../common/util");
@@ -177,7 +177,7 @@ function printJsxElementInternal(path, options, print) {
// Trim trailing lines (or empty strings)
while (
children.length > 0 &&
- (isLineNext(getLast(children)) || isEmpty(getLast(children)))
+ (!getLast(children) || isLineNext(getLast(children)))
) {
children.pop();
}
@@ -185,8 +185,8 @@ function printJsxElementInternal(path, options, print) {
// Trim leading lines (or empty strings)
while (
children.length > 0 &&
- (isLineNext(children[0]) || isEmpty(children[0])) &&
- (isLineNext(children[1]) || isEmpty(children[1]))
+ (!children[0] || isLineNext(children[0])) &&
+ (!children[1] || isLineNext(children[1]))
) {
children.shift();
children.shift();
diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js
index e419dfcc1..a4f679463 100644
--- a/src/language-js/printer-estree.js
+++ b/src/language-js/printer-estree.js
@@ -15,7 +15,6 @@ const {
} = require("../common/util");
const {
builders: { join, line, hardline, softline, literalline, group, indent },
- utils: { isEmpty },
} = require("../document");
const embed = require("./embed");
const clean = require("./clean");
@@ -97,14 +96,13 @@ const { printBlock, printBlockBody } = require("./print/block");
const { printComment } = require("./print/comment");
function genericPrint(path, options, printPath, args) {
- const node = path.getValue();
- let needsParens = false;
const linesWithoutParens = printPathNoParens(path, options, printPath, args);
-
- if (!node || isEmpty(linesWithoutParens)) {
- return linesWithoutParens;
+ if (!linesWithoutParens) {
+ return "";
}
+ let needsParens = false;
+ const node = path.getValue();
const parentExportDecl = getParentExportDeclaration(path);
const decorators = [];
if (
From 659d9a1f1fb48bc3cb071c7d21258ca40b056740 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 11 Feb 2021 10:39:19 +0800
Subject: [PATCH 108/237] Add a link to `prettier-doc/no-concat` ESLint rule
(#10188)
---
changelog_unreleased/api/9733.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/changelog_unreleased/api/9733.md b/changelog_unreleased/api/9733.md
index 3b4f8369b..4def4af71 100644
--- a/changelog_unreleased/api/9733.md
+++ b/changelog_unreleased/api/9733.md
@@ -4,6 +4,8 @@ To simplify the code of AST printers, the data structure for the concatenation c
If you're a plugin author, this change should only concern you if your plugin introspects or modifies composed docs. If it happens to be the case, please make your plugin compatible with future versions of Prettier by tweaking the introspecting code to support the new format. There also is an off-chance where this change can break things, namely if a plugin calls another plugin to [print an embedded language](https://prettier.io/docs/en/plugins.html#optional-embed) and then introspects the returned doc. There seems to be no reason for plugins to do that though.
+To replace `concat(β¦)` calls in your plugins, you can try auto-fix by this ESLint rule [`prettier-doc/no-concat`](https://github.com/fisker/eslint-plugin-prettier-doc#no-concat).
+
```jsx
// Prettier stable
myDoc = group(concat(["foo", line, "bar"]));
From 2d97df8ec7e142913435dbde10794923a5c6b886 Mon Sep 17 00:00:00 2001
From: Sosuke Suzuki
Date: Thu, 11 Feb 2021 16:49:38 +0900
Subject: [PATCH 109/237] Fix unnecessary line breaks in method type
declaration parameters (#10024)
---
changelog_unreleased/typescript/10024.md | 25 +++++++++++
src/language-js/print/typescript.js | 40 +++++++++--------
.../method/__snapshots__/jsfmt.spec.js.snap | 44 +++++++++++++++++++
tests/typescript/method/method-signature.ts | 16 +++++++
4 files changed, 107 insertions(+), 18 deletions(-)
create mode 100644 changelog_unreleased/typescript/10024.md
create mode 100644 tests/typescript/method/method-signature.ts
diff --git a/changelog_unreleased/typescript/10024.md b/changelog_unreleased/typescript/10024.md
new file mode 100644
index 000000000..dbab25510
--- /dev/null
+++ b/changelog_unreleased/typescript/10024.md
@@ -0,0 +1,25 @@
+#### Fix unnecessary line breaks in method type declaration parameters (#10024 by @sosukesuzuki)
+
+
+```js
+// Input
+type Foo = {
+ method(foo: "foo"): `
+ `
+};
+
+// Prettier stable
+type Foo = {
+ method(
+ foo: "foo"
+ ): `
+ `;
+};
+
+// Prettier master
+type Foo = {
+ method(foo: "foo"): `
+ `;
+};
+
+```
diff --git a/src/language-js/print/typescript.js b/src/language-js/print/typescript.js
index a9b42d67d..755f7331e 100644
--- a/src/language-js/print/typescript.js
+++ b/src/language-js/print/typescript.js
@@ -359,28 +359,32 @@ function printTypescript(path, options, print) {
}
case "TSMethodSignature":
parts.push(
- n.accessibility ? [n.accessibility, " "] : "",
- n.export ? "export " : "",
- n.static ? "static " : "",
- n.readonly ? "readonly " : "",
- n.computed ? "[" : "",
- path.call(print, "key"),
- n.computed ? "]" : "",
- printOptionalToken(path),
- printFunctionParameters(
- path,
- print,
- options,
- /* expandArg */ false,
- /* printTypeParams */ true
- )
+ group([
+ n.accessibility ? [n.accessibility, " "] : "",
+ n.export ? "export " : "",
+ n.static ? "static " : "",
+ n.readonly ? "readonly " : "",
+ n.computed ? "[" : "",
+ path.call(print, "key"),
+ n.computed ? "]" : "",
+ printOptionalToken(path),
+ printFunctionParameters(
+ path,
+ print,
+ options,
+ /* expandArg */ false,
+ /* printTypeParams */ true
+ ),
+ ])
);
if (n.returnType || n.typeAnnotation) {
parts.push(
- ": ",
- path.call(print, "returnType"),
- path.call(print, "typeAnnotation")
+ group([
+ ": ",
+ path.call(print, "returnType"),
+ path.call(print, "typeAnnotation"),
+ ])
);
}
return group(parts);
diff --git a/tests/typescript/method/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/method/__snapshots__/jsfmt.spec.js.snap
index 529da63e9..1693b0b0f 100644
--- a/tests/typescript/method/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/method/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,49 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`method-signature.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+type Foo = {
+ get(key: "foo"): \`
+ \`;
+};
+type Foo = {
+ get(key: "foo"): \`\`;
+};
+
+type Bar = {
+ get(key: "bar"): {
+ bar: "bar"
+ };
+}
+type Bar = {
+ get(key: "bar"): { bar: "bar" };
+}
+
+=====================================output=====================================
+type Foo = {
+ get(key: "foo"): \`
+ \`;
+};
+type Foo = {
+ get(key: "foo"): \`\`;
+};
+
+type Bar = {
+ get(key: "bar"): {
+ bar: "bar";
+ };
+};
+type Bar = {
+ get(key: "bar"): { bar: "bar" };
+};
+
+================================================================================
+`;
+
exports[`semi.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
diff --git a/tests/typescript/method/method-signature.ts b/tests/typescript/method/method-signature.ts
new file mode 100644
index 000000000..dd7d96caa
--- /dev/null
+++ b/tests/typescript/method/method-signature.ts
@@ -0,0 +1,16 @@
+type Foo = {
+ get(key: "foo"): `
+ `;
+};
+type Foo = {
+ get(key: "foo"): ``;
+};
+
+type Bar = {
+ get(key: "bar"): {
+ bar: "bar"
+ };
+}
+type Bar = {
+ get(key: "bar"): { bar: "bar" };
+}
From cb27432b7730a3ef79ed7e73507a0fee211a905b Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 11 Feb 2021 16:15:37 +0800
Subject: [PATCH 110/237] Fix changelog
---
changelog_unreleased/typescript/10024.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/changelog_unreleased/typescript/10024.md b/changelog_unreleased/typescript/10024.md
index dbab25510..26b71f780 100644
--- a/changelog_unreleased/typescript/10024.md
+++ b/changelog_unreleased/typescript/10024.md
@@ -16,7 +16,7 @@ type Foo = {
`;
};
-// Prettier master
+// Prettier main
type Foo = {
method(foo: "foo"): `
`;
From 37b5b58ea1bd26120f27a20c944021e84d46046d Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Thu, 11 Feb 2021 16:20:41 +0800
Subject: [PATCH 111/237] Update `parse-json`
---
.../__tests__/__snapshots__/third-party.js.snap | 2 +-
yarn.lock | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests_integration/__tests__/__snapshots__/third-party.js.snap b/tests_integration/__tests__/__snapshots__/third-party.js.snap
index 59921aedb..0a8769dd3 100644
--- a/tests_integration/__tests__/__snapshots__/third-party.js.snap
+++ b/tests_integration/__tests__/__snapshots__/third-party.js.snap
@@ -7,7 +7,7 @@ exports[`cosmiconfig Invalid json file 1`] = `
| ^
2 |
-Unexpected token a in JSON at position 1 while parsing near '{a':}'
+Unexpected token \\"a\\" (0x61) in JSON at position 1 while parsing \\"{a':}/n\\"
> 1 | {a':}
| ^
diff --git a/yarn.lock b/yarn.lock
index ab9a52b75..3a729524f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3065,6 +3065,7 @@ eslint-plugin-jest@24.1.3:
"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
+ uid ""
eslint-plugin-react@7.22.0:
version "7.22.0"
@@ -4875,6 +4876,11 @@ json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==
+json-parse-even-better-errors@^2.3.0:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
+ integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==
+
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
@@ -5596,13 +5602,13 @@ parse-json@^4.0.0:
json-parse-better-errors "^1.0.1"
parse-json@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f"
- integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==
+ version "5.2.0"
+ resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
+ integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==
dependencies:
"@babel/code-frame" "^7.0.0"
error-ex "^1.3.1"
- json-parse-better-errors "^1.0.1"
+ json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"
parse-srcset@ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee:
From 5aa057b40be0d49f9dec4deb2811694e1f911b48 Mon Sep 17 00:00:00 2001
From: Cyrille David
Date: Thu, 11 Feb 2021 14:43:07 +0100
Subject: [PATCH 112/237] Handlebars: Default --html-whitespace-sensitivity to
strict (#10201)
* Handlebars: Default --html-whitespace-sensitivity to strict
* Record tests other than handlebars
* Trim trailing newlines
* Record tests
* Fix rebase
* Record all tests not only hbs
* Fix the idempotency issue
Adjust dedent for the last child node
* Fix the annoying trailing whitespace
* Trim isolated leading newline
---
docs/options.md | 2 +-
src/language-handlebars/printer-glimmer.js | 45 ++-
.../__snapshots__/jsfmt.spec.js.snap | 12 +-
.../basics/__snapshots__/jsfmt.spec.js.snap | 27 +-
.../__snapshots__/jsfmt.spec.js.snap | 29 +-
.../__snapshots__/jsfmt.spec.js.snap | 16 +-
.../escape/__snapshots__/jsfmt.spec.js.snap | 12 +-
.../__snapshots__/jsfmt.spec.js.snap | 1 -
.../newline/__snapshots__/jsfmt.spec.js.snap | 29 +-
.../__snapshots__/jsfmt.spec.js.snap | 6 +-
.../__snapshots__/jsfmt.spec.js.snap | 175 ++++-------
.../__snapshots__/jsfmt.spec.js.snap | 280 ++++++------------
.../__snapshots__/jsfmt.spec.js.snap | 18 +-
.../__snapshots__/jsfmt.spec.js.snap | 20 +-
14 files changed, 235 insertions(+), 437 deletions(-)
diff --git a/docs/options.md b/docs/options.md
index aad2334b8..fbdd81db8 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -323,7 +323,7 @@ Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars
Valid options:
-- `"css"` - Respect the default value of CSS `display` property. For Handlebars treated same as `ignore`.
+- `"css"` - Respect the default value of CSS `display` property. For Handlebars treated same as `strict`.
- `"strict"` - Whitespace (or the lack of it) around all tags is considered significant.
- `"ignore"` - Whitespace (or the lack of it) around all tags is considered insignificant.
diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js
index 1bc709feb..bb6866e80 100644
--- a/src/language-handlebars/printer-glimmer.js
+++ b/src/language-handlebars/printer-glimmer.js
@@ -60,7 +60,7 @@ function print(path, options, print) {
const startingTag = group(printStartingTag(path, print));
const escapeNextElementNode =
- options.htmlWhitespaceSensitivity !== "strict" &&
+ options.htmlWhitespaceSensitivity === "ignore" &&
isNextNodeOfSomeType(path, ["ElementNode"])
? softline
: "";
@@ -75,7 +75,7 @@ function print(path, options, print) {
return [startingTag, indent(endingTag), escapeNextElementNode];
}
- if (options.htmlWhitespaceSensitivity !== "strict") {
+ if (options.htmlWhitespaceSensitivity === "ignore") {
return [
startingTag,
indent(printChildren(path, options, print)),
@@ -245,13 +245,26 @@ function print(path, options, print) {
const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
const isWhitespaceOnly = whitespacesOnlyRE.test(text);
+ const isFirstElement = !getPreviousNode(path);
+ const isLastElement = !getNextNode(path);
- if (options.htmlWhitespaceSensitivity === "strict") {
+ if (options.htmlWhitespaceSensitivity !== "ignore") {
// https://infra.spec.whatwg.org/#ascii-whitespace
const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
+ // let's remove the file's final newline
+ // https://github.com/ember-cli/ember-new-output/blob/1a04c67ddd02ccb35e0ff41bb5cbce34b31173ef/.editorconfig#L16
+ const shouldTrimTrailingNewlines =
+ isLastElement && isParentOfSomeType(path, ["Template"]);
+ const shouldTrimLeadingNewlines =
+ isFirstElement && isParentOfSomeType(path, ["Template"]);
+
if (isWhitespaceOnly) {
+ if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
+ return "";
+ }
+
let breaks = [line];
const newlines = countNewLines(text);
@@ -275,7 +288,7 @@ function print(path, options, print) {
const leadingNewlines = countNewLines(lead);
if (leadingNewlines) {
- leadBreaks = generateHardlines(countNewLines(lead) || 1);
+ leadBreaks = generateHardlines(leadingNewlines);
}
text = text.replace(leadingWhitespacesRE, "");
@@ -283,11 +296,13 @@ function print(path, options, print) {
let trailBreaks = [];
if (tail) {
- trailBreaks = [line];
+ if (!shouldTrimTrailingNewlines) {
+ trailBreaks = [line];
- const trailingNewlines = countNewLines(tail);
- if (trailingNewlines) {
- trailBreaks = generateHardlines(trailingNewlines || 1);
+ const trailingNewlines = countNewLines(tail);
+ if (trailingNewlines) {
+ trailBreaks = generateHardlines(trailingNewlines);
+ }
if (isLastNodeOfSiblings(path)) {
trailBreaks = trailBreaks.map((hardline) => dedent(hardline));
@@ -300,8 +315,6 @@ function print(path, options, print) {
return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
}
- const isFirstElement = !getPreviousNode(path);
- const isLastElement = !getNextNode(path);
const lineBreaksCount = countNewLines(text);
let leadingLineBreaksCount = countLeadingNewLines(text);
@@ -443,14 +456,14 @@ function printStartingTag(path, print) {
function printChildren(path, options, print) {
const node = path.getValue();
const isEmpty = node.children.every((n) => isWhitespaceNode(n));
- if (options.htmlWhitespaceSensitivity !== "strict" && isEmpty) {
+ if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
return "";
}
return path.map((childPath, childIndex) => {
const printedChild = print(childPath, options, print);
- if (childIndex === 0 && options.htmlWhitespaceSensitivity !== "strict") {
+ if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
return [softline, printedChild];
}
@@ -546,7 +559,7 @@ function printOpenBlock(path, print) {
function printElseBlock(node, options) {
return [
- options.htmlWhitespaceSensitivity !== "strict" ? hardline : "",
+ options.htmlWhitespaceSensitivity === "ignore" ? hardline : "",
printInverseBlockOpeningMustache(node),
"else",
printInverseBlockClosingMustache(node),
@@ -567,7 +580,7 @@ function printElseIfBlock(path, print) {
function printCloseBlock(path, print, options) {
const node = path.getValue();
- if (options.htmlWhitespaceSensitivity !== "strict") {
+ if (options.htmlWhitespaceSensitivity === "ignore") {
const escape = blockStatementHasOnlyWhitespaceInProgram(node)
? softline
: hardline;
@@ -616,7 +629,7 @@ function printProgram(path, print, options) {
const program = path.call(print, "program");
- if (options.htmlWhitespaceSensitivity !== "strict") {
+ if (options.htmlWhitespaceSensitivity === "ignore") {
return indent([hardline, program]);
}
@@ -628,7 +641,7 @@ function printInverse(path, print, options) {
const inverse = path.call(print, "inverse");
const printed =
- options.htmlWhitespaceSensitivity !== "strict"
+ options.htmlWhitespaceSensitivity === "ignore"
? [hardline, inverse]
: inverse;
diff --git a/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
index 455724984..525b90080 100644
--- a/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/attr-node/__snapshots__/jsfmt.spec.js.snap
@@ -123,15 +123,9 @@ weirdly formatted
-
- String
-
-
- String
-
-
- String
-
+String
+String
+String
================================================================================
diff --git a/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
index 33c6a0773..5cad2bbce 100644
--- a/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/basics/__snapshots__/jsfmt.spec.js.snap
@@ -37,7 +37,8 @@ printWidth: 80
=====================================output=====================================
-{{@greeting}}, {{@name}}!
+{{@greeting}},
+{{@name}}!
-
- hello
-
+ hello
-
- Next
-
+Next
@@ -64,9 +61,7 @@ printWidth: 80
-
- Hello
-
+Hello
@@ -115,12 +110,8 @@ printWidth: 80
=====================================output=====================================
-
- {{title}}
-
-
- By {{author.name}}
-
+
{{title}}
+
By {{author.name}}
{{body}}
@@ -138,8 +129,6 @@ printWidth: 80
{{{raw}}}
=====================================output=====================================
-
- {{{raw}}}
-
+
{{{raw}}}
================================================================================
`;
diff --git a/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
index dd66782d2..3c835f71f 100644
--- a/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/block-statement/__snapshots__/jsfmt.spec.js.snap
@@ -153,7 +153,8 @@ printWidth: 80
- {{firstName}} {{lastName}}
+ {{firstName}}
+ {{lastName}}
================================================================================
`;
@@ -174,14 +175,8 @@ printWidth: 80
=====================================output=====================================
================================================================================
@@ -393,20 +388,14 @@ printWidth: 80
{{#if a}}
a
-
- b
-
+
b
c
{{else}}
{{#if c}}
a b
-
- c
-
+
c
{{/if}}
-
- a
-
+
a
b c
{{/if}}
@@ -433,9 +422,7 @@ printWidth: 80
=====================================output=====================================
{{#each speakers key="@index" as |speaker|}}
-
- {{speaker}}
-
+ {{speaker}}
{{/each}}
================================================================================
diff --git a/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
index f3b990352..b2f786418 100644
--- a/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/handlebars/concat-statement/__snapshots__/jsfmt.spec.js.snap
@@ -135,16 +135,12 @@ singleQuote: true
class='a very long list of classes that exceeds
{{eighty}}
chars with emtpy spaces'
->
- hey
-
+>hey
- Link
-
+>Link
-
- {{title}}
-
-
- {{body}}
-
-
+ {{title}}
+ {{body}}
- - {{title}} - -
-{{title}}
+