From 8334610aa26f6391a30dd285121692ae23700e7a Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Sat, 21 Mar 2020 22:24:23 +0200 Subject: [PATCH] Blog post for 2.0 (#7417) * add a script that concatenates changelog_unreleased into a blog post draft * syntax highlighting issues * generate post draft * Copy edit, remove error stacks * Update 2020-00-00-2.0.0.md * Update changelog source files * edit entries, regenerate the post * add lost file in versioned_docs Co-authored-by: Jed Fox --- changelog_unreleased/angular/pr-7371.md | 2 +- changelog_unreleased/api/pr-5813.md | 2 + changelog_unreleased/api/pr-6993.md | 25 +- changelog_unreleased/api/pr-7430.md | 8 +- changelog_unreleased/api/pr-7435.md | 8 +- changelog_unreleased/api/pr-7485.md | 4 +- changelog_unreleased/api/pr-7511.md | 12 +- changelog_unreleased/api/pr-7620.md | 4 +- changelog_unreleased/blog-post-intro.md | 7 + changelog_unreleased/cli/pr-7587.md | 2 +- changelog_unreleased/cli/pr-7660.md | 2 +- changelog_unreleased/flow/pr-7484.md | 4 +- changelog_unreleased/handlebars/pr-7552.md | 1 + changelog_unreleased/html/pr-7293.md | 10 - changelog_unreleased/html/pr-7295.md | 10 - changelog_unreleased/html/pr-7392.md | 12 +- changelog_unreleased/html/pr-7654.md | 2 +- changelog_unreleased/javascript/pr-6685.md | 2 +- changelog_unreleased/javascript/pr-7011.md | 16 - changelog_unreleased/javascript/pr-7026.md | 2 +- changelog_unreleased/javascript/pr-7138.md | 2 +- changelog_unreleased/javascript/pr-7140.md | 2 +- changelog_unreleased/javascript/pr-7367.md | 2 +- changelog_unreleased/javascript/pr-7791.md | 11 +- changelog_unreleased/less/pr-6981.md | 2 +- changelog_unreleased/markdown/pr-7203.md | 2 +- changelog_unreleased/mdx/pr-6949.md | 10 +- changelog_unreleased/scss/pr-6918.md | 2 +- changelog_unreleased/scss/pr-7211.md | 4 +- changelog_unreleased/typescript/pr-6400.md | 2 +- changelog_unreleased/typescript/pr-7020.md | 4 +- changelog_unreleased/typescript/pr-7144.md | 3 +- changelog_unreleased/typescript/pr-7631.md | 2 +- changelog_unreleased/vue/pr-7479.md | 31 +- cspell.json | 2 + scripts/draft-blog-post.js | 117 + scripts/lint-changelog.js | 14 +- website/blog/2020-03-21-2.0.0.md | 1932 +++++++++++++++++ website/siteConfig.js | 2 + .../version-stable/for-enterprise.md | 49 + website/yarn.lock | 12 +- 41 files changed, 2194 insertions(+), 148 deletions(-) create mode 100644 changelog_unreleased/blog-post-intro.md delete mode 100644 changelog_unreleased/javascript/pr-7011.md create mode 100644 scripts/draft-blog-post.js create mode 100644 website/blog/2020-03-21-2.0.0.md create mode 100644 website/versioned_docs/version-stable/for-enterprise.md diff --git a/changelog_unreleased/angular/pr-7371.md b/changelog_unreleased/angular/pr-7371.md index 76e738561..736b2db2d 100644 --- a/changelog_unreleased/angular/pr-7371.md +++ b/changelog_unreleased/angular/pr-7371.md @@ -1,4 +1,4 @@ -#### Fix formatting i18n attributes ([#7371](https://github.com/prettier/prettier/pull/7371) by [@thorn0](https://github.com/thorn0)) +#### Fix formatting of i18n attributes ([#7371](https://github.com/prettier/prettier/pull/7371) by [@thorn0](https://github.com/thorn0)) Prettier 1.19 [added](https://prettier.io/blog/2019/11/09/1.19.0.html#add-formatting-for-i18n-attributes-6695-by-voithos) support for formatting [i18n attributes](https://angular.io/guide/i18n), but putting the closing quote mark on a new line diff --git a/changelog_unreleased/api/pr-5813.md b/changelog_unreleased/api/pr-5813.md index bc9daf48a..bb844b691 100644 --- a/changelog_unreleased/api/pr-5813.md +++ b/changelog_unreleased/api/pr-5813.md @@ -1 +1,3 @@ #### [BREAKING] Fix config overrides pattern matching to include dot files ([#5813](https://github.com/prettier/prettier/pull/5813) by [@chrisblossom](https://github.com/chrisblossom)) + +Previously, [configuration overrides](/docs/en/configuration.html#configuration-overrides) weren't applied to files whose name had a leading dot. diff --git a/changelog_unreleased/api/pr-6993.md b/changelog_unreleased/api/pr-6993.md index 2f9a2d4ca..60a6798bf 100644 --- a/changelog_unreleased/api/pr-6993.md +++ b/changelog_unreleased/api/pr-6993.md @@ -1,21 +1,10 @@ -#### [BREAKING] Remove deprecated API ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker)) - -- Parser `typescript-eslint` is removed. - - Use `typescript` instead. - -- `prettier.util.mapDoc` is removed - - Use `prettier.doc.utils.mapDoc` instead. - -- `prettier.util.isNextLineEmpty` is updated +#### [BREAKING] Remove deprecated API and change util signatures ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker)) +- Parser `typescript-eslint` is removed. Use the `typescript` parser instead. +- `prettier.util.mapDoc` is removed. Use `prettier.doc.utils.mapDoc` instead. +- `prettier.util.isNextLineEmpty` is updated.
Use `isNextLineEmpty(text, node, locEnd)` instead of `isNextLineEmpty(text, node, options)`. - -- `prettier.util.isPreviousLineEmpty` is updated - - Use `isPreviousLineEmpty(text, node, locStart)` instead of `isNextLineEmpty(text, node, options)`. - -- `prettier.util.getNextNonSpaceNonCommentCharacterIndex` is updated - +- `prettier.util.isPreviousLineEmpty` is updated.
+ Use `isPreviousLineEmpty(text, node, locStart)` instead of `isPreviousLineEmpty(text, node, options)`. +- `prettier.util.getNextNonSpaceNonCommentCharacterIndex` is updated.
Use `getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd)` instead of `getNextNonSpaceNonCommentCharacterIndex(text, node, options)`. diff --git a/changelog_unreleased/api/pr-7430.md b/changelog_unreleased/api/pr-7430.md index b539d6dfc..802b02fb2 100644 --- a/changelog_unreleased/api/pr-7430.md +++ b/changelog_unreleased/api/pr-7430.md @@ -1,7 +1,7 @@ #### [BREAKING] Change default value for `arrowParens` to `always` ([#7430](https://github.com/prettier/prettier/pull/7430) by [@kachkaev](https://github.com/kachkaev)) -[Since version 1.9](https://prettier.io/blog/2017/12/05/1.9.0.html#option-to-add-parens-in-arrow-function-arguments-3324httpsgithubcomprettierprettierpull3324-by-rattrayalexhttpsgithubcomrattrayalex-and-suchipihttpsgithubcomsuchipi), Prettier has an [option](https://prettier.io/docs/en/options.html#arrow-function-parentheses) to always wrap arrow function arguments with parentheses. -Since version 2.0, this behavior becomes default. +[Since version 1.9](https://prettier.io/blog/2017/12/05/1.9.0.html#option-to-add-parens-in-arrow-function-arguments-3324httpsgithubcomprettierprettierpull3324-by-rattrayalexhttpsgithubcomrattrayalex-and-suchipihttpsgithubcomsuchipi), Prettier has had an [option](https://prettier.io/docs/en/options.html#arrow-function-parentheses) to always wrap arrow function arguments with parentheses. +In version 2.0, this behavior has become the default. ```js @@ -15,8 +15,8 @@ const fn = x => y => x + y; const fn = (x) => (y) => x + y; ``` -At first glance, avoiding parentheses in the isolated example above may look like a better choice because of less visual noise. -However, when Prettier removes parentheses, it becomes harder to add type annotations, extra arguments or default values as well as making [other changes](https://twitter.com/ManuelBieh/status/1181880524954050560). +At first glance, avoiding parentheses in the isolated example above may look like a better choice because it results in less visual noise. +However, when Prettier removes parentheses, it becomes harder to add type annotations, extra arguments, default values, or a variety of [other things](https://twitter.com/ManuelBieh/status/1181880524954050560). Consistent use of parentheses provides a better developer experience when editing real codebases, which justifies the change. You are encouraged to use the new default value, but if the old behavior is still preferred, please configure Prettier with `{ "arrowParens": "avoid" }`. diff --git a/changelog_unreleased/api/pr-7435.md b/changelog_unreleased/api/pr-7435.md index 895a2ba07..f36d3dd84 100644 --- a/changelog_unreleased/api/pr-7435.md +++ b/changelog_unreleased/api/pr-7435.md @@ -3,11 +3,11 @@ Early versions of Prettier were formatting all files with the \*nix flavor of [line endings](https://en.wikipedia.org/wiki/Newline) (`\n`, also known as `LF`). This behavior was changed in [#472](https://github.com/prettier/prettier/pull/472), which allowed preserving Windows line endings (`\r\n`, also known as `CRLF`). -[Since Prettier version 1.15](https://prettier.io/blog/2018/11/07/1.15.0.html#add-an-option-to-enforce-line-endings-5327-by-kachkaev), the flavor of line endings is configurable via the `endOfLine` option. -The default value was set to `auto` for backwards compatibility, which meant that Prettier preserved a flavor of line endings already present in a given file. +[Since Prettier version 1.15](https://prettier.io/blog/2018/11/07/1.15.0.html#add-an-option-to-enforce-line-endings-5327-by-kachkaev), the flavor of line endings has been configurable via the `endOfLine` option. +The default value was set to `auto` for backwards compatibility, which meant that Prettier preserved whichever flavor of line endings was already present in a given file. -With `endOfLine` equal to `auto`, Prettier converted mixed line endings within one file to what was found at the end of the first line. -However, line endings in neighboring files could still remain inconsistent. +That meant Prettier converted mixed line endings within one file to what was found at the end of the first line. +However, line endings in separate files could still remain inconsistent. Besides, contributors on different operating systems could accidentally change line endings in previously committed files and this would be fine with Prettier. Doing so would produce a large `git diff` and thus make the line-by-line history for a file (`git blame`) harder to explore. diff --git a/changelog_unreleased/api/pr-7485.md b/changelog_unreleased/api/pr-7485.md index 0ff37b647..6abc9b870 100644 --- a/changelog_unreleased/api/pr-7485.md +++ b/changelog_unreleased/api/pr-7485.md @@ -1,3 +1,3 @@ -#### Cache plugins search result ([#7485](https://github.com/prettier/prettier/pull/7485) by [@fisker](https://github.com/fisker)) +#### [BREAKING] Cache plugin search results ([#7485](https://github.com/prettier/prettier/pull/7485) by [@fisker](https://github.com/fisker)) -Previously, we search plugins on every `format` call, the plugins search result is cached since v2.0.0, cache can be clear by calling `prettier.clearConfigCache()`. +Previously, Prettier searched the file system for plugins on every `prettier.format` call. Now, search results are cached. The cache can be cleared by calling `prettier.clearConfigCache()`. diff --git a/changelog_unreleased/api/pr-7511.md b/changelog_unreleased/api/pr-7511.md index 05cc658b8..ab59b6806 100644 --- a/changelog_unreleased/api/pr-7511.md +++ b/changelog_unreleased/api/pr-7511.md @@ -1,8 +1,8 @@ -#### Remove deprecated options and option values ([#7511](https://github.com/prettier/prettier/pull/7511), [#7533](https://github.com/prettier/prettier/pull/7533), [#7535](https://github.com/prettier/prettier/pull/7535), [#7536](https://github.com/prettier/prettier/pull/7536) by [@fisker](https://github.com/fisker)) +#### [BREAKING] Remove deprecated options and option values ([#7511](https://github.com/prettier/prettier/pull/7511), [#7533](https://github.com/prettier/prettier/pull/7533), [#7535](https://github.com/prettier/prettier/pull/7535), [#7536](https://github.com/prettier/prettier/pull/7536) by [@fisker](https://github.com/fisker)) - Options: - - `useFlowParser` (`--flow-parser` in CLI) [has been deprecated since `v0.0.10`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#0010). -- Renamed option values whose old names were kept for backward compatibility: - - `parser`: `babylon` (renamed to `babel` in _v1.16.0_), `postcss` (renamed to `css` in _v1.7.1_) - - `trailingComma`: `true` (renamed to `always` in _v1.9.0_), `false` (renamed to `never` in _v1.9.0_) - - `proseWrap`: `true` (renamed to `es5` in _v0.19.0_), `false` (renamed to `none` in _v0.19.0_) + - `useFlowParser` (`--flow-parser` in CLI) has been deprecated [since `v0.0.10`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#0010). +- Option values: + - `parser`: `babylon` (renamed to `babel` in v1.16.0), `postcss` (renamed to `css` in v1.7.1) + - `proseWrap`: `true` (renamed to `always` in v1.9.0), `false` (renamed to `never` in v1.9.0) + - `trailingComma`: `true` (renamed to `es5` in v0.19.0), `false` (renamed to `none` in v0.19.0) diff --git a/changelog_unreleased/api/pr-7620.md b/changelog_unreleased/api/pr-7620.md index a9db65b2d..f3f1a6778 100644 --- a/changelog_unreleased/api/pr-7620.md +++ b/changelog_unreleased/api/pr-7620.md @@ -1,3 +1,3 @@ -#### [BREAKING] Remove the `version` parameter of `prettier.getSupportInfo()` ([#7620](https://github.com/prettier/prettier/pull/7620) by [@thorn0](https://github.com/thorn0)) +#### [BREAKING] Remove the `version` parameter of `prettier.getSupportInfo` ([#7620](https://github.com/prettier/prettier/pull/7620) by [@thorn0](https://github.com/thorn0)) -In Prettier 1.x (since 1.8.0), it was possible to pass a version number to `prettier.getSupportInfo()` to get information on the languages, options, etc. supported by previous versions. This interesting but apparently not very useful API kept causing maintenance problems and has been removed in Prettier 2.0.0. +Since Prettier 1.8.0, it was possible to pass a version number to `prettier.getSupportInfo` to get information on the languages, options, etc. supported by previous versions. This interesting but apparently not very useful API kept causing maintenance problems and has been removed in Prettier 2.0.0. diff --git a/changelog_unreleased/blog-post-intro.md b/changelog_unreleased/blog-post-intro.md new file mode 100644 index 000000000..f349dba5b --- /dev/null +++ b/changelog_unreleased/blog-post-intro.md @@ -0,0 +1,7 @@ +--- +author: "Georgii Dolzhykov (@thorn0)" +authorURL: "https://github.com/thorn0" +title: "Prettier 2.0 “2020”" +--- + +Better defaults, a better CLI and better heuristics. Oh, and TypeScript 3.8. diff --git a/changelog_unreleased/cli/pr-7587.md b/changelog_unreleased/cli/pr-7587.md index 001af15c5..0a4ca4325 100644 --- a/changelog_unreleased/cli/pr-7587.md +++ b/changelog_unreleased/cli/pr-7587.md @@ -1,3 +1,3 @@ -#### Test whether passed globs are names of existing files before treating them as globs ([#7587](https://github.com/prettier/prettier/pull/7587) by [@fisker](https://github.com/fisker)) +#### [HIGHLIGHT] Test whether passed globs are names of existing files before treating them as globs ([#7587](https://github.com/prettier/prettier/pull/7587) by [@fisker](https://github.com/fisker)) Since file names in Linux can contain almost any characters, strings like `foo*.js` and `[bar].css` are valid file names. Previously, if the user needed to format a file named `[bar].css`, a glob escaping syntax had to be used: `prettier "\[bar].css"` (this one doesn't work on Windows, where backslashes are treated as path separators) or `prettier "[[]bar].css"`. Because of this, important use cases were broken. E.g. [lint-staged](https://github.com/okonet/lint-staged) passes absolute paths and knows nothing about the escaping syntax. Now, when Prettier CLI gets a glob, it first tries to resolve it as a literal file name. diff --git a/changelog_unreleased/cli/pr-7660.md b/changelog_unreleased/cli/pr-7660.md index 123bd1240..3007f89bf 100644 --- a/changelog_unreleased/cli/pr-7660.md +++ b/changelog_unreleased/cli/pr-7660.md @@ -1,4 +1,4 @@ -#### Expand directories, including `.` ([#7660](https://github.com/prettier/prettier/pull/7660) by [@thorn0](https://github.com/thorn0)) +#### [HIGHLIGHT] Expand directories, including `.` ([#7660](https://github.com/prettier/prettier/pull/7660) by [@thorn0](https://github.com/thorn0)) It's finally possible to run `prettier --write .` to format all supported files in the current directory and its subdirectories. Directory names can be mixed with file names and glob patterns (e.g. `prettier src "test/*.spec.js" foo.js`). diff --git a/changelog_unreleased/flow/pr-7484.md b/changelog_unreleased/flow/pr-7484.md index 7b06ae4b1..bf6db7c57 100644 --- a/changelog_unreleased/flow/pr-7484.md +++ b/changelog_unreleased/flow/pr-7484.md @@ -3,7 +3,9 @@ ```js // Input -class Foo {#privateProp: number;} +class Foo { + #privateProp: number; +} // Prettier stable class Foo { diff --git a/changelog_unreleased/handlebars/pr-7552.md b/changelog_unreleased/handlebars/pr-7552.md index 1a96d18ff..8bc484840 100644 --- a/changelog_unreleased/handlebars/pr-7552.md +++ b/changelog_unreleased/handlebars/pr-7552.md @@ -14,3 +14,4 @@ +``` diff --git a/changelog_unreleased/html/pr-7293.md b/changelog_unreleased/html/pr-7293.md index 39d437679..6a90e9870 100644 --- a/changelog_unreleased/html/pr-7293.md +++ b/changelog_unreleased/html/pr-7293.md @@ -8,16 +8,6 @@ TypeError: Cannot read property 'start' of null - at hasTrailingLineBreak (https://prettier.io/lib/standalone.js:19694:169) - at forceBreakContent (https://prettier.io/lib/standalone.js:19668:154) - at Object.genericPrint$2 [as print] (https://prettier.io/lib/standalone.js:21068:126) - at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15302:20) - at https://prettier.io/lib/standalone.js:15253:18 - at Object.printComments (https://prettier.io/lib/standalone.js:14974:19) - at printGenerically (https://prettier.io/lib/standalone.js:15252:24) - at printChild (https://prettier.io/lib/standalone.js:21227:14) - at https://prettier.io/lib/standalone.js:21211:104 - at FastPath.map (https://prettier.io/lib/standalone.js:15155:23)
<
diff --git a/changelog_unreleased/html/pr-7295.md b/changelog_unreleased/html/pr-7295.md index 7ccb34086..679499a0b 100644 --- a/changelog_unreleased/html/pr-7295.md +++ b/changelog_unreleased/html/pr-7295.md @@ -11,16 +11,6 @@ srcset=" Error: Mixed descriptor in srcset is not supported - at printImgSrcset (https://prettier.io/lib/standalone.js:20867:13) - at printEmbeddedAttributeValue (https://prettier.io/lib/standalone.js:21538:26) - at Object.embed$2 [as embed] (https://prettier.io/lib/standalone.js:21009:43) - at Object.printSubtree (https://prettier.io/lib/standalone.js:15170:30) - at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15288:31) - at https://prettier.io/lib/standalone.js:15253:18 - at Object.printComments (https://prettier.io/lib/standalone.js:14974:19) - at printGenerically (https://prettier.io/lib/standalone.js:15252:24) - at https://prettier.io/lib/standalone.js:21285:175 - at FastPath.map (https://prettier.io/lib/standalone.js:15155:23) diff --git a/changelog_unreleased/html/pr-7392.md b/changelog_unreleased/html/pr-7392.md index 7e3f1042e..a01048586 100644 --- a/changelog_unreleased/html/pr-7392.md +++ b/changelog_unreleased/html/pr-7392.md @@ -1,4 +1,4 @@ -#### Fix error throws on unclosed tag in `pre` tag ([#7392](https://github.com/prettier/prettier/pull/7392) by [@fisker](https://github.com/fisker)) +#### Fix error thrown on unclosed tag in `pre` tag ([#7392](https://github.com/prettier/prettier/pull/7392) by [@fisker](https://github.com/fisker)) ```html @@ -8,16 +8,6 @@ TypeError: Cannot read property 'start' of null - at printChild (https://prettier.io/lib/standalone.js:21224:358) - at https://prettier.io/lib/standalone.js:21211:104 - at FastPath.map (https://prettier.io/lib/standalone.js:15155:23) - at printChildren$1 (https://prettier.io/lib/standalone.js:21155:26) - at Object.genericPrint$2 [as print] (https://prettier.io/lib/standalone.js:21039:41) - at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15302:20) - at https://prettier.io/lib/standalone.js:15253:18 - at Object.printComments (https://prettier.io/lib/standalone.js:14974:19) - at printGenerically (https://prettier.io/lib/standalone.js:15252:24) - at printAstToDoc (https://prettier.io/lib/standalone.js:15264:15)

diff --git a/changelog_unreleased/html/pr-7654.md b/changelog_unreleased/html/pr-7654.md index ad8cef688..fc60a9695 100644 --- a/changelog_unreleased/html/pr-7654.md +++ b/changelog_unreleased/html/pr-7654.md @@ -4,7 +4,7 @@ Previously, it worked only for tags. Useful for protecting various macros and pr ```html - + A super long string that has been marked as ignore because it was probably generated by some script. diff --git a/changelog_unreleased/javascript/pr-6685.md b/changelog_unreleased/javascript/pr-6685.md index e8d71f3cc..6a002873d 100644 --- a/changelog_unreleased/javascript/pr-6685.md +++ b/changelog_unreleased/javascript/pr-6685.md @@ -1,4 +1,4 @@ -#### Method chain breaking heuristic ([#6685](https://github.com/prettier/prettier/pull/6685) by [@mmkal](https://github.com/mmkal)) +#### [HIGHLIGHT] Improved method chain breaking heuristic ([#6685](https://github.com/prettier/prettier/pull/6685) by [@mmkal](https://github.com/mmkal)) Previously, any method call chain of length three or longer would be automatically broken into multiple lines. The new heuristic is based on the complexity of the call arguments in the chain, rather than simply on the chain's length. Now, if chained method calls have arguments which aren't easy to understand at a glance (e.g. functions or deeply-nested objects), the chain is broken. Otherwise, they're allowed to remain on one line. See prior issues [#3197](https://github.com/prettier/prettier/issues/3107), [#4765](https://github.com/prettier/prettier/pull/4765), [#1565](https://github.com/prettier/prettier/issues/1565) and [#4125](https://github.com/prettier/prettier/pull/4125) for context and examples. diff --git a/changelog_unreleased/javascript/pr-7011.md b/changelog_unreleased/javascript/pr-7011.md deleted file mode 100644 index 642c75a70..000000000 --- a/changelog_unreleased/javascript/pr-7011.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Preserve parentheses for JSDoc type casting with extra trailing spaces and asterisks ([#7011](https://github.com/prettier/prettier/pull/7011) by [@evilebottnawi](https://github.com/evilebottnawi)) - - -```javascript -// Input -const foo = /** @type {!Foo} **/ (baz); -const bar = /** @type {!Foo} * * */(baz); - -// Prettier stable -const foo = /** @type {!Foo} **/ baz; -const bar = /** @type {!Foo} * * */ baz; - -// Prettier master -const foo = /** @type {!Foo} **/ (baz); -const bar = /** @type {!Foo} * * */ (baz); -``` diff --git a/changelog_unreleased/javascript/pr-7026.md b/changelog_unreleased/javascript/pr-7026.md index 877722019..0d29dbe3f 100644 --- a/changelog_unreleased/javascript/pr-7026.md +++ b/changelog_unreleased/javascript/pr-7026.md @@ -18,7 +18,7 @@ const averredBathersBoxroomBuggyNurl = askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3; -// Prettier master (first output) +// Prettier master (first and second outputs) const averredBathersBoxroomBuggyNurl = bifornCringerMoshedPerplexSawder === 1 || askTrovenaBeenaDependsRowans === 2 || diff --git a/changelog_unreleased/javascript/pr-7138.md b/changelog_unreleased/javascript/pr-7138.md index 7fe07e540..596d3ef59 100644 --- a/changelog_unreleased/javascript/pr-7138.md +++ b/changelog_unreleased/javascript/pr-7138.md @@ -3,7 +3,7 @@ Because decorators modify the line following, splitting a decorator call’s arguments onto multiple lines can obscure the relationship between the decorator and its intended target, producing less-readable code. Therefore, the -function composition logic introduced in #6033 has been changed to exclude +function composition logic introduced in [#6033](https://github.com/prettier/prettier/pull/6033) has been changed to exclude decorator calls. diff --git a/changelog_unreleased/javascript/pr-7140.md b/changelog_unreleased/javascript/pr-7140.md index ab1b98b5f..32a3eae0a 100644 --- a/changelog_unreleased/javascript/pr-7140.md +++ b/changelog_unreleased/javascript/pr-7140.md @@ -1,4 +1,4 @@ -#### Fix moving semicolon to trailing comment in `return` ([#7140](https://github.com/prettier/prettier/pull/7140) by [@sosukesuzuki](https://github.com/sosukesuzuki)) +#### Correct semicolon placement in empty `return` statement with comment ([#7140](https://github.com/prettier/prettier/pull/7140) by [@sosukesuzuki](https://github.com/sosukesuzuki)) ```js diff --git a/changelog_unreleased/javascript/pr-7367.md b/changelog_unreleased/javascript/pr-7367.md index 8e4d9de10..58eaa4e94 100644 --- a/changelog_unreleased/javascript/pr-7367.md +++ b/changelog_unreleased/javascript/pr-7367.md @@ -1,4 +1,4 @@ -#### Fix: remove unnecessary parens when yielding JSX ([#7367](https://github.com/prettier/prettier/pull/7367) by [@cola119](https://github.com/cola119)) +#### Remove unnecessary parens when yielding JSX ([#7367](https://github.com/prettier/prettier/pull/7367) by [@cola119](https://github.com/cola119)) ```jsx diff --git a/changelog_unreleased/javascript/pr-7791.md b/changelog_unreleased/javascript/pr-7791.md index 11755d521..377795830 100644 --- a/changelog_unreleased/javascript/pr-7791.md +++ b/changelog_unreleased/javascript/pr-7791.md @@ -1,6 +1,8 @@ -#### Ultimate fix for Closure-style type casts ([#7791](https://github.com/prettier/prettier/pull/7791) by [@thorn0](https://github.com/thorn0)) +#### [HIGHLIGHT] Ultimate fix for Closure-style type casts ([#7791](https://github.com/prettier/prettier/pull/7791) by [@thorn0](https://github.com/thorn0), [#7011](https://github.com/prettier/prettier/pull/7011) by [@evilebottnawi](https://github.com/evilebottnawi)) -Prettier has been trying not to corrupt these JSDoc type assertions since [v1.6.0](https://prettier.io/blog/2017/08/29/1.6.0.html#handle-closure-compiler-type-cast-syntax-correctly-2484httpsgithubcomprettierprettierpull2484-by-yangsuhttpsgithubcomyangsu), with mixed results. As type checking based on JSDoc becomes increasingly common, we've been getting new bug reports about this syntax. The bugs were tricky because the required parentheses around the expression weren't part of the AST, so Prettier didn't have a good way to detect their presence. Finally, we used the `createParenthesizedExpressions` option of the Babel parser to represent parentheses in the AST using non-standard nodes. This helped fix all the reported bugs. +Prettier has been trying not to corrupt these JSDoc type assertions since [v1.6.0](https://prettier.io/blog/2017/08/29/1.6.0.html#handle-closure-compiler-type-cast-syntax-correctly-2484httpsgithubcomprettierprettierpull2484-by-yangsuhttpsgithubcomyangsu), with mixed results. As type checking based on JSDoc becomes increasingly common, we've been getting new bug reports about this syntax. The bugs were tricky because the required parentheses around the expression weren't part of the AST, so Prettier didn't have a good way to detect their presence. + +Finally, we used the `createParenthesizedExpressions` option of the Babel parser to represent parentheses in the AST using non-standard nodes. This helped fix all the reported bugs. Consequently, Prettier won't recognize JSDoc type casts if the `flow` or `typescript` parser is used, but this is reasonable as this syntax makes little sense in Flow and TypeScript files. @@ -18,7 +20,4 @@ const nestedAssertions /** @type {MyType} */ /** @type {unknown} */ = x; const nestedAssertions = /** @type {MyType} */ (/** @type {unknown} */ (x)); ``` -Reference documentation for this syntax: - -- [Closure Compiler](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-type) -- [TypeScript (with `--checkJs`)](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#casts) +Reference documentation for this syntax: [Closure Compiler](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-type), [TypeScript (with `--checkJs`)](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#casts). diff --git a/changelog_unreleased/less/pr-6981.md b/changelog_unreleased/less/pr-6981.md index b8dbacd6c..40d0c3d83 100644 --- a/changelog_unreleased/less/pr-6981.md +++ b/changelog_unreleased/less/pr-6981.md @@ -1,6 +1,6 @@ #### Fix multiple long-standing issues by updating `postcss-less` ([#6981](https://github.com/prettier/prettier/pull/6981) by [@fisker](https://github.com/fisker), [#7021](https://github.com/prettier/prettier/pull/7021) by [@evilebottnawi](https://github.com/evilebottnawi), [@thorn0](https://github.com/thorn0)) -- [`each`](http://lesscss.org/functions/#list-functions-each) is supported now ([#5653](https://github.com/prettier/prettier/issues/5653). +- [`each`](http://lesscss.org/functions/#list-functions-each) is supported now ([#5653](https://github.com/prettier/prettier/issues/5653)). - `!important` was being moved out of mixin call parameters ([#3544](https://github.com/prettier/prettier/issues/3544)). - Comments in rulesets passed to mixin calls caused duplicate semicolons ([#3096](https://github.com/prettier/prettier/issues/3096)). - `::before` was broken in mixin call parameters ([#5791](https://github.com/prettier/prettier/issues/5791)). diff --git a/changelog_unreleased/markdown/pr-7203.md b/changelog_unreleased/markdown/pr-7203.md index cd572553d..41c36d0bb 100644 --- a/changelog_unreleased/markdown/pr-7203.md +++ b/changelog_unreleased/markdown/pr-7203.md @@ -1,4 +1,4 @@ -#### Fix incorrect prettification of multi-line markdown footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4)) +#### Fix formatting of multi-line footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4)) ```md diff --git a/changelog_unreleased/mdx/pr-6949.md b/changelog_unreleased/mdx/pr-6949.md index 3534d02f3..c122da702 100644 --- a/changelog_unreleased/mdx/pr-6949.md +++ b/changelog_unreleased/mdx/pr-6949.md @@ -4,7 +4,7 @@ MDX parsing for JSX failed when encountering JSX elements that where not parsable as HTML, such as `test` -````md +```md test @@ -19,14 +19,8 @@ parsable as HTML, such as `test` -``` SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:35) > 1 | test - | ^ - 2 | - 3 | - 4 |
-``` @@ -40,4 +34,4 @@ SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has alread
-```` +``` diff --git a/changelog_unreleased/scss/pr-6918.md b/changelog_unreleased/scss/pr-6918.md index 6dd3f4b12..20a8ebc91 100644 --- a/changelog_unreleased/scss/pr-6918.md +++ b/changelog_unreleased/scss/pr-6918.md @@ -1,6 +1,6 @@ #### Don't add extra comma after last comment in map ([#6918](https://github.com/prettier/prettier/pull/6918) by [@fisker](https://github.com/fisker)) -Previously, when `trailingComma` set to `es5`, extra comma added after last comment in map. +Previously, when `trailingComma` set to `es5`, an extra comma was added after last comment in an SCSS map. ```scss diff --git a/changelog_unreleased/scss/pr-7211.md b/changelog_unreleased/scss/pr-7211.md index dc283cbf5..6331e7c08 100644 --- a/changelog_unreleased/scss/pr-7211.md +++ b/changelog_unreleased/scss/pr-7211.md @@ -1,6 +1,4 @@ -#### Fix scss variable string concatenation removing spaces ([#7211](https://github.com/prettier/prettier/pull/7211) by [@sasurau4](https://github.com/sasurau4)) - -Previously, when Prettier format the scss variable string concatenation, it would remove spaces. Now, Prettier insert spaces around plus operator. +#### Fix whitespace in SCSS concatenation ([#7211](https://github.com/prettier/prettier/pull/7211) by [@sasurau4](https://github.com/sasurau4)) ```scss diff --git a/changelog_unreleased/typescript/pr-6400.md b/changelog_unreleased/typescript/pr-6400.md index 76210e694..407af44e1 100644 --- a/changelog_unreleased/typescript/pr-6400.md +++ b/changelog_unreleased/typescript/pr-6400.md @@ -1,3 +1,3 @@ #### Babel as an alternative parser for TypeScript ([#6400](https://github.com/prettier/prettier/pull/6400) by [@JounQin](https://github.com/JounQin) & [@thorn0](https://github.com/thorn0)) -A new value for the `parser` option has been added: `babel-ts`, which stands for Babel with its TypeScript support enabled. The `babel-ts` parser supports JavaScript features not yet supported by TypeScript (ECMAScript proposals, e.g. [private methods and accessors](https://github.com/tc39/proposal-private-methods)), but it's less permissive when it comes to error recovery and less battle-tested than the `typescript` parser. While Babel's TypeScript plugin is quite mature, ASTs produced by the two parsers aren't 100% compatible. We tried to take the discrepancies into account, but there still must remain cases where code gets formatted differently or even incorrectly. We call upon the community to help us find such cases. If you see them, please raise issues. In the long run, this will help with [unifying the AST format](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree#ast-alignment-tests) in future versions of the parsers and thus contribute to a better, more solid JavaScript parser ecosystem. +A new value for the `parser` option has been added: `babel-ts`, which makes use of Babel’s TypeScript plugin. The `babel-ts` parser supports JavaScript features not yet supported by TypeScript (ECMAScript proposals, e.g. [private methods and accessors](https://github.com/tc39/proposal-private-methods)), but it's less permissive when it comes to error recovery and less battle-tested than the `typescript` parser. While Babel’s TypeScript plugin is quite mature, ASTs produced by the two parsers aren't 100% compatible. We tried to take the discrepancies into account, but there are most likely still cases where code gets formatted differently or even incorrectly. We call upon you, our users, to help us find such cases. If you see them, please raise issues. In the long run, this will help with [unifying the AST format](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree#ast-alignment-tests) in future versions of the parsers and thus contribute to a better, more solid JavaScript parser ecosystem. diff --git a/changelog_unreleased/typescript/pr-7020.md b/changelog_unreleased/typescript/pr-7020.md index 07ae83664..114d5e9ac 100644 --- a/changelog_unreleased/typescript/pr-7020.md +++ b/changelog_unreleased/typescript/pr-7020.md @@ -1,4 +1,4 @@ -#### Print JSDoc-only types as is instead of throwing strange errors ([#7020](https://github.com/prettier/prettier/pull/7020) by [@thorn0](https://github.com/thorn0)) +#### Print JSDoc-only types as is instead of throwing errors ([#7020](https://github.com/prettier/prettier/pull/7020) by [@thorn0](https://github.com/thorn0)) Another fix related to error recovery. Should come in handy to those who migrate from Flow to TypeScript. @@ -9,8 +9,6 @@ function fromFlow(arg: ?Maybe) {} // Prettier stable Error: unknown type: "TSJSDocNullableType" - at printPathNoParens (https://prettier.io/lib/standalone.js:26012:13) - at Object.genericPrint$3 [as print] (https://prettier.io/lib/standalone.js:23541:28) // Prettier master function fromFlow(arg: ?Maybe) {} diff --git a/changelog_unreleased/typescript/pr-7144.md b/changelog_unreleased/typescript/pr-7144.md index 5b83c3b05..5782581c0 100644 --- a/changelog_unreleased/typescript/pr-7144.md +++ b/changelog_unreleased/typescript/pr-7144.md @@ -1,4 +1,4 @@ -#### Fix formatting comments for function-like nodes ([#7144](https://github.com/prettier/prettier/pull/7144) by [@armano2](https://github.com/armano2)) +#### Fix formatting of comments for function-like nodes ([#7144](https://github.com/prettier/prettier/pull/7144) by [@armano2](https://github.com/armano2)) ```ts @@ -54,6 +54,7 @@ let foo9: new (/* bar */) => /* foo */ /* baz */ string; let foo10: new (/* foo */ a: /* bar */ string) => /* baz */ string; ``` + ```ts // Input abstract class Test { diff --git a/changelog_unreleased/typescript/pr-7631.md b/changelog_unreleased/typescript/pr-7631.md index d3db02f94..a9f544625 100644 --- a/changelog_unreleased/typescript/pr-7631.md +++ b/changelog_unreleased/typescript/pr-7631.md @@ -1,4 +1,4 @@ -#### TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki)) +#### [HIGHLIGHT] TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki)) Prettier now supports the new syntax added in TypeScript 3.8: diff --git a/changelog_unreleased/vue/pr-7479.md b/changelog_unreleased/vue/pr-7479.md index 8b566d72a..709f659a2 100644 --- a/changelog_unreleased/vue/pr-7479.md +++ b/changelog_unreleased/vue/pr-7479.md @@ -1,29 +1,22 @@ -#### Don't print single `TemplateLiteral` and `StringLiteral` expression on new line ([#7479](https://github.com/prettier/prettier/pull/7479) by [@fisker](https://github.com/fisker)) - -Previously, we print long `TemplateLiteral` and `StringLiteral` on new line in attribute, now we print them on the same line with attribute name. +#### Don't print sole string literals in attributes on a new line ([#7479](https://github.com/prettier/prettier/pull/7479) by [@fisker](https://github.com/fisker)) ```vue - - @@ -31,12 +24,8 @@ Previously, we print long `TemplateLiteral` and `StringLiteral` on new line in a - ``` diff --git a/cspell.json b/cspell.json index 9c7199325..17b88e513 100644 --- a/cspell.json +++ b/cspell.json @@ -84,6 +84,7 @@ "docblock", "docblocks", "Dodds", + "Dolzhykov", "dotfile", "dotfiles", "duailibe", @@ -117,6 +118,7 @@ "Friedly", "fuzzer", "gavinjoyce", + "Georgii", "gettin", "git's", "gitattributes", diff --git a/scripts/draft-blog-post.js b/scripts/draft-blog-post.js new file mode 100644 index 000000000..bce3c86d9 --- /dev/null +++ b/scripts/draft-blog-post.js @@ -0,0 +1,117 @@ +#!/usr/bin/env node + +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const rimraf = require("rimraf"); + +const changelogUnreleasedDir = path.join(__dirname, "../changelog_unreleased"); +const blogDir = path.join(__dirname, "../website/blog"); +const introFile = path.join(changelogUnreleasedDir, "blog-post-intro.md"); +const version = require("../package.json").version.replace(/-.+/, ""); +const postGlob = path.join(blogDir, `????-??-??-${version}.md`); +const postFile = path.join( + blogDir, + `${new Date().toISOString().replace(/T.+/, "")}-${version}.md` +); + +const categories = [ + { dir: "javascript", title: "JavaScript" }, + { dir: "typescript", title: "TypeScript" }, + { dir: "flow", title: "Flow" }, + { dir: "json", title: "JSON" }, + { dir: "css", title: "CSS" }, + { dir: "scss", title: "SCSS" }, + { dir: "less", title: "Less" }, + { dir: "html", title: "HTML" }, + { dir: "vue", title: "Vue" }, + { dir: "angular", title: "Angular" }, + { dir: "lwc", title: "LWC" }, + { dir: "handlebars", title: "Handlebars (alpha)" }, + { dir: "graphql", title: "GraphQL" }, + { dir: "markdown", title: "Markdown" }, + { dir: "mdx", title: "MDX" }, + { dir: "yaml", title: "YAML" }, + { dir: "api", title: "API" }, + { dir: "cli", title: "CLI" }, +]; + +const categoriesByDir = categories.reduce((result, category) => { + result[category.dir] = category; + return result; +}, {}); + +const dirs = fs + .readdirSync(changelogUnreleasedDir, { withFileTypes: true }) + .filter((entry) => entry.isDirectory()); + +for (const dir of dirs) { + const dirPath = path.join(changelogUnreleasedDir, dir.name); + const category = categoriesByDir[dir.name]; + + if (!category) { + throw new Error("Unknown category: " + dir.name); + } + + category.entries = fs + .readdirSync(path.join(changelogUnreleasedDir, dir.name)) + .filter((fileName) => /^pr-\d+\.md$/.test(fileName)) + .map((fileName) => { + const [title, ...rest] = fs + .readFileSync(path.join(dirPath, fileName), "utf8") + .trim() + .split("\n"); + return { + breaking: title.includes("[BREAKING]"), + highlight: title.includes("[HIGHLIGHT]"), + content: [ + title + .replace(/\[(BREAKING|HIGHLIGHT)\]/g, "") + .replace(/\s+/g, " ") + .replace(/^#### [a-z]/, (s) => s.toUpperCase()), + ...rest, + ].join("\n"), + }; + }); +} + +rimraf.sync(postGlob); + +fs.writeFileSync( + postFile, + [ + fs.readFileSync(introFile, "utf8").trim(), + "", + ...printEntries({ + title: "Highlights", + filter: (entry) => entry.highlight, + }), + ...printEntries({ + title: "Breaking changes", + filter: (entry) => entry.breaking && !entry.highlight, + }), + ...printEntries({ + title: "Other changes", + filter: (entry) => !entry.breaking && !entry.highlight, + }), + ].join("\n\n") + "\n" +); + +function printEntries({ title, filter }) { + const result = []; + + for (const { entries = [], title } of categories) { + const filteredEntries = entries.filter(filter); + if (filteredEntries.length) { + result.push("### " + title); + result.push(...filteredEntries.map((entry) => entry.content)); + } + } + + if (result.length) { + result.unshift("## " + title); + } + + return result; +} diff --git a/scripts/lint-changelog.js b/scripts/lint-changelog.js index cffddcc49..26ff1c20a 100644 --- a/scripts/lint-changelog.js +++ b/scripts/lint-changelog.js @@ -1,9 +1,11 @@ +#!/usr/bin/env node "use strict"; const fs = require("fs"); const path = require("path"); const CHANGELOG_DIR = "changelog_unreleased"; const TEMPLATE_FILE = "TEMPLATE.md"; +const BLOG_POST_INTRO_FILE = "blog-post-intro.md"; const CHANGELOG_CATEGORIES = [ "angular", "api", @@ -32,11 +34,19 @@ const showErrorMessage = (message) => { const files = fs.readdirSync(CHANGELOG_ROOT); for (const file of files) { - if (file !== TEMPLATE_FILE && !CHANGELOG_CATEGORIES.includes(file)) { + if ( + file !== TEMPLATE_FILE && + file !== BLOG_POST_INTRO_FILE && + !CHANGELOG_CATEGORIES.includes(file) + ) { showErrorMessage(`Please remove "${file}" from "${CHANGELOG_DIR}".`); } } -for (const file of [TEMPLATE_FILE, ...CHANGELOG_CATEGORIES]) { +for (const file of [ + TEMPLATE_FILE, + BLOG_POST_INTRO_FILE, + ...CHANGELOG_CATEGORIES, +]) { if (!files.includes(file)) { showErrorMessage(`Please don't remove "${file}" from "${CHANGELOG_DIR}".`); } diff --git a/website/blog/2020-03-21-2.0.0.md b/website/blog/2020-03-21-2.0.0.md new file mode 100644 index 000000000..0d83b3f83 --- /dev/null +++ b/website/blog/2020-03-21-2.0.0.md @@ -0,0 +1,1932 @@ +--- +author: "Georgii Dolzhykov (@thorn0)" +authorURL: "https://github.com/thorn0" +title: "Prettier 2.0 “2020”" +--- + +Better defaults, a better CLI and better heuristics. Oh, and TypeScript 3.8. + + + +## Highlights + +### JavaScript + +#### Improved method chain breaking heuristic ([#6685](https://github.com/prettier/prettier/pull/6685) by [@mmkal](https://github.com/mmkal)) + +Previously, any method call chain of length three or longer would be automatically broken into multiple lines. The new heuristic is based on the complexity of the call arguments in the chain, rather than simply on the chain's length. Now, if chained method calls have arguments which aren't easy to understand at a glance (e.g. functions or deeply-nested objects), the chain is broken. Otherwise, they're allowed to remain on one line. See prior issues [#3197](https://github.com/prettier/prettier/issues/3107), [#4765](https://github.com/prettier/prettier/pull/4765), [#1565](https://github.com/prettier/prettier/issues/1565) and [#4125](https://github.com/prettier/prettier/pull/4125) for context and examples. + + +```javascript +// Output (Prettier stable) +if ( + foo + .one() + .two() + .three() === + bar + .four() + .five() + .six() +) { + // ... +} + +// Output (Prettier master) +if (foo.one().two().three() === bar.four().five().six()) { + // ... +} +``` + +#### Ultimate fix for Closure-style type casts ([#7791](https://github.com/prettier/prettier/pull/7791) by [@thorn0](https://github.com/thorn0), [#7011](https://github.com/prettier/prettier/pull/7011) by [@evilebottnawi](https://github.com/evilebottnawi)) + +Prettier has been trying not to corrupt these JSDoc type assertions since [v1.6.0](https://prettier.io/blog/2017/08/29/1.6.0.html#handle-closure-compiler-type-cast-syntax-correctly-2484httpsgithubcomprettierprettierpull2484-by-yangsuhttpsgithubcomyangsu), with mixed results. As type checking based on JSDoc becomes increasingly common, we've been getting new bug reports about this syntax. The bugs were tricky because the required parentheses around the expression weren't part of the AST, so Prettier didn't have a good way to detect their presence. + +Finally, we used the `createParenthesizedExpressions` option of the Babel parser to represent parentheses in the AST using non-standard nodes. This helped fix all the reported bugs. + +Consequently, Prettier won't recognize JSDoc type casts if the `flow` or `typescript` parser is used, but this is reasonable as this syntax makes little sense in Flow and TypeScript files. + + +```jsx +// Input +const nestedAssertions = /** @type {MyType} */ + (/** @type {unknown} */ + (x)); + +// Prettier stable +const nestedAssertions /** @type {MyType} */ /** @type {unknown} */ = x; + +// Prettier master +const nestedAssertions = /** @type {MyType} */ (/** @type {unknown} */ (x)); +``` + +Reference documentation for this syntax: [Closure Compiler](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-type), [TypeScript (with `--checkJs`)](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#casts). + +### TypeScript + +#### TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +Prettier now supports the new syntax added in TypeScript 3.8: + +- [Type-Only Imports and Exports](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#type-only-imports-exports) +- [ECMAScript Private Fields](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#ecmascript-private-fields) +- [`export * as ns`](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#export-star-as-namespace-syntax) + +### CLI + +#### Test whether passed globs are names of existing files before treating them as globs ([#7587](https://github.com/prettier/prettier/pull/7587) by [@fisker](https://github.com/fisker)) + +Since file names in Linux can contain almost any characters, strings like `foo*.js` and `[bar].css` are valid file names. Previously, if the user needed to format a file named `[bar].css`, a glob escaping syntax had to be used: `prettier "\[bar].css"` (this one doesn't work on Windows, where backslashes are treated as path separators) or `prettier "[[]bar].css"`. Because of this, important use cases were broken. E.g. [lint-staged](https://github.com/okonet/lint-staged) passes absolute paths and knows nothing about the escaping syntax. Now, when Prettier CLI gets a glob, it first tries to resolve it as a literal file name. + +#### Expand directories, including `.` ([#7660](https://github.com/prettier/prettier/pull/7660) by [@thorn0](https://github.com/thorn0)) + +It's finally possible to run `prettier --write .` to format all supported files in the current directory and its subdirectories. +Directory names can be mixed with file names and glob patterns (e.g. `prettier src "test/*.spec.js" foo.js`). + +Also, the order in which files are processed has changed. Previously, all the files were sorted alphabetically before +formatting. Now, their order corresponds to the order of the specified paths. For each path, the list of resolved +files is sorted, but the full sorting of the resulting combined list isn't done anymore. + +## Breaking changes + +### API + +#### Fix config overrides pattern matching to include dot files ([#5813](https://github.com/prettier/prettier/pull/5813) by [@chrisblossom](https://github.com/chrisblossom)) + +Previously, [configuration overrides](/docs/en/configuration.html#configuration-overrides) weren't applied to files whose name had a leading dot. + +#### Drop support for Node versions older than 10 ([#6908](https://github.com/prettier/prettier/pull/6908) by [@fisker](https://github.com/fisker)) + +The minimal required Node version now is 10.13.0. + +#### Change default value for `trailingComma` to `es5` ([#6963](https://github.com/prettier/prettier/pull/6963) by [@fisker](https://github.com/fisker)) + +Before version 2.0, Prettier was avoiding trailing commas by default where possible. +This made the resulting JavaScript compatible with now very old environments such as IE8, but implied [some missed opportunities](https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8). + +Prettier has included an [option to configure trailing commas](https://prettier.io/docs/en/options.html#trailing-commas) since its early days, and an initiative to change the default value has been out there [for over three years](https://github.com/prettier/prettier/issues/68). +Finally, the default value becomes `es5` instead of `none` in Prettier v2.0. + +If the old behavior is still preferred, please configure Prettier with `{ "trailingComma": "none" }`. +There is a possibility that the default value will change to `always` (meaning even more trailing commas) in a future major version of Prettier as the JavaScript ecosystem further matures. + +#### Remove deprecated API and change util signatures ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker)) + +- Parser `typescript-eslint` is removed. Use the `typescript` parser instead. +- `prettier.util.mapDoc` is removed. Use `prettier.doc.utils.mapDoc` instead. +- `prettier.util.isNextLineEmpty` is updated.
+ Use `isNextLineEmpty(text, node, locEnd)` instead of `isNextLineEmpty(text, node, options)`. +- `prettier.util.isPreviousLineEmpty` is updated.
+ Use `isPreviousLineEmpty(text, node, locStart)` instead of `isPreviousLineEmpty(text, node, options)`. +- `prettier.util.getNextNonSpaceNonCommentCharacterIndex` is updated.
+ Use `getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd)` instead of `getNextNonSpaceNonCommentCharacterIndex(text, node, options)`. + +#### Change default value for `arrowParens` to `always` ([#7430](https://github.com/prettier/prettier/pull/7430) by [@kachkaev](https://github.com/kachkaev)) + +[Since version 1.9](https://prettier.io/blog/2017/12/05/1.9.0.html#option-to-add-parens-in-arrow-function-arguments-3324httpsgithubcomprettierprettierpull3324-by-rattrayalexhttpsgithubcomrattrayalex-and-suchipihttpsgithubcomsuchipi), Prettier has had an [option](https://prettier.io/docs/en/options.html#arrow-function-parentheses) to always wrap arrow function arguments with parentheses. +In version 2.0, this behavior has become the default. + + +```js +// Input +const fn = (x) => y => x + y; + +// Prettier stable +const fn = x => y => x + y; + +// Prettier master +const fn = (x) => (y) => x + y; +``` + +At first glance, avoiding parentheses in the isolated example above may look like a better choice because it results in less visual noise. +However, when Prettier removes parentheses, it becomes harder to add type annotations, extra arguments, default values, or a variety of [other things](https://twitter.com/ManuelBieh/status/1181880524954050560). +Consistent use of parentheses provides a better developer experience when editing real codebases, which justifies the change. + +You are encouraged to use the new default value, but if the old behavior is still preferred, please configure Prettier with `{ "arrowParens": "avoid" }`. + +#### Change default value for `endOfLine` to `lf` ([#7435](https://github.com/prettier/prettier/pull/7435) by [@kachkaev](https://github.com/kachkaev)) + +Early versions of Prettier were formatting all files with the \*nix flavor of [line endings](https://en.wikipedia.org/wiki/Newline) (`\n`, also known as `LF`). +This behavior was changed in [#472](https://github.com/prettier/prettier/pull/472), which allowed preserving Windows line endings (`\r\n`, also known as `CRLF`). + +[Since Prettier version 1.15](https://prettier.io/blog/2018/11/07/1.15.0.html#add-an-option-to-enforce-line-endings-5327-by-kachkaev), the flavor of line endings has been configurable via the `endOfLine` option. +The default value was set to `auto` for backwards compatibility, which meant that Prettier preserved whichever flavor of line endings was already present in a given file. + +That meant Prettier converted mixed line endings within one file to what was found at the end of the first line. +However, line endings in separate files could still remain inconsistent. +Besides, contributors on different operating systems could accidentally change line endings in previously committed files and this would be fine with Prettier. +Doing so would produce a large `git diff` and thus make the line-by-line history for a file (`git blame`) harder to explore. + +You are encouraged to use the new default value for `endOfLine`, which is now `lf`. +It may be also worth [checking the option docs](https://prettier.io/docs/en/options.html#end-of-line) to ensure your project repository is configured correctly. +This will help you avoid a mix of line endings in the repo and a broken `git blame`. +If the old behavior is still preferred, please configure Prettier with `{ "endOfLine": "auto" }`. + +#### Cache plugin search results ([#7485](https://github.com/prettier/prettier/pull/7485) by [@fisker](https://github.com/fisker)) + +Previously, Prettier searched the file system for plugins on every `prettier.format` call. Now, search results are cached. The cache can be cleared by calling `prettier.clearConfigCache()`. + +#### Remove deprecated options and option values ([#7511](https://github.com/prettier/prettier/pull/7511), [#7533](https://github.com/prettier/prettier/pull/7533), [#7535](https://github.com/prettier/prettier/pull/7535), [#7536](https://github.com/prettier/prettier/pull/7536) by [@fisker](https://github.com/fisker)) + +- Options: + - `useFlowParser` (`--flow-parser` in CLI) has been deprecated [since `v0.0.10`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#0010). +- Option values: + - `parser`: `babylon` (renamed to `babel` in v1.16.0), `postcss` (renamed to `css` in v1.7.1) + - `proseWrap`: `true` (renamed to `always` in v1.9.0), `false` (renamed to `never` in v1.9.0) + - `trailingComma`: `true` (renamed to `es5` in v0.19.0), `false` (renamed to `none` in v0.19.0) + +#### Remove the `version` parameter of `prettier.getSupportInfo` ([#7620](https://github.com/prettier/prettier/pull/7620) by [@thorn0](https://github.com/thorn0)) + +Since Prettier 1.8.0, it was possible to pass a version number to `prettier.getSupportInfo` to get information on the languages, options, etc. supported by previous versions. This interesting but apparently not very useful API kept causing maintenance problems and has been removed in Prettier 2.0.0. + +## Other changes + +### JavaScript + +#### Always add a space after the `function` keyword ([#3903](https://github.com/prettier/prettier/pull/3903) by [@j-f1](https://github.com/j-f1), [@josephfrazier](https://github.com/josephfrazier), [@sosukesuzuki](https://github.com/sosukesuzuki), [@thorn0](https://github.com/thorn0); [#7516](https://github.com/prettier/prettier/pull/7516) by [@bakkot](https://github.com/bakkot)) + +Previously, a space would be added after the `function` keyword in function declarations, but not in function expressions. Now, for consistency, a space is always added after the `function` keyword. The only exception is generator declarations where `function*` is treated as a whole word. + + +```ts +// Prettier stable +const identity = function(value) { + return value; +}; +function identity(value) { + return value; +} +const f = function(value: T) {}; +const g = function*() {}; + +// Prettier master +const identity = function (value) { + return value; +}; +function identity(value) { + return value; +} +const f = function (value: T) {}; +const g = function* () {}; +``` + +#### Fix unstable formatting of labeled statements with comments ([#6984](https://github.com/prettier/prettier/pull/6984) by [@clement26695](https://github.com/clement26695)) + + +```jsx +// Input +loop1: +//test +const i = 3; + +// Prettier stable (first output) +loop1: //test +const i = 3; + +// Prettier stable (second output) +//test +loop1: const i = 3; + +// Prettier master (first output) +//test +loop1: const i = 3; +``` + +#### Fix formatting of logical, binary and sequence expressions in template literals ([#7010](https://github.com/prettier/prettier/pull/7010) by [@evilebottnawi](https://github.com/evilebottnawi)) + + +```js +// Input +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo || bar}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo | bar}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${(foo, bar)}`; + +// Prettier stable +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo || + bar}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo | + bar}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${(foo, +bar)}`; + +// Prettier master +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${ + foo || bar +}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${ + foo | bar +}`; +`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${ + (foo, bar) +}`; +``` + +#### Fix unstable formatting of logical expressions ([#7026](https://github.com/prettier/prettier/pull/7026) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +const averredBathersBoxroomBuggyNurl = + bifornCringerMoshedPerplexSawder === 1 || + (askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3); + +// Prettier stable (first output) +const averredBathersBoxroomBuggyNurl = + bifornCringerMoshedPerplexSawder === 1 || + askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3; + +// Prettier stable (second output) +const averredBathersBoxroomBuggyNurl = + bifornCringerMoshedPerplexSawder === 1 || + askTrovenaBeenaDependsRowans === 2 || + glimseGlyphsHazardNoopsTieTie === 3; + +// Prettier master (first and second outputs) +const averredBathersBoxroomBuggyNurl = + bifornCringerMoshedPerplexSawder === 1 || + askTrovenaBeenaDependsRowans === 2 || + glimseGlyphsHazardNoopsTieTie === 3; +``` + +#### Format `throw` like `return` ([#7070](https://github.com/prettier/prettier/pull/7070) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +function foo() { + throw this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft.right; +} + +// Prettier stable +function foo() { + throw this.hasPlugin("dynamicImports") && + this.lookahead().type === tt.parenLeft.right; +} + + +// Prettier master +function foo() { + throw ( + this.hasPlugin("dynamicImports") && + this.lookahead().type === tt.parenLeft.right + ); +} +``` + +#### Fix indentation in ternaries nested in conditions of other ternaries ([#7087](https://github.com/prettier/prettier/pull/7087) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +const foo = (number % 10 >= 2 && (number % 100 < 10 || number % 100 >= 20) ? +kochabCooieGameOnOboleUnweave : annularCooeedSplicesWalksWayWay) +? anodyneCondosMalateOverateRetinol : averredBathersBoxroomBuggyNurl; + +// Prettier stable +const foo = (number % 10 >= 2 && (number % 100 < 10 || number % 100 >= 20) +? kochabCooieGameOnOboleUnweave +: annularCooeedSplicesWalksWayWay) + ? anodyneCondosMalateOverateRetinol + : averredBathersBoxroomBuggyNurl; + +// Prettier master +const foo = ( + number % 10 >= 2 && (number % 100 < 10 || number % 100 >= 20) + ? kochabCooieGameOnOboleUnweave + : annularCooeedSplicesWalksWayWay +) + ? anodyneCondosMalateOverateRetinol + : averredBathersBoxroomBuggyNurl; +``` + +#### Tweak function composition logic for decorators ([#7138](https://github.com/prettier/prettier/pull/7138) by [@brainkim](https://github.com/brainkim)) + +Because decorators modify the line following, splitting a decorator call’s +arguments onto multiple lines can obscure the relationship between the +decorator and its intended target, producing less-readable code. Therefore, the +function composition logic introduced in [#6033](https://github.com/prettier/prettier/pull/6033) has been changed to exclude +decorator calls. + + +```jsx +// Input +export class Item { + @OneToOne(() => Thing, x => x.item) + thing!: Thing; +} + +// Output (Prettier stable) +export class Item { + @OneToOne( + () => Thing, + x => x.item, + ) + thing!: Thing; +} + +// Output (Prettier master) +export class Item { + @OneToOne(() => Thing, x => x.item) + thing!: Thing; +} +``` + +#### Correct semicolon placement in empty `return` statement with comment ([#7140](https://github.com/prettier/prettier/pull/7140) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +return // comment +; + +// Prettier stable +return // comment; + +// Prettier master +return; // comment +``` + +#### Respect whitespace significance in HTML template literals ([#7208](https://github.com/prettier/prettier/pull/7208) by [@saschanaz](https://github.com/saschanaz)) + +Prettier had been adding newlines for every HTML template string, which could lead to unexpected whitespace in rendered HTML. +This doesn't happen anymore unless `--html-whitespace-sensitivity ignore` option is given. + + +```jsx +// Input +html`
`; +html` TEXT `; + +// Prettier stable +html` +
+`; +html` + TEXT +`; + +// Prettier master +html`
`; +html` TEXT `; +``` + +#### Remove unnecessary parens when yielding JSX ([#7367](https://github.com/prettier/prettier/pull/7367) by [@cola119](https://github.com/cola119)) + + +```jsx +// Input +function* f() { + yield
generator
; +} + +// Prettier stable +function* f() { + yield (
generator
); +} + +// Prettier master +function* f() { + yield
generator
; +} +``` + +#### Keep parentheses around comma expressions in default export declarations ([#7491](https://github.com/prettier/prettier/pull/7491) by [@fisker](https://github.com/fisker)) + +Omitting these parentheses makes the code invalid. + + +```jsx +// Input +export default (1, 2); + +// Prettier stable +export default 1, 2; + +// Prettier master +export default (1, 2); +``` + +#### Fix edge cases with parentheses around optional chaining ([#7500](https://github.com/prettier/prettier/pull/7500) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +(foo?.bar)(); +new (foo?.bar)(); + +// Prettier stable +foo?.bar(); +new foo?.bar(); + +// Prettier master +(foo?.bar)(); +new (foo?.bar)(); +``` + +#### Don't wrap `undefined` in parentheses in conditional expressions within JSX ([#7504](https://github.com/prettier/prettier/pull/7504) by [@fisker](https://github.com/fisker)) + +Previously, parentheses were added around any expression except `null`. Now, `undefined` is excluded too. + + +```js +// Input +foo ? loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx : +undefined +foo ? loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx : +null + +// Prettier stable +foo ? ( + + loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx + +) : ( + undefined +); +foo ? ( + + loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx + +) : null; + +// Prettier master +foo ? ( + + loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx + +) : undefined; +foo ? ( + + loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx + +) : null; +``` + +#### Keep comments position for assignments/variables ([#7709](https://github.com/prettier/prettier/pull/7709) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```jsx +// Input +const foo = /* comments */ + bar; + +// Prettier stable +const foo /* comments */ = bar; + +// Prettier master +const foo = /* comments */ bar; +``` + +### TypeScript + +#### Babel as an alternative parser for TypeScript ([#6400](https://github.com/prettier/prettier/pull/6400) by [@JounQin](https://github.com/JounQin) & [@thorn0](https://github.com/thorn0)) + +A new value for the `parser` option has been added: `babel-ts`, which makes use of Babel’s TypeScript plugin. The `babel-ts` parser supports JavaScript features not yet supported by TypeScript (ECMAScript proposals, e.g. [private methods and accessors](https://github.com/tc39/proposal-private-methods)), but it's less permissive when it comes to error recovery and less battle-tested than the `typescript` parser. While Babel’s TypeScript plugin is quite mature, ASTs produced by the two parsers aren't 100% compatible. We tried to take the discrepancies into account, but there are most likely still cases where code gets formatted differently or even incorrectly. We call upon you, our users, to help us find such cases. If you see them, please raise issues. In the long run, this will help with [unifying the AST format](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree#ast-alignment-tests) in future versions of the parsers and thus contribute to a better, more solid JavaScript parser ecosystem. + +#### Fix formatting of complex types in arrow function return type annotations ([#6901](https://github.com/prettier/prettier/pull/6901) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +export const getVehicleDescriptor = async ( + vehicleId: string +): Promise< + Collections.Parts.PrintedCircuitBoardAssembly["attributes"] & undefined +> => {}; + +// Prettier stable +export const getVehicleDescriptor = async ( + vehicleId: string +): Promise => {}; + +// Prettier master +export const getVehicleDescriptor = async ( + vehicleId: string +): Promise< + Collections.Parts.PrintedCircuitBoardAssembly["attributes"] & undefined +> => {}; +``` + +#### Print JSDoc-only types as is instead of throwing errors ([#7020](https://github.com/prettier/prettier/pull/7020) by [@thorn0](https://github.com/thorn0)) + +Another fix related to error recovery. Should come in handy to those who migrate from Flow to TypeScript. + + +```jsx +// Input +function fromFlow(arg: ?Maybe) {} + +// Prettier stable +Error: unknown type: "TSJSDocNullableType" + +// Prettier master +function fromFlow(arg: ?Maybe) {} +``` + +#### Don't print trailing commas after rest elements in tuples ([#7075](https://github.com/prettier/prettier/pull/7075) by [@thorn0](https://github.com/thorn0)) + +- A rest element is always the last element of a tuple type. Nothing can be added after it. +- While TS is okay with this comma, [Babel doesn't parse it](https://github.com/babel/babel/issues/10769) +- In function parameters and array destructuring, such a comma is a syntax error. Keeping it in tuples is inconsistent. + + +```jsx +// Input +type ValidateArgs = [ + { + [key: string]: any; + }, + string, + ...string[], +]; + +// Prettier stable +type ValidateArgs = [ + { + [key: string]: any; + }, + string, + ...string[], +]; + +// Prettier master +type ValidateArgs = [ + { + [key: string]: any; + }, + string, + ...string[] +]; +``` + +#### Fix indentation of arrow functions in variable declarations followed by comments ([#7094](https://github.com/prettier/prettier/pull/7094) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +This could happen with code written in the no-semicolon style if the statement after the variable declaration was prefixed with a semicolon to avoid ASI issues. + + +```ts +// Input +const foo = () => { + return +} + +// foo +;[1,2,3].forEach(bar) + +// Prettier stable +const foo = () => { + return; + }; + + // foo +[1, 2, 3].forEach(bar); + +// Prettier master +const foo = () => { + return; +}; + +// foo +[1, 2, 3].forEach(bar); +``` + +#### Fix printing of comments in function types ([#7104](https://github.com/prettier/prettier/pull/7104) by [@thorn0](https://github.com/thorn0)) + + +```ts +// Input +type f1 = ( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns +) => number; + +// Prettier stable +type f1 = (currentRequest: { + a: number; +}) => // TODO this is a very very very very long comment that makes it go > 80 columns +number; + +// Prettier master +type f1 = ( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns +) => number; +``` + +#### Fix formatting of comments for function-like nodes ([#7144](https://github.com/prettier/prettier/pull/7144) by [@armano2](https://github.com/armano2)) + + +```ts +// Input +interface foo1 { + bar1/* foo */ (/* baz */) // bat + bar2/* foo */ ? /* bar */ (/* baz */) /* bat */; + bar3/* foo */ (/* baz */) /* bat */ + bar4/* foo */ ? /* bar */ (bar: /* baz */ string): /* bat */ string; + /* foo */ (/* bar */): /* baz */ string; + /* foo */ (bar: /* bar */ string): /* baz */ string; + /* foo */ new /* bar */ (a: /* baz */ string): /* bat */ string + /* foo */ new /* bar */ (/* baz */): /* bat */ string +} + +type foo7 = /* foo */ (/* bar */) /* baz */ => void +type foo8 = /* foo */ (a: /* bar */ string) /* baz */ => void +let foo9: new /* foo */ (/* bar */) /* baz */ => string; +let foo10: new /* foo */ (a: /* bar */ string) /* baz */ => string; + +// Prettier stable +interface foo1 { + bar1 /* foo */ /* baz */(); // bat + bar2 /* foo */ /* bar */ /* baz */ /* bat */?(); + bar3 /* foo */ /* baz */() /* bat */; + bar4 /* foo */?(/* bar */ bar: /* baz */ string): /* bat */ string; + /* foo */ (): /* bar */ /* baz */ string; + /* foo */ (bar: /* bar */ string): /* baz */ string; + /* foo */ new (/* bar */ a: /* baz */ string): /* bat */ string; + /* foo */ new (): /* bar */ /* baz */ /* bat */ string; +} + +type foo7 = /* foo */ () => /* bar */ /* baz */ void; +type foo8 = /* foo */ (a: /* bar */ string) => /* baz */ void; +let foo9: new () => /* foo */ /* bar */ /* baz */ string; +let foo10: new (/* foo */ a: /* bar */ string) => /* baz */ string; + +// Prettier master +interface foo1 { + bar1 /* foo */(/* baz */); // bat + bar2 /* foo */ /* bar */?(/* baz */) /* bat */; + bar3 /* foo */(/* baz */) /* bat */; + bar4 /* foo */?(/* bar */ bar: /* baz */ string): /* bat */ string; + /* foo */ (/* bar */): /* baz */ string; + /* foo */ (bar: /* bar */ string): /* baz */ string; + /* foo */ new (/* bar */ a: /* baz */ string): /* bat */ string; + /* foo */ new (/* baz */): /* bar */ /* bat */ string; +} + +type foo7 = /* foo */ (/* bar */) => /* baz */ void; +type foo8 = /* foo */ (a: /* bar */ string) => /* baz */ void; +let foo9: new (/* bar */) => /* foo */ /* baz */ string; +let foo10: new (/* foo */ a: /* bar */ string) => /* baz */ string; +``` + + +```ts +// Input +abstract class Test { + abstract foo12 /* foo */ (a: /* bar */ string): /* baz */ void + abstract foo13 /* foo */ (/* bar */) /* baz */ +} + +// Prettier stable +Error: Comment "foo" was not printed. Please report this error! + +// Prettier master +abstract class Test { + abstract foo12 /* foo */(a: /* bar */ string): /* baz */ void; + abstract foo13 /* foo */(/* bar */); /* baz */ +} +``` + +#### Fix printing of mapped types with the template type omitted ([#7221](https://github.com/prettier/prettier/pull/7221) by [@cola119](https://github.com/cola119)) + + +```ts +// Input +type A = { [key in B] }; + +// Prettier stable +type A = { [key in B]: }; + +// Prettier master +type A = { [key in B] }; +``` + +#### Fix edge cases of printing index signatures ([#7228](https://github.com/prettier/prettier/pull/7228) by [@cola119](https://github.com/cola119)) + +Even though index signatures without type annotations or with multiple parameters aren't valid TypeScript, the TypeScript parser supports this syntax. In line with the [previous error recovery efforts](https://prettier.io/blog/2019/11/09/1.19.0.html#enable-formatting-even-if-there-are-parse-errors-in-some-cases-6816-by-thorn0-and-the-babel-team), Prettier now makes sure its output still can be parsed in these cases. Previous versions produced unparseable code. + + +```ts +// Input +type A = { [key: string] }; +type B = { [a: string, b: string]: string; }; + +// Prettier stable +type A = { [key: string]: }; +type B = { [a: stringb: string]: string }; + +// Prettier master +type A = { [key: string] }; +type B = { [a: string, b: string]: string }; +``` + +#### Fix printing of comments in empty type parameters ([#7729](https://github.com/prettier/prettier/pull/7729) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +const a: T = 1; + +// Prettier stable +Error: Comment "comment" was not printed. Please report this error! + +// Prettier master +const a: T = 1; +``` + +### Flow + +#### Add support for `symbol` ([#7472](https://github.com/prettier/prettier/pull/7472) by [@fisker](https://github.com/fisker)) + +A new AST node type was introduced in flow@0.114.0, now it's recognized. + + +```jsx +// Input +const x: symbol = Symbol(); + +// Prettier after updating Flow, but without this fix +Error: unknown type: "SymbolTypeAnnotation" + +// Prettier master +const x: symbol = Symbol(); +``` + +#### Add support for decorators ([#7482](https://github.com/prettier/prettier/pull/7482) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +/* @flow */ +@decorator4 +class Foo { + @decorator1 + method1() {} + + @decorator2 + @decorator3 + method2() {} +} + +// Prettier stable +SyntaxError: Unexpected token `@`, expected the token `class` (2:1) + +// Prettier master +/* @flow */ +@decorator4 +class Foo { + @decorator1 + method1() {} + + @decorator2 + @decorator3 + method2() {} +} +``` + +#### Fix private class field declarations ([#7484](https://github.com/prettier/prettier/pull/7484) by [@fisker](https://github.com/fisker)) + + +```js +// Input +class Foo { + #privateProp: number; +} + +// Prettier stable +class Foo { + privateProp: number; +} + +// Prettier master +class Foo { + #privateProp: number; +} +``` + +### CSS + +#### Don't lowercase element names in CSS selectors ([#6947](https://github.com/prettier/prettier/pull/6947) by [@ark120202](https://github.com/ark120202)) + +Previously, Prettier already preserved casing of unknown element names, but it did lowercase names of HTML elements. +This caused issues when CSS was applied to a case-sensitive document and there was an element with the same name as in HTML, which is the case in NativeScript. +Prettier now always preserves original casing. + + +```css +/* Input */ +Label { +} + +/* Prettier stable */ +label { +} + +/* Prettier master */ +Label { +} +``` + +### SCSS + +#### Don't add extra comma after last comment in map ([#6918](https://github.com/prettier/prettier/pull/6918) by [@fisker](https://github.com/fisker)) + +Previously, when `trailingComma` set to `es5`, an extra comma was added after last comment in an SCSS map. + + +```scss +// Input +$my-map: ( + 'foo': 1, // Comment + 'bar': 2, // Comment +); + +// Prettier stable +$my-map: ( + "foo": 1, + // Comment + "bar": 2, + // Comment, +); + +// Prettier master +$my-map: ( + "foo": 1, + // Comment + "bar": 2, + // Comment +); +``` + +#### Fix whitespace in SCSS concatenation ([#7211](https://github.com/prettier/prettier/pull/7211) by [@sasurau4](https://github.com/sasurau4)) + + +```scss +// Input +a { + background-image: url($test-path + 'static/test.jpg'); +} + +// Prettier stable +a { + background-image: url($test-path+"static/test.jpg"); +} + +// Prettier master +a { + background-image: url($test-path + "static/test.jpg"); +} +``` + +### Less + +#### Fix multiple long-standing issues by updating `postcss-less` ([#6981](https://github.com/prettier/prettier/pull/6981) by [@fisker](https://github.com/fisker), [#7021](https://github.com/prettier/prettier/pull/7021) by [@evilebottnawi](https://github.com/evilebottnawi), [@thorn0](https://github.com/thorn0)) + +- [`each`](http://lesscss.org/functions/#list-functions-each) is supported now ([#5653](https://github.com/prettier/prettier/issues/5653)). +- `!important` was being moved out of mixin call parameters ([#3544](https://github.com/prettier/prettier/issues/3544)). +- Comments in rulesets passed to mixin calls caused duplicate semicolons ([#3096](https://github.com/prettier/prettier/issues/3096)). +- `::before` was broken in mixin call parameters ([#5791](https://github.com/prettier/prettier/issues/5791)). + +### HTML + +#### Comments in `pre` tags caused bad formatting of following closing tag ([#5959](https://github.com/prettier/prettier/pull/5959) by [@selvazhagan](https://github.com/selvazhagan)) + + +```html + +
+
+    
+  
+ + +
+
+    
+  
+ + +
+
+    
+  
+
+``` + +#### Don't treat colons as namespace prefix delimiters in tag names ([#7273](https://github.com/prettier/prettier/pull/7273) by [@fisker](https://github.com/fisker)) + +In HTML5, colons don't have any special meaning in tag names. Previously, Prettier treated them the XML way, as namespace prefix delimiters, but no more. In practice, this means that tags whose ancestors have colons in their names are now treated as usual HTML tags: if they're known standard tags, their names can be lowercased and assumptions can be made about their whitespace sensitivity; custom elements whose names are unknown to Prettier retain the casing of their names and, if `--html-whitespace-sensitivity` is set to `css`, are treated as inline. + + +```html + + +
looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog block
+
block
block
block
block
block
+
 pre pr
