From b46710f2d9cd53a83ac615d68b6b2f20ae600493 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 22 Nov 2020 09:24:22 +0900 Subject: [PATCH 01/35] Fix formatting for AssignmentExpression with ClassExpression (#9741) * Fix formatting for asignment with superClass * Add tests * Changelog * For only AssignmentExpression * Remove unnecesary ifBreak --- changelog_unreleased/javascript/9741.md | 27 +++++++++++++++++++ src/language-js/print/class.js | 14 +++++----- .../classes/__snapshots__/jsfmt.spec.js.snap | 16 ++++++++--- tests/js/classes/assignment.js | 6 +++++ 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 changelog_unreleased/javascript/9741.md diff --git a/changelog_unreleased/javascript/9741.md b/changelog_unreleased/javascript/9741.md new file mode 100644 index 000000000000..94caafe8cbba --- /dev/null +++ b/changelog_unreleased/javascript/9741.md @@ -0,0 +1,27 @@ +#### Fix formatting for AssignmentExpression with ClassExpression (#9741 by @sosukesuzuki) + + +```js +// Input +module.exports = class A extends B { + method() { + console.log("foo"); + } +}; + +// Prettier stable +module.exports = class A extends ( + B +) { + method() { + console.log("foo"); + } +}; + +// Prettier master +module.exports = class A extends B { + method() { + console.log("foo"); + } +}; +``` diff --git a/src/language-js/print/class.js b/src/language-js/print/class.js index 2e48dfeb1884..ecefce26c9d5 100644 --- a/src/language-js/print/class.js +++ b/src/language-js/print/class.js @@ -131,13 +131,13 @@ function printList(path, options, print, listName) { function printSuperClass(path, options, print) { const printed = path.call(print, "superClass"); const parent = path.getParentNode(); - if (parent && parent.type === "AssignmentExpression") { - return concat([ - ifBreak("("), - indent(concat([softline, printed])), - softline, - ifBreak(")"), - ]); + if (parent.type === "AssignmentExpression") { + return group( + ifBreak( + concat(["(", indent(concat([softline, printed])), softline, ")"]), + printed + ) + ); } return printed; } diff --git a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap index 2025489e6c3d..44873cab8812 100644 --- a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap @@ -32,6 +32,12 @@ foo = class extends aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggg } }; +module.exports = class A extends B { + method () { + console.log("foo"); + } +}; + =====================================output===================================== aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends ( aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 @@ -41,9 +47,7 @@ aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends } }; -foo = class extends ( - bar -) { +foo = class extends bar { method() { console.log("foo"); } @@ -65,6 +69,12 @@ foo = class extends ( } }; +module.exports = class A extends B { + method() { + console.log("foo"); + } +}; + ================================================================================ `; diff --git a/tests/js/classes/assignment.js b/tests/js/classes/assignment.js index dc0f6c4b6ea1..56f7348cc83a 100644 --- a/tests/js/classes/assignment.js +++ b/tests/js/classes/assignment.js @@ -23,3 +23,9 @@ foo = class extends aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggg console.log("foo"); } }; + +module.exports = class A extends B { + method () { + console.log("foo"); + } +}; From 81bfd3ffc72d3c971e3b6962157a90c8bf12be50 Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Thu, 26 Nov 2020 02:42:41 +0900 Subject: [PATCH 02/35] Fix changelog to old format --- changelog_unreleased/javascript/{9741.md => pr-9741.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog_unreleased/javascript/{9741.md => pr-9741.md} (100%) diff --git a/changelog_unreleased/javascript/9741.md b/changelog_unreleased/javascript/pr-9741.md similarity index 100% rename from changelog_unreleased/javascript/9741.md rename to changelog_unreleased/javascript/pr-9741.md From 25d53fa9b3129db81c81eb4c97ba2b79a68e736e Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 26 Nov 2020 19:28:00 +0800 Subject: [PATCH 03/35] SCSS/LESS: Fix comment inside parens (#9710) --- changelog_unreleased/scss/pr-9710.md | 23 +++++++++++ src/language-css/printer-postcss.js | 7 ++++ .../comments/__snapshots__/jsfmt.spec.js.snap | 40 +++++++++++++++++++ tests/less/comments/in-value.less | 14 +++++++ .../comments/__snapshots__/jsfmt.spec.js.snap | 40 +++++++++++++++++++ tests/scss/comments/in-value.scss | 14 +++++++ 6 files changed, 138 insertions(+) create mode 100644 changelog_unreleased/scss/pr-9710.md create mode 100644 tests/less/comments/in-value.less create mode 100644 tests/scss/comments/in-value.scss diff --git a/changelog_unreleased/scss/pr-9710.md b/changelog_unreleased/scss/pr-9710.md new file mode 100644 index 000000000000..ca92c1a212c7 --- /dev/null +++ b/changelog_unreleased/scss/pr-9710.md @@ -0,0 +1,23 @@ +#### Fix broken comment inside parens (#9710 by @fisker) + + +```scss +// Input +.simplification { + foo: ( + calc() // not a comment anymore + ); +} + +// Prettier stable +.simplification { + foo: (calc() // not a comment anymore); +} + +// Prettier master +.simplification { + foo: ( + calc() // not a comment anymore + ); +} +``` diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js index 74b5ec151fe5..bbbf0c3e6ebe 100644 --- a/src/language-css/printer-postcss.js +++ b/src/language-css/printer-postcss.js @@ -534,6 +534,9 @@ function genericPrint(path, options, print) { const atRuleAncestorNode = getAncestorNode(path, "css-atrule"); const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode); + const hasInlineComment = node.groups.some((node) => + isInlineValueCommentNode(node) + ); const printed = path.map(print, "groups"); const parts = []; @@ -800,6 +803,10 @@ function genericPrint(path, options, print) { parts.push(line); } + if (hasInlineComment) { + parts.push(breakParent); + } + if (didBreak) { parts.unshift(hardline); } diff --git a/tests/less/comments/__snapshots__/jsfmt.spec.js.snap b/tests/less/comments/__snapshots__/jsfmt.spec.js.snap index ba0123c2a795..d34539e2bca9 100644 --- a/tests/less/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/less/comments/__snapshots__/jsfmt.spec.js.snap @@ -198,6 +198,46 @@ printWidth: 80 ================================================================================ `; +exports[`in-value.less format 1`] = ` +====================================options===================================== +parsers: ["less"] +printWidth: 80 + | printWidth +=====================================input====================================== +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} + +=====================================output===================================== +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} + +================================================================================ +`; + exports[`issue-8130.less format 1`] = ` ====================================options===================================== parsers: ["less"] diff --git a/tests/less/comments/in-value.less b/tests/less/comments/in-value.less new file mode 100644 index 000000000000..4729f124ee55 --- /dev/null +++ b/tests/less/comments/in-value.less @@ -0,0 +1,14 @@ +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} diff --git a/tests/scss/comments/__snapshots__/jsfmt.spec.js.snap b/tests/scss/comments/__snapshots__/jsfmt.spec.js.snap index d6d3607621e6..45cf082b42c7 100644 --- a/tests/scss/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/scss/comments/__snapshots__/jsfmt.spec.js.snap @@ -338,6 +338,46 @@ printWidth: 80 ================================================================================ `; +exports[`in-value.scss format 1`] = ` +====================================options===================================== +parsers: ["scss"] +printWidth: 80 + | printWidth +=====================================input====================================== +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} + +=====================================output===================================== +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} + +================================================================================ +`; + exports[`lists.scss format 1`] = ` ====================================options===================================== parsers: ["scss"] diff --git a/tests/scss/comments/in-value.scss b/tests/scss/comments/in-value.scss new file mode 100644 index 000000000000..4729f124ee55 --- /dev/null +++ b/tests/scss/comments/in-value.scss @@ -0,0 +1,14 @@ +.real-world-example { + background: radial-gradient( + circle at left 0% bottom $position, + transparent, + transparent $diameter, + #fbfbfb calc(#{$diameter} + 1px) // Add 1px for edge-smoothing. + ); +} + +.simplification { + foo: ( + calc() // not a comment anymore + ); +} From 664d0d33b519b093f2be3a35357debeecdf941e2 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 26 Nov 2020 19:30:57 +0800 Subject: [PATCH 04/35] Fix inconsistent language comment detection (#9743) --- changelog_unreleased/javascript/9743.md | 19 +++++++++++++++++++ src/language-js/comments.js | 15 --------------- src/language-js/embed.js | 9 ++++----- .../__snapshots__/jsfmt.spec.js.snap | 19 +++++++++++++++++++ .../language-comment/jsfmt.spec.js | 1 + .../language-comment/not-language-comment.js | 3 +++ 6 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 changelog_unreleased/javascript/9743.md create mode 100644 tests/js/multiparser-html/language-comment/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/js/multiparser-html/language-comment/jsfmt.spec.js create mode 100644 tests/js/multiparser-html/language-comment/not-language-comment.js diff --git a/changelog_unreleased/javascript/9743.md b/changelog_unreleased/javascript/9743.md new file mode 100644 index 000000000000..376d20e92616 --- /dev/null +++ b/changelog_unreleased/javascript/9743.md @@ -0,0 +1,19 @@ +#### Fix inconsistent language comment detection (#9743 by @fisker) + + +```jsx +// Input +foo /* HTML */ = `
+
`; + +// Prettier stable (--parser=babel) +foo /* HTML */ = `
`; + +// Prettier stable (--parser=meriyah) +foo /* HTML */ = `
+
`; + +// Prettier master (All JavaScript parsers) +foo /* HTML */ = `
+
`; +``` diff --git a/src/language-js/comments.js b/src/language-js/comments.js index af0866175f23..91cd34ffac77 100644 --- a/src/language-js/comments.js +++ b/src/language-js/comments.js @@ -19,8 +19,6 @@ const { hasFlowShorthandAnnotationComment, hasFlowAnnotationComment, hasIgnoreComment, - hasComment, - CommentCheckFlags, } = require("./utils"); const { locStart, locEnd } = require("./loc"); @@ -866,18 +864,6 @@ function handleTSMappedTypeComments({ return false; } -/** - * @param {Node} node - * @param {(comment: Comment) => boolean} fn - * @returns boolean - */ -function hasLeadingComment(node, fn = () => true) { - if (node.leadingComments) { - return node.leadingComments.some(fn); - } - return hasComment(node, CommentCheckFlags.Leading, fn); -} - /** * @param {Node} node * @returns {boolean} @@ -994,7 +980,6 @@ module.exports = { handleOwnLineComment, handleEndOfLineComment, handleRemainingComment, - hasLeadingComment, isTypeCastComment, getGapRegex, getCommentChildNodes, diff --git a/src/language-js/embed.js b/src/language-js/embed.js index 7c7ee3eb9c7b..3058e7868dc8 100644 --- a/src/language-js/embed.js +++ b/src/language-js/embed.js @@ -1,7 +1,6 @@ "use strict"; -const { isBlockComment } = require("./utils"); -const { hasLeadingComment } = require("./comments"); +const { hasComment, CommentCheckFlags } = require("./utils"); const formatMarkdown = require("./embed/markdown"); const formatCss = require("./embed/css"); const formatGraphql = require("./embed/graphql"); @@ -267,10 +266,10 @@ function hasLanguageComment(node, languageName) { // we will not trim the comment value and we will expect exactly one space on // either side of the GraphQL string // Also see ./clean.js - return hasLeadingComment( + return hasComment( node, - (comment) => - isBlockComment(comment) && comment.value === ` ${languageName} ` + CommentCheckFlags.Block | CommentCheckFlags.Leading, + ({ value }) => value === ` ${languageName} ` ); } diff --git a/tests/js/multiparser-html/language-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/multiparser-html/language-comment/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..025e71c48160 --- /dev/null +++ b/tests/js/multiparser-html/language-comment/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`not-language-comment.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +const html /* HTML */ = \`
+ +
\`; + +=====================================output===================================== +const html /* HTML */ = \`
+ +
\`; + +================================================================================ +`; diff --git a/tests/js/multiparser-html/language-comment/jsfmt.spec.js b/tests/js/multiparser-html/language-comment/jsfmt.spec.js new file mode 100644 index 000000000000..eb85eda6bd02 --- /dev/null +++ b/tests/js/multiparser-html/language-comment/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["babel", "flow", "typescript"]); diff --git a/tests/js/multiparser-html/language-comment/not-language-comment.js b/tests/js/multiparser-html/language-comment/not-language-comment.js new file mode 100644 index 000000000000..ee5517b7b78b --- /dev/null +++ b/tests/js/multiparser-html/language-comment/not-language-comment.js @@ -0,0 +1,3 @@ +const html /* HTML */ = `
+ +
`; From 9f422f6a37705ace948f5f3589ba53e6e2feac33 Mon Sep 17 00:00:00 2001 From: fisker Date: Thu, 26 Nov 2020 20:20:39 +0800 Subject: [PATCH 05/35] Fix `lint:changelog` --- changelog_unreleased/scss/{pr-9710.md => 9710.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog_unreleased/scss/{pr-9710.md => 9710.md} (100%) diff --git a/changelog_unreleased/scss/pr-9710.md b/changelog_unreleased/scss/9710.md similarity index 100% rename from changelog_unreleased/scss/pr-9710.md rename to changelog_unreleased/scss/9710.md From 3a6d659ecc16d81dcc2c5248c6d22186b82e3d9d Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Thu, 26 Nov 2020 19:19:40 +0200 Subject: [PATCH 06/35] =?UTF-8?q?Update=20option=20philosophy:=20option=20?= =?UTF-8?q?requests=20aren=E2=80=99t=20accepted=20anymore=20(#8540)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update option philosophy: option requests aren’t accepted anymore * Update docs/option-philosophy.md Co-authored-by: Lucas Azzola * Update option-philosophy.md Co-authored-by: Lucas Azzola --- docs/option-philosophy.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/docs/option-philosophy.md b/docs/option-philosophy.md index f56fdda7afd2..a1966fd5366c 100644 --- a/docs/option-philosophy.md +++ b/docs/option-philosophy.md @@ -3,17 +3,17 @@ id: option-philosophy title: Option Philosophy --- -> Prettier has a few options because of history. **But we don’t want more of them.** +> Prettier has a few options because of history. **But we won’t add more of them.** > > Read on to learn more. Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish. It is _opinionated._ Quoting the [Why Prettier?](why-prettier.md) page: -> By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. +> By far the biggest reason for adopting Prettier is to stop all the ongoing debates over styles. -The more options Prettier has, the further from the above goal it gets. **The debates over styles just turn into debates over which Prettier options to use.** +Yet the more options Prettier has, the further from the above goal it gets. **The debates over styles just turn into debates over which Prettier options to use.** Formatting wars break out with renewed vigour: “Which option values are better? Why? Did we make the right choices?” -The issue about [resisting adding configuration](https://github.com/prettier/prettier/issues/40) has more 👍s than any option request issue. +And it’s not the only cost options have. To learn more about their downsides, see the [issue about resisting adding configuration](https://github.com/prettier/prettier/issues/40), which has more 👍s than any option request issue. So why are there any options at all? @@ -21,27 +21,18 @@ So why are there any options at all? - A couple were added after “great demand.” 🤔 - Some were added for compatibility reasons. 👍 -What we’ve learned during the years is that it’s really hard to measure demand. Prettier has grown _a lot_ in usage. What was “great demand” back in the day is not as much today. How many is many? What about all silent users? - -It’s so easy to add “just one more“ option. But where do we stop? When is one too many? There will always be a “top issue” in the issue tracker. Even if we add just that one final option. - -The downside of options is that they open up for debate within teams. Which options should we use? Why? Did we make the right choices? - -Every option also makes it much harder to say no to new ones. If _those_ options exist, why can’t this one? - -We’ve had several users open up option requests only to close them themselves a couple of months later. They had realized that they don’t care at all about that little syntax choice they used to feel so strongly about. Examples: [#3101](https://github.com/prettier/prettier/issues/3101#issuecomment-500927917) and [#5501](https://github.com/prettier/prettier/issues/5501#issuecomment-487025417). - -All of this makes the topic of options in Prettier very difficult. And mentally tiring for maintainers. What do people want? What do people _really_ want in 6 months? Are we spending time and energy on the right things? - -Some options are easier to motivate: +Options that are easier to motivate include: - `--trailing-comma es5` lets you use trailing commas in most environments without having to transpile (trailing function commas were added in ES2017). -- `--prose-wrap` is important to support all quirky markdown renderers in the wild. +- `--prose-wrap` is important to support all quirky Markdown renderers in the wild. - `--html-whitespace-sensitivity` is needed due to the unfortunate whitespace rules of HTML. - `--end-of-line` makes it easier for teams to keep CRLFs out of their git repositories. - `--quote-props` is important for advanced usage of the Google Closure Compiler. -But others are harder to motivate in hindsight, and usually end up with bike shedding. `--arrow-parens`, -`--jsx-single-quote`, `--jsx-bracket-same-line` and `--no-bracket-spacing` are not the type of options we want more of. They exist (and are difficult to remove now), but should not motivate adding more options like them. +But other options are harder to motivate in hindsight: `--arrow-parens`, `--jsx-single-quote`, `--jsx-bracket-same-line` and `--no-bracket-spacing` are not the type of options we’re happy to have. They cause a lot of [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) in teams, and we’re sorry for that. Difficult to remove now, these options exist as a historical artifact and should not motivate adding more options (“If _those_ options exist, why can’t this one?”). + +For a long time, we left option requests open in order to let discussions play out and collect feedback. What we’ve learned during those years is that it’s really hard to measure demand. Prettier has grown a lot in usage. What was “great demand” back in the day is not as much today. GitHub reactions and Twitter polls became unrepresentative. What about all silent users? It looked easy to add “just one more” option. But where should we have stopped? When is one too many? Even after adding “that one final option”, there would always be a “top issue” in the issue tracker. + +However, the time to stop has come. Now that Prettier is mature enough and we see it adopted by so many organizations and projects, the research phase is over. We have enough confidence to conclude that Prettier reached a point where the set of options should be “frozen”. **Option requests aren’t accepted anymore.** We’re thankful to everyone who participated in this difficult journey. -Feel free to open issues! Prettier isn’t perfect. Many times things can be improved without adding options. But if the issue _does_ seem to need a new option, we’ll generally keep it open, to let people 👍 it and add comments. +Please note that as option requests are out of scope for Prettier, they will be closed without discussion. The same applies to requests to preserve elements of input formatting (e.g. line breaks) since that’s nothing else but an option in disguise with all the downsides of “real” options. There may be situations where adding an option can’t be avoided because of technical necessity (e.g. compatibility), but for formatting-related options, this is final. From c0e117939125d72485fbc56ae37dbb7d995457b0 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Thu, 26 Nov 2020 19:29:25 +0200 Subject: [PATCH 07/35] copy option philosophy to stable docs --- .../version-stable/option-philosophy.md | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/website/versioned_docs/version-stable/option-philosophy.md b/website/versioned_docs/version-stable/option-philosophy.md index 7d3d55f5ca42..ed53cd2a3b1a 100644 --- a/website/versioned_docs/version-stable/option-philosophy.md +++ b/website/versioned_docs/version-stable/option-philosophy.md @@ -4,17 +4,17 @@ title: Option Philosophy original_id: option-philosophy --- -> Prettier has a few options because of history. **But we don’t want more of them.** +> Prettier has a few options because of history. **But we won’t add more of them.** > > Read on to learn more. Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish. It is _opinionated._ Quoting the [Why Prettier?](why-prettier.md) page: -> By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. +> By far the biggest reason for adopting Prettier is to stop all the ongoing debates over styles. -The more options Prettier has, the further from the above goal it gets. **The debates over styles just turn into debates over which Prettier options to use.** +Yet the more options Prettier has, the further from the above goal it gets. **The debates over styles just turn into debates over which Prettier options to use.** Formatting wars break out with renewed vigour: “Which option values are better? Why? Did we make the right choices?” -The issue about [resisting adding configuration](https://github.com/prettier/prettier/issues/40) has more 👍s than any option request issue. +And it’s not the only cost options have. To learn more about their downsides, see the [issue about resisting adding configuration](https://github.com/prettier/prettier/issues/40), which has more 👍s than any option request issue. So why are there any options at all? @@ -22,27 +22,18 @@ So why are there any options at all? - A couple were added after “great demand.” 🤔 - Some were added for compatibility reasons. 👍 -What we’ve learned during the years is that it’s really hard to measure demand. Prettier has grown _a lot_ in usage. What was “great demand” back in the day is not as much today. How many is many? What about all silent users? - -It’s so easy to add “just one more“ option. But where do we stop? When is one too many? There will always be a “top issue” in the issue tracker. Even if we add just that one final option. - -The downside of options is that they open up for debate within teams. Which options should we use? Why? Did we make the right choices? - -Every option also makes it much harder to say no to new ones. If _those_ options exist, why can’t this one? - -We’ve had several users open up option requests only to close them themselves a couple of months later. They had realized that they don’t care at all about that little syntax choice they used to feel so strongly about. Examples: [#3101](https://github.com/prettier/prettier/issues/3101#issuecomment-500927917) and [#5501](https://github.com/prettier/prettier/issues/5501#issuecomment-487025417). - -All of this makes the topic of options in Prettier very difficult. And mentally tiring for maintainers. What do people want? What do people _really_ want in 6 months? Are we spending time and energy on the right things? - -Some options are easier to motivate: +Options that are easier to motivate include: - `--trailing-comma es5` lets you use trailing commas in most environments without having to transpile (trailing function commas were added in ES2017). -- `--prose-wrap` is important to support all quirky markdown renderers in the wild. +- `--prose-wrap` is important to support all quirky Markdown renderers in the wild. - `--html-whitespace-sensitivity` is needed due to the unfortunate whitespace rules of HTML. - `--end-of-line` makes it easier for teams to keep CRLFs out of their git repositories. - `--quote-props` is important for advanced usage of the Google Closure Compiler. -But others are harder to motivate in hindsight, and usually end up with bike shedding. `--arrow-parens`, -`--jsx-single-quote`, `--jsx-bracket-same-line` and `--no-bracket-spacing` are not the type of options we want more of. They exist (and are difficult to remove now), but should not motivate adding more options like them. +But other options are harder to motivate in hindsight: `--arrow-parens`, `--jsx-single-quote`, `--jsx-bracket-same-line` and `--no-bracket-spacing` are not the type of options we’re happy to have. They cause a lot of [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) in teams, and we’re sorry for that. Difficult to remove now, these options exist as a historical artifact and should not motivate adding more options (“If _those_ options exist, why can’t this one?”). + +For a long time, we left option requests open in order to let discussions play out and collect feedback. What we’ve learned during those years is that it’s really hard to measure demand. Prettier has grown a lot in usage. What was “great demand” back in the day is not as much today. GitHub reactions and Twitter polls became unrepresentative. What about all silent users? It looked easy to add “just one more” option. But where should we have stopped? When is one too many? Even after adding “that one final option”, there would always be a “top issue” in the issue tracker. + +However, the time to stop has come. Now that Prettier is mature enough and we see it adopted by so many organizations and projects, the research phase is over. We have enough confidence to conclude that Prettier reached a point where the set of options should be “frozen”. **Option requests aren’t accepted anymore.** We’re thankful to everyone who participated in this difficult journey. -Feel free to open issues! Prettier isn’t perfect. Many times things can be improved without adding options. But if the issue _does_ seem to need a new option, we’ll generally keep it open, to let people 👍 it and add comments. +Please note that as option requests are out of scope for Prettier, they will be closed without discussion. The same applies to requests to preserve elements of input formatting (e.g. line breaks) since that’s nothing else but an option in disguise with all the downsides of “real” options. There may be situations where adding an option can’t be avoided because of technical necessity (e.g. compatibility), but for formatting-related options, this is final. From e6af1534cdf5534dadf85d6d04442975d1617ab8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 05:47:08 +0000 Subject: [PATCH 08/35] Build(deps-dev): Bump babel-loader from 8.2.1 to 8.2.2 in /website (#9778) --- website/package.json | 2 +- website/yarn.lock | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/website/package.json b/website/package.json index bdfc9adb83e7..191102641f9f 100644 --- a/website/package.json +++ b/website/package.json @@ -18,7 +18,7 @@ "devDependencies": { "@babel/preset-react": "7.12.7", "@sandhose/prettier-animated-logo": "1.0.3", - "babel-loader": "8.2.1", + "babel-loader": "8.2.2", "concurrently": "5.3.0", "docusaurus": "1.14.6", "js-yaml": "3.14.0", diff --git a/website/yarn.lock b/website/yarn.lock index 0ccd81db8e6b..21df270e2744 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -1525,15 +1525,14 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-loader@8.2.1: - version "8.2.1" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.1.tgz#e53313254677e86f27536f5071d807e01d24ec00" - integrity sha512-dMF8sb2KQ8kJl21GUjkW1HWmcsL39GOV5vnzjqrCzEPNY0S0UfMLnumidiwIajDSBmKhYf5iRW+HXaM4cvCKBw== +babel-loader@8.2.2: + version "8.2.2" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81" + integrity sha512-JvTd0/D889PQBtUXJ2PXaKU/pjZDMtHA9V2ecm+eNRmmBCMR09a+fmpGTNwnJtFmFl5Ei7Vy47LjBb+L0wQ99g== dependencies: - find-cache-dir "^2.1.0" + find-cache-dir "^3.3.1" loader-utils "^1.4.0" - make-dir "^2.1.0" - pify "^4.0.1" + make-dir "^3.1.0" schema-utils "^2.6.5" babel-plugin-dynamic-import-node@^2.3.3: @@ -3235,7 +3234,7 @@ finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: +find-cache-dir@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== @@ -3244,6 +3243,15 @@ find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: make-dir "^2.0.0" pkg-dir "^3.0.0" +find-cache-dir@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" + integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== + dependencies: + commondir "^1.0.1" + make-dir "^3.0.2" + pkg-dir "^4.1.0" + find-up@3.0.0, find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -4695,6 +4703,13 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" +make-dir@^3.0.2, make-dir@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -5447,7 +5462,7 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -pkg-dir@^4.2.0: +pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -6391,6 +6406,11 @@ semver@7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== +semver@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + send@0.17.1: version "0.17.1" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" From ce724ef422f2cf631107c9d6aa3234341b977bad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 05:55:33 +0000 Subject: [PATCH 09/35] Build(deps-dev): Bump webpack from 5.6.0 to 5.8.0 in /website (#9779) --- website/package.json | 2 +- website/yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/website/package.json b/website/package.json index 191102641f9f..62f6b3dd65e8 100644 --- a/website/package.json +++ b/website/package.json @@ -23,7 +23,7 @@ "docusaurus": "1.14.6", "js-yaml": "3.14.0", "svgo": "1.3.2", - "webpack": "5.6.0", + "webpack": "5.8.0", "webpack-cli": "4.2.0" } } diff --git a/website/yarn.lock b/website/yarn.lock index 21df270e2744..dca841d63650 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -6935,10 +6935,10 @@ tapable@^1.0.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tapable@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.0.0.tgz#a49c3d6a8a2bb606e7db372b82904c970d537a08" - integrity sha512-bjzn0C0RWoffnNdTzNi7rNDhs1Zlwk2tRXgk8EiHKAOX1Mag3d6T0Y5zNa7l9CJ+EoUne/0UHdwS8tMbkh9zDg== +tapable@^2.0.0, tapable@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.1.1.tgz#b01cc1902d42a7bb30514e320ce21c456f72fd3f" + integrity sha512-Wib1S8m2wdpLbmQz0RBEVosIyvb/ykfKXf3ZIDqvWoMg/zTNm6G/tDSuUM61J1kNCDXWJrLHGSFeMhAG+gAGpQ== tar-stream@^1.5.2: version "1.6.2" @@ -7393,10 +7393,10 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.6.0.tgz#282d10434c403b070ed91d459b385e873b51a07d" - integrity sha512-SIeFuBhuheKElRbd84O35UhKc0nxlgSwtzm2ksZ0BVhRJqxVJxEguT/pYhfiR0le/pxTa1VsCp7EOYyTsa6XOA== +webpack@5.8.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.8.0.tgz#65f00a181708279ff982c2d7338e1dd5505364c4" + integrity sha512-X2yosPiHip3L0TE+ylruzrOqSgEgsdGyBOGFWKYChcwlKChaw9VodZIUovG1oo7s0ss6e3ZxBMn9tXR+nkPThA== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.45" @@ -7418,7 +7418,7 @@ webpack@5.6.0: neo-async "^2.6.2" pkg-dir "^4.2.0" schema-utils "^3.0.0" - tapable "^2.0.0" + tapable "^2.1.1" terser-webpack-plugin "^5.0.3" watchpack "^2.0.0" webpack-sources "^2.1.1" From 4e0396b87bcf3b7ec4968a68ff4d1e3ed6d80bcc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 08:04:44 +0000 Subject: [PATCH 10/35] Build(deps-dev): Bump babel-loader from 8.2.1 to 8.2.2 (#9781) --- package.json | 2 +- yarn.lock | 74 +++++++++++----------------------------------------- 2 files changed, 16 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index 7479d4de3f3b..1a4c8448a7c9 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@types/node": "14.14.0", "@typescript-eslint/types": "4.8.2", "babel-jest": "26.6.3", - "babel-loader": "8.2.1", + "babel-loader": "8.2.2", "benchmark": "2.1.4", "builtin-modules": "3.1.0", "cross-env": "7.0.2", diff --git a/yarn.lock b/yarn.lock index ffff03a199b3..4d2a110582ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1933,15 +1933,14 @@ babel-jest@26.6.3, babel-jest@^26.6.3: graceful-fs "^4.2.4" slash "^3.0.0" -babel-loader@8.2.1: - version "8.2.1" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.1.tgz#e53313254677e86f27536f5071d807e01d24ec00" - integrity sha512-dMF8sb2KQ8kJl21GUjkW1HWmcsL39GOV5vnzjqrCzEPNY0S0UfMLnumidiwIajDSBmKhYf5iRW+HXaM4cvCKBw== +babel-loader@8.2.2: + version "8.2.2" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81" + integrity sha512-JvTd0/D889PQBtUXJ2PXaKU/pjZDMtHA9V2ecm+eNRmmBCMR09a+fmpGTNwnJtFmFl5Ei7Vy47LjBb+L0wQ99g== dependencies: - find-cache-dir "^2.1.0" + find-cache-dir "^3.3.1" loader-utils "^1.4.0" - make-dir "^2.1.0" - pify "^4.0.1" + make-dir "^3.1.0" schema-utils "^2.6.5" babel-plugin-dynamic-import-node@^2.3.3: @@ -3188,7 +3187,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.21.5: version "7.21.5" @@ -3561,14 +3559,14 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-cache-dir@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" - integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== +find-cache-dir@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" + integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== dependencies: commondir "^1.0.1" - make-dir "^2.0.0" - pkg-dir "^3.0.0" + make-dir "^3.0.2" + pkg-dir "^4.1.0" find-parent-dir@0.3.0: version "0.3.0" @@ -3582,13 +3580,6 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - dependencies: - locate-path "^3.0.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -5172,14 +5163,6 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -5236,15 +5219,7 @@ magic-string@^0.25.7: dependencies: sourcemap-codec "^1.4.4" -make-dir@^2.0.0, make-dir@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" - integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== - dependencies: - pify "^4.0.1" - semver "^5.6.0" - -make-dir@^3.0.0: +make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== @@ -5683,7 +5658,7 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0, p-limit@^2.2.0: +p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== @@ -5704,13 +5679,6 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - dependencies: - p-limit "^2.0.0" - p-locate@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" @@ -5872,11 +5840,6 @@ pify@^3.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= -pify@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" - integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== - pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -5891,14 +5854,7 @@ pkg-dir@^2.0.0: dependencies: find-up "^2.1.0" -pkg-dir@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" - integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== - dependencies: - find-up "^3.0.0" - -pkg-dir@^4.2.0: +pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== From 5bbc45971dc16fd1a6446082d9bb658db03d7332 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 08:24:17 +0000 Subject: [PATCH 11/35] Build(deps-dev): Bump webpack from 5.6.0 to 5.8.0 (#9780) --- package.json | 2 +- yarn.lock | 47 +++++++++++------------------------------------ 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 1a4c8448a7c9..4613ef3696a4 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "synchronous-promise": "2.0.15", "tempy": "1.0.0", "terser-webpack-plugin": "5.0.3", - "webpack": "5.6.0" + "webpack": "5.8.0" }, "scripts": { "prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1", diff --git a/yarn.lock b/yarn.lock index 4d2a110582ee..b9f859ba2e99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2076,17 +2076,7 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.14.5: - version "4.14.5" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.5.tgz#1c751461a102ddc60e40993639b709be7f2c4015" - integrity sha512-Z+vsCZIvCBvqLoYkBFTwEYH3v5MCQbsAjp50ERycpOjnPmolg1Gjy4+KaWWpm8QOJt9GHkhdqAl14NpCX73CWA== - dependencies: - caniuse-lite "^1.0.30001135" - electron-to-chromium "^1.3.571" - escalade "^3.1.0" - node-releases "^1.1.61" - -browserslist@^4.14.6: +browserslist@^4.14.5, browserslist@^4.14.6: version "4.14.7" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.7.tgz#c071c1b3622c1c2e790799a37bb09473a4351cb6" integrity sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ== @@ -2149,11 +2139,6 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30001135: - version "1.0.30001148" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz#dc97c7ed918ab33bf8706ddd5e387287e015d637" - integrity sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw== - caniuse-lite@^1.0.30001157: version "1.0.30001159" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001159.tgz#bebde28f893fa9594dadcaa7d6b8e2aa0299df20" @@ -2982,11 +2967,6 @@ editorconfig@0.15.3: semver "^5.6.0" sigmund "^1.0.1" -electron-to-chromium@^1.3.571: - version "1.3.578" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.578.tgz#e6671936f4571a874eb26e2e833aa0b2c0b776e0" - integrity sha512-z4gU6dA1CbBJsAErW5swTGAaU2TBzc2mPAonJb00zqW1rOraDo2zfBMDRvaz9cVic+0JEZiYbHWPw/fTaZlG2Q== - electron-to-chromium@^1.3.591: version "1.3.603" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.603.tgz#1b71bec27fb940eccd79245f6824c63d5f7e8abf" @@ -3085,7 +3065,7 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -escalade@^3.1.0, escalade@^3.1.1: +escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== @@ -5435,11 +5415,6 @@ node-notifier@^8.0.0: uuid "^8.3.0" which "^2.0.2" -node-releases@^1.1.61: - version "1.1.61" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.61.tgz#707b0fca9ce4e11783612ba4a2fcba09047af16e" - integrity sha512-DD5vebQLg8jLCOzwupn954fbIiZht05DAZs0k2u8NStSe6h9XdsuIQL8hSRKYiU8WUQRznmSDrKGbv3ObOmC7g== - node-releases@^1.1.66: version "1.1.67" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.67.tgz#28ebfcccd0baa6aad8e8d4d8fe4cbc49ae239c12" @@ -6909,10 +6884,10 @@ table@^5.2.3: slice-ansi "^2.1.0" string-width "^3.0.0" -tapable@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.0.0.tgz#a49c3d6a8a2bb606e7db372b82904c970d537a08" - integrity sha512-bjzn0C0RWoffnNdTzNi7rNDhs1Zlwk2tRXgk8EiHKAOX1Mag3d6T0Y5zNa7l9CJ+EoUne/0UHdwS8tMbkh9zDg== +tapable@^2.0.0, tapable@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.1.1.tgz#b01cc1902d42a7bb30514e320ce21c456f72fd3f" + integrity sha512-Wib1S8m2wdpLbmQz0RBEVosIyvb/ykfKXf3ZIDqvWoMg/zTNm6G/tDSuUM61J1kNCDXWJrLHGSFeMhAG+gAGpQ== temp-dir@^2.0.0: version "2.0.0" @@ -7434,10 +7409,10 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.6.0.tgz#282d10434c403b070ed91d459b385e873b51a07d" - integrity sha512-SIeFuBhuheKElRbd84O35UhKc0nxlgSwtzm2ksZ0BVhRJqxVJxEguT/pYhfiR0le/pxTa1VsCp7EOYyTsa6XOA== +webpack@5.8.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.8.0.tgz#65f00a181708279ff982c2d7338e1dd5505364c4" + integrity sha512-X2yosPiHip3L0TE+ylruzrOqSgEgsdGyBOGFWKYChcwlKChaw9VodZIUovG1oo7s0ss6e3ZxBMn9tXR+nkPThA== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.45" @@ -7459,7 +7434,7 @@ webpack@5.6.0: neo-async "^2.6.2" pkg-dir "^4.2.0" schema-utils "^3.0.0" - tapable "^2.0.0" + tapable "^2.1.1" terser-webpack-plugin "^5.0.3" watchpack "^2.0.0" webpack-sources "^2.1.1" From 00a4798b9042bffcf89d341e60aa6cddc3a14102 Mon Sep 17 00:00:00 2001 From: oebrab <72924639+oebrab@users.noreply.github.com> Date: Fri, 27 Nov 2020 22:31:37 +0800 Subject: [PATCH 12/35] Add a link to the "Example" part (#9782) --- commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands.md b/commands.md index adcbc3f26126..3ca932f2d44e 100644 --- a/commands.md +++ b/commands.md @@ -42,7 +42,7 @@ 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` for an example. +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 From 326543f9082d6d77dec634914c8d4daa8525c7eb Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Sat, 28 Nov 2020 09:21:04 +0900 Subject: [PATCH 13/35] Release 2.2.1 --- .github/ISSUE_TEMPLATE/formatting.md | 2 +- .github/ISSUE_TEMPLATE/integration.md | 2 +- CHANGELOG.md | 32 +++++++++++++++++++ docs/browser.md | 12 +++---- package.json | 2 +- .../versioned_docs/version-stable/browser.md | 12 +++---- 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index af8efd889cf6..76c445afc9eb 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Tip! Don't write this stuff manually. --> -**Prettier 2.2.0** +**Prettier 2.2.1** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index eea91394de59..d443f6cbfc0b 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 2.2.0 +- Prettier Version: 2.2.1 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index b1d3f6130f75..49b08b3292c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,35 @@ +# 2.2.1 + +[diff](https://github.com/prettier/prettier/compare/2.2.0...2.2.1) + +#### Fix formatting for AssignmentExpression with ClassExpression ([#9741](https://github.com/prettier/prettier/pull/9741) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +module.exports = class A extends B { + method() { + console.log("foo"); + } +}; + +// Prettier 2.2.0 +module.exports = class A extends ( + B +) { + method() { + console.log("foo"); + } +}; + +// Prettier 2.2.1 +module.exports = class A extends B { + method() { + console.log("foo"); + } +}; +``` + # 2.2.0 [diff](https://github.com/prettier/prettier/compare/2.1.2...2.2.0) diff --git a/docs/browser.md b/docs/browser.md index 92f7a67a7ca4..40e1b67a3735 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -23,8 +23,8 @@ See [Usage](#usage) below for examples. ### Global ```html - - + + - + +