+e
+ + looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog inline + inline inline inline inline +
+ + + +
+ looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog block +
+
block
block
block
block
block
+
 pre pr e
+ + + looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog inline + + inline inline inline inline +
+ + + +
+ looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog block +
+
block
+
block
+
block
+
block
+
block
+
+ pre pr
+e
+ + + looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog inline + + inline inline inline inline +
+``` + +#### Do not throw on broken HTML ([#7293](https://github.com/prettier/prettier/pull/7293) by [@fisker](https://github.com/fisker)) + + +```html + +
+< + + +TypeError: Cannot read property 'start' of null + + +
<
+``` + +#### Fix srcset parse error ([#7295](https://github.com/prettier/prettier/pull/7295) by [@fisker](https://github.com/fisker)) + + +```html + + + + +Error: Mixed descriptor in srcset is not supported + + + +``` + +#### Fix error thrown on unclosed tag in `pre` tag ([#7392](https://github.com/prettier/prettier/pull/7392) by [@fisker](https://github.com/fisker)) + + +```html + +

+

+ + +TypeError: Cannot read property 'start' of null + + +

+

+``` + +#### Fix inconsistent formatting of self-closing tags ([#7395](https://github.com/prettier/prettier/pull/7395) by [@fisker](https://github.com/fisker)) + + +```html + + + + + + + + + + + + + + +``` + +#### Fix empty lines unexpectedly added after `table` tags ([#7461](https://github.com/prettier/prettier/pull/7461) by [@ikatyang](https://github.com/ikatyang)) + + +```html + + + +
Should not insert empty line before this div
+ + + + +
+ +
Should not insert empty line before this div
+ + + + +
+
Should not insert empty line before this div
+``` + +#### Format value of HTML `class` attribute ([#7555](https://github.com/prettier/prettier/pull/7555) by [@fisker](https://github.com/fisker)) + + +```html + +
+
+ + +
+
+ + +
+
+``` + +#### Format value of HTML `style` attribute ([#7556](https://github.com/prettier/prettier/pull/7556) by [@fisker](https://github.com/fisker)) + + +```html + +
+
+
+
+ + +
+
+ + + +
+
+``` + +#### Support `` for text ([#7654](https://github.com/prettier/prettier/pull/7654) by [@graemeworthy](https://github.com/graemeworthy)) + +Previously, it worked only for tags. Useful for protecting various macros and pre-processor commands from being corrupted by formatting. + + +```html + + +A super long string that has been marked as ignore because it was probably generated by some script. + + + +A super long string that has been marked as ignore because it was probably +generated by some script. + + + +A super long string that has been marked as ignore because it was probably generated by some script. +``` + + +```html + + +| Dogs | Cats | Weasels | Bats | Pigs | Mice | Hedgehogs | Capybaras | Rats | Tigers | +| ---- | ---- | ------- | ---- | ---- | ---- | --------- | --------- | ---- | ------ | +| 1 | 1 | 0 | 0 | 1 | 1 | 5 | 16 | 4 | 0 | + + + +| Dogs | Cats | Weasels | Bats | Pigs | Mice | Hedgehogs | Capybaras | Rats | +Tigers | | ---- | ---- | ------- | ---- | ---- | ---- | --------- | --------- | +---- | ------ | | 1 | 1 | 0 | 0 | 1 | 1 | 5 | 16 | 4 | 0 | + + + +| Dogs | Cats | Weasels | Bats | Pigs | Mice | Hedgehogs | Capybaras | Rats | Tigers | +| ---- | ---- | ------- | ---- | ---- | ---- | --------- | --------- | ---- | ------ | +| 1 | 1 | 0 | 0 | 1 | 1 | 5 | 16 | 4 | 0 | +``` + +### Vue + +#### Format vue SFC containing JSX script ([#7180](https://github.com/prettier/prettier/pull/7180) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```html + + + + + + + + +``` + +#### Don't print sole string literals in attributes on a new line ([#7479](https://github.com/prettier/prettier/pull/7479) by [@fisker](https://github.com/fisker)) + + +```vue + + + + + + + + +``` + +#### Fix indentation of Vue expressions ([#7781](https://github.com/prettier/prettier/pull/7781) by [@fisker](https://github.com/fisker)) + + +```vue + + + + + + + + + +``` + +### Angular + +#### Unofficial rudimentary support for some of the most used directives of AngularJS 1.x ([#6869](https://github.com/prettier/prettier/pull/6869) by [@thorn0](https://github.com/thorn0)) + +While there are some syntax incompatibilities (one-time bindings and the precedence of `|`) between the expression languages of the old AngularJS and the new Angular, overall the two languages are compatible enough for legacy and hybrid AngularJS-based projects to be able to benefit from using Prettier. Previously, when Prettier formatted AngularJS templates using the Angular parser, it formatted expressions only in interpolations. Now, some of the most used AngularJS directives are formatted too, namely: `ng-if`, `ng-show`, `ng-hide`, `ng-class`, `ng-style`. + + +```html + +
Warning!
+ + +
Warning!
+ + +
Warning!
+``` + +#### Fix formatting of i18n attributes ([#7371](https://github.com/prettier/prettier/pull/7371) by [@thorn0](https://github.com/thorn0)) + +Prettier 1.19 [added](https://prettier.io/blog/2019/11/09/1.19.0.html#add-formatting-for-i18n-attributes-6695-by-voithos) +support for formatting [i18n attributes](https://angular.io/guide/i18n), but putting the closing quote mark on a new line +broke [custom ids](https://angular.io/guide/i18n#set-a-custom-id-for-persistence-and-maintenance). This is fixed now. + + +```html + +
+ + +
+ + +
+``` + +### Handlebars (alpha) + +#### Fix superfluous line breaks in `ConcatStatement` ([#7051](https://github.com/prettier/prettier/pull/7051) by [@dcyriller](https://github.com/dcyriller)) + + +```hbs +{{!-- input --}} +Link + +{{!-- Prettier stable --}} + + Link + + +{{!-- Prettier master --}} + + Link + +``` + +and + +```hbs +{{!-- input --}} +
+ Hello +
+ +{{!-- Prettier stable --}} +
+ Hello +
+ +{{!-- Prettier master --}} +
+ Hello +
+``` + +#### Fix a falling mustache issue ([#7052](https://github.com/prettier/prettier/pull/7052) by [@dcyriller](https://github.com/dcyriller)) + + +```hbs +{{!-- input --}} + + +{{!-- stable --}} + + +{{!-- master --}} + +``` + +#### Improve `MustacheStatement` printing ([#7157](https://github.com/prettier/prettier/pull/7157) by [@dcyriller](https://github.com/dcyriller)) + + +```hbs +{{!-- input --}} +

Hi here is your name, as it will be displayed {{firstName}} {{lastName}} , welcome!

+ +{{!-- stable --}} +

+ Hi here is your name, as it will be displayed {{firstName}} {{lastName + }} , welcome! +

+ +{{!-- master --}} +

+ Hi here is your name, as it will be displayed {{firstName}} {{ + lastName + }} , welcome! +

+``` + +#### Add support for `prettier-ignore` ([#7275](https://github.com/prettier/prettier/pull/7275) by [@chadian](https://github.com/chadian)) + + +```hbs +{{! Input}} +{{! prettier-ignore }} +
+ "hello! my parent was ignored" + {{#my-crazy-component "shall" be="preserved"}} + + {{/my-crazy-component}} +
+ +{{#a-normal-component isRestoredTo = "order" }} + +{{/a-normal-component}} + +{{! Prettier stable}} +{{! prettier-ignore }} +
+ "hello! my parent was ignored" + {{#my-crazy-component "shall" be="preserved"}} + + {{/my-crazy-component}} +
+ +{{#a-normal-component isRestoredTo="order"}} + +{{/a-normal-component}} + +{{! Prettier master}} +{{! prettier-ignore }} +
+ "hello! my parent was ignored" + {{#my-crazy-component "shall" be="preserved"}} + + {{/my-crazy-component}} +
+ +{{#a-normal-component isRestoredTo='order'}} + +{{/a-normal-component}} +``` + +#### Support printing inline Handlebars in HTML ([#7306](https://github.com/prettier/prettier/pull/7306) by [@dcyriller](https://github.com/dcyriller)) + + +``` + + + + + + + + +``` + +#### Fix stripped value from AttrNode ([#7552](https://github.com/prettier/prettier/pull/7552) by [@bantic](https://github.com/bantic)) + + +```hbs +{{!-- input --}} +
    +
+ +{{!-- Prettier stable --}} +
    + +{{!-- Prettier master --}} +
      +
    +``` + +#### Preserve whitespace control characters ([#7575](https://github.com/prettier/prettier/pull/7575) by [@mahirshah](https://github.com/mahirshah)) + + +```hbs +{{!-- input --}} +{{~#if bar}} + if1 +{{~else~}} + else +{{~/if~}} + +{{!-- stable --}} +{{#if bar}} + if1 +{{else}} + else +{{/if}} + +{{!-- master --}} +{{~#if bar}} + if1 +{{~else~}} + else +{{~/if~}} +``` + +### GraphQL + +#### Improve detection of separator between interfaces ([#7305](https://github.com/prettier/prettier/pull/7305) by [@fisker](https://github.com/fisker)) + +Even though using a comma to separate multiple implemented interfaces is deprecated syntax, in order to support legacy use cases, Prettier keeps the original separator and doesn't wilfully replace commas with ampersands. Previously, however, this logic contained a bug, so the wrong separator could end up in the output. This is fixed now. + + +```graphql +# Input +type Type1 implements A, B +# { & <-- Removing this comment changes the separator in stable +{a: a} + +type Type2 implements A, B & C{a: a} + +# Prettier stable +type Type1 implements A & B { + # { & <-- Removing this comment changes the separator in stable + a: a +} + +type Type2 implements A & B & C { + a: a +} + +# Prettier master +type Type1 implements A, B { + # { & <-- Removing this comment changes the separator in stable + a: a +} + +type Type2 implements A, B & C { + a: a +} +``` + +### Markdown + +#### Handle zero-based lists correctly ([#6852](https://github.com/prettier/prettier/pull/6852) by [@evilebottnawi](https://github.com/evilebottnawi)) + + +```md + +0. List +1. List +2. List + + +0. List +1. List +1. List + + +0. List +1. List +2. List +``` + +#### Fix redundant leading spaces in lists ([#7178](https://github.com/prettier/prettier/pull/7178) by [@sasurau4](https://github.com/sasurau4)) + + +```md + +- a + b + c + d + e + +- a + b + c + d + e + +1. a + b + c + d + e + +1. a + b + c + d + e + + +- a + b + c + d + e + +- a + b + c + d + e + +1. a + b + c + d + e + +1. a + b + c + d + e + + +- a + b + c + d + e + +- a + b + c + d + e + +1. a + b + c + d + e + +1. a + b + c + d + e +``` + +#### Fix HTML formatting broken if the beginning tag starts after a list item ([#7181](https://github.com/prettier/prettier/pull/7181) and [#7220](https://github.com/prettier/prettier/pull/7220) by [@sasurau4](https://github.com/sasurau4)) + +Previously, when Prettier formatted an HTML tag placed just after a list item, it would insert indent and break the relationship of open and close tag. Now, Prettier no longer changes anything. + + +```md + +- A list item. +
    Summary +

    + +- A list item. + +

    +
    + +- A list item +
    asdf
    + + +- A list item. + +
    Summary +

    + +- A list item. + +

    +
    + +- A list item +
    asdf
    + + +- A list item. +
    Summary +

    + +- A list item. + +

    +
    + +- A list item +
    asdf
    +``` + +#### Fix formatting of multi-line footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4)) + + +```md + +Here's a statement[^footnote]. + +[^footnote]: + Here's a multi-line footnote walking back the above statement, and showing + how it's all totally bollocks. + + +Here's a statement[^footnote]. + +[^footnote]: + + Here's a multi-line footnote walking back the above statement, and showing + how it's all totally bollocks. + + +Here's a statement[^footnote]. + +[^footnote]: + Here's a multi-line footnote walking back the above statement, and showing + how it's all totally bollocks. +``` + +### MDX + +#### Add support for JSX fragments ([#6398](https://github.com/prettier/prettier/pull/6398) by [@JounQin](https://github.com/JounQin)) + + +```md + +<> + test test + 123 + + +<> +test test + 123 + + +<> + test test + 123 +``` + +#### Fix JSX parsing bugs introduced in Prettier 1.19 ([#6949](https://github.com/prettier/prettier/pull/6949) by [@Tigge](https://github.com/Tigge) & [@thorn0](https://github.com/thorn0)) + +MDX parsing for JSX failed when encountering JSX elements that where not +parsable as HTML, such as `test` + + +```md + + +test + + +
    + hi + { hello } + { /* another comment */} +
    +
    + + + +SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:35) +> 1 | test + + + +test + + +
    + hi + {hello} + {/* another comment */} +
    +
    + +``` + +### CLI + +#### Support file extensions `.cjs` and `.yaml.sed` ([#7210](https://github.com/prettier/prettier/pull/7210) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +```sh +# Prettier stable +$ prettier test.cjs +test.cjs[error] No parser could be inferred for file: test.cjs + +# Prettier master +$ prettier test.cjs +"use strict"; +console.log("Hello, World!"); +``` + +#### Respect `--ignore-path` when prettier executes from a subdirectory ([#7588](https://github.com/prettier/prettier/pull/7588) by [@heylookltsme](https://github.com/heylookltsme)) + +Changes the filename used when filtering ignored files to be relative to the +`--ignore-path`, if present, rather than the current working directory. + +#### Remove `--stdin` ([#7668](https://github.com/prettier/prettier/pull/7668) by [@thorn0](https://github.com/thorn0)) + +This CLI flag, never properly documented, was supposed to make Prettier CLI read input from stdin, but Prettier CLI does so anyway when not given any file paths or glob patterns. So the flag was redundant. Now that it's been removed, if you use this flag in your commands, you'll see a warning: "Ignored unknown option". This warning is just information. It doesn't prevent the command from doing what it should do and doesn't affect the exit code. diff --git a/website/siteConfig.js b/website/siteConfig.js index 2c0c8c4db..abf4c006a 100644 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -53,7 +53,9 @@ const siteConfig = { }, highlight: { theme: "default", + version: require("highlight.js/package.json").version, }, + usePrism: ["javascript", "jsx", "typescript", "ts", "js", "html"], useEnglishUrl: true, scripts: ["https://buttons.github.io/buttons.js"], stylesheets: [ diff --git a/website/versioned_docs/version-stable/for-enterprise.md b/website/versioned_docs/version-stable/for-enterprise.md new file mode 100644 index 000000000..46e1a343a --- /dev/null +++ b/website/versioned_docs/version-stable/for-enterprise.md @@ -0,0 +1,49 @@ +--- +id: version-stable-for-enterprise +title: For Enterprise +original_id: for-enterprise +--- + +## Available as part of the Tidelift Subscription + +Tidelift is working with the maintainers of Prettier and thousands of other open source projects to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. + +Learn more +Request a demo + +
    + +### Enterprise-ready open source software—managed for you + +The Tidelift Subscription is a managed open source subscription for application dependencies covering millions of open source projects across JavaScript, Python, Java, PHP, Ruby, .NET, and more. + +Your subscription includes: + +**Security updates** + +Tidelift’s security response team coordinates patches for new breaking security vulnerabilities and alerts immediately through a private channel, so your software supply chain is always secure. + +**Licensing verification and indemnification** + +Tidelift verifies license information to enable easy policy enforcement and adds intellectual property indemnification to cover creators and users in case something goes wrong. You always have a 100% up-to-date bill of materials for your dependencies to share with your legal team, customers, or partners. + +**Maintenance and code improvement** + +Tidelift ensures the software you rely on keeps working as long as you need it to work. Your managed dependencies are actively maintained and we recruit additional maintainers where required. + +**Package selection and version guidance** + +We help you choose the best open source packages from the start—and then guide you through updates to stay on the best releases as new issues arise. + +**Roadmap input** + +Take a seat at the table with the creators behind the software you use. Tidelift’s participating maintainers earn more income as their software is used by more subscribers, so they’re interested in knowing what you need. + +**Tooling and cloud integration** + +Tidelift works with GitHub, GitLab, BitBucket, and more. We support every cloud platform (and other deployment targets, too). + +The end result? All of the capabilities you expect from commercial-grade software, for the full breadth of open source you use. That means less time grappling with esoteric open source trivia, and more time building your own applications—and your business. + +Learn more +Request a demo diff --git a/website/yarn.lock b/website/yarn.lock index dbcbbbd9b..fc65c5195 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -3768,9 +3768,9 @@ hex-color-regex@^1.1.0: integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== highlight.js@^9.16.2: - version "9.16.2" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.16.2.tgz#68368d039ffe1c6211bcc07e483daf95de3e403e" - integrity sha512-feMUrVLZvjy0oC7FVJQcSQRqbBq9kwqnYE4+Kj9ZjbHh3g+BisiPgF49NyQbVLNdrL/qqZr3Ca9yOKwgn2i/tw== + version "9.18.1" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.18.1.tgz#ed21aa001fe6252bb10a3d76d47573c6539fe13c" + integrity sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg== hmac-drbg@^1.0.0: version "1.0.1" @@ -5937,9 +5937,9 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" prismjs@^1.17.1: - version "1.17.1" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" - integrity sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q== + version "1.19.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.19.0.tgz#713afbd45c3baca4b321569f2df39e17e729d4dc" + integrity sha512-IVFtbW9mCWm9eOIaEkNyo2Vl4NnEifis2GQ7/MLRG5TQe6t+4Sj9J5QWI9i3v+SS43uZBlCAOn+zYTVYQcPXJw== optionalDependencies: clipboard "^2.0.0"