Commit Graph
100 Commits
Author SHA1 Message Date
Georgii Dolzhykov ab72a2c11c Refactor: simplify fits (#13154) 2022-07-23 20:15:50 +08:00
Georgii Dolzhykov 20cc23ba35 Fix idempotence issues caused by eol comments after = in assignments (#12349) 2022-03-08 01:08:35 +08:00
Georgii Dolzhykov 542549c372 Refactor printing definite assignment assertions (#12351)
* Refactor printing definite assignment assertions

* Add changelog

* Fix unexpected ! in var initializers
2022-03-04 09:28:48 +09:00
Georgii Dolzhykovandsosukesuzuki 11e43e2e17 Avoid extra offset in arrow function body when using long types (alternative solution) (#11515)
* Avoid extra offset in arrow function body when using long types

* Rename var

* Handle object types properly

* Refactor, add test

* Don't try to keep arrow signatures on one line

Regression testing showed that this was a bad idea in this case

* Add changelog

* Break lhs if it's breakable and rhs is arrow fn

* Reuse isArrowFunctionVariableDeclarator

Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2021-11-17 16:24:16 +09:00
Georgii Dolzhykov 3616182508 Fix incorrectly wrapped arrow functions with return types (#10940) 2021-05-25 10:39:51 +03:00
Georgii Dolzhykov 8410e0db01 Update CONTRIBUTING.md 2021-05-21 12:58:21 +03:00
Georgii Dolzhykov b84bc954e8 Update CONTRIBUTING.md 2021-05-20 23:59:32 +03:00
Georgii Dolzhykov 6dcc20c0fc docs: make "A note on formatting reversibility" linkable 2021-05-20 23:40:45 +03:00
Georgii Dolzhykov 1005b4bca3 Update commands.md 2021-05-13 18:00:32 +03:00
Georgii Dolzhykov 4a8f5b81c1 Fix a link in the blog post 2021-05-10 19:08:49 +03:00
Georgii Dolzhykov 171b1ee2bf Clean changelog_unlreleased 2021-05-10 00:17:59 +03:00
ba1a833378 Add 2.3 blog post (#10659)
* Start 2.3 blog post

* Apply suggestions from code review

Co-authored-by: Alex Rattray <rattray.alex@gmail.com>

* Regenerate the post

* Regenerate blog post

* Regenerate post

* Edit changelog entries

* Regenerate blog post

Co-authored-by: Alex Rattray <rattray.alex@gmail.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-05-10 00:15:27 +03:00
Georgii Dolzhykov 06409b8bbf Fix release script 2021-05-10 00:14:45 +03:00
Georgii Dolzhykov e0610b0124 Update dependents count 2021-05-10 00:12:26 +03:00
Georgii Dolzhykov f7de2925b1 Git blame ignore 2.3.0 2021-05-10 00:10:45 +03:00
Georgii Dolzhykov 3d8dc612b5 Bump Prettier dependency to 2.3.0 2021-05-10 00:07:47 +03:00
Georgii Dolzhykov 2afc3b9ae6 Release 2.3.0 2021-05-10 00:00:41 +03:00
Georgii Dolzhykov 66feb01960 docs: update git hooks instructions in install.md (#10763)
* docs: update git hooks instructions in install.md

* Add Yarn 2 link
2021-04-26 01:13:09 +03:00
Georgii Dolzhykov 4d4c0011b6 Edit changelog 2021-04-21 03:34:26 +03:00
Georgii Dolzhykov c7b6116a45 Mark formatting improvements in changelog 2021-04-21 02:58:49 +03:00
Georgii Dolzhykov 08fb7af227 Mark formatting improvements in changelog 2021-04-21 02:45:44 +03:00
Georgii Dolzhykov 33cc92daad Address more feedback in changelog entries 2021-04-21 02:05:22 +03:00
Georgii Dolzhykov 8588462f4b Edit changelog entries (@j-f1's suggestions) 2021-04-20 23:48:06 +03:00
Georgii Dolzhykov 7630b4a2ad Bump codecov/codecov-action to 1.4.1 2021-04-20 18:51:15 +03:00
Georgii Dolzhykovandfisker Cheung bc90973cad Avoid arg expansion that leads to broken code (#10712)
* Avoid arg expansion that leads to broken code

* Preserve new lines and only take comments into account if they break lines

* Add robustness against path state corruption due to throwing

* Refactor

* Remove redundant logic

It solved the same issue but only partially.

* Simplify further

* Refactor path.try, fix callParent issue

* Minor refactoring

* Add istanbul ignore comment

* Add return to AstPath#try

Co-authored-by: fisker Cheung <lionkay@gmail.com>

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-04-20 15:02:11 +03:00
Georgii Dolzhykov 88d765a4be Edit changelog 2021-04-16 17:48:10 +03:00
Georgii Dolzhykov 1b2c72df10 TS: don't print parens around nested type assertions (#10702) 2021-04-15 00:19:42 +03:00
Georgii Dolzhykov a610179132 Improve lone argument detection (#10672) 2021-04-15 00:19:23 +03:00
Georgii Dolzhykov ae176f2e79 Process conditional groups in mapDoc (#10695) 2021-04-12 18:15:46 +03:00
Georgii Dolzhykov 22f9256faa Edit changelog entries (JS) 2021-04-12 12:43:47 +03:00
Georgii Dolzhykov 97db2e3926 Minor refactoring of printObject (#10696) 2021-04-12 05:20:27 +03:00
Georgii Dolzhykov 641fe5e3a4 Changelog edits 2021-04-12 05:16:47 +03:00
Georgii Dolzhykov e9f0a2b7c3 Dev package test: lock pnpm to pnpm@5 (#10694)
pnpm 6 dropped Node 10
2021-04-12 07:49:39 +08:00
Georgii Dolzhykov 1eaa8777a7 Mark changelog entries as highlights 2021-04-08 20:06:06 +03:00
Georgii Dolzhykov 7a5ccc581d Tweak object destructuring in assignments (#10643) 2021-04-06 12:59:14 +03:00
Georgii Dolzhykov 4c9e4c7b81 Deduplicate yarn.lock 2021-04-05 04:38:02 +03:00
Georgii Dolzhykov 5f8bad8275 chore: add plugins to issue template 2021-03-27 23:04:55 +02:00
Georgii Dolzhykov dfd471f334 Playground: autofold more AST properties (#10596) 2021-03-26 01:48:36 +02:00
Georgii Dolzhykov 45188c6396 docs: improve example for printer print function (#10587) 2021-03-24 18:09:09 +02:00
Georgii Dolzhykov 5624eaf87e issue template: insist on using the Playground (#7974) 2021-03-16 18:31:36 +02:00
Georgii Dolzhykov 770ed280cf Playground: serialize errors in AST (#10548) 2021-03-16 17:53:05 +02:00
Georgii Dolzhykov 13744dffa2 Fix edge case with trailing comments in arrow chains (#10543)
* Fix edge case with trailing comments in arrow chains

* Remove handling of args.needsSemi from printComments
2021-03-16 15:51:03 +02:00
Georgii Dolzhykov 68fd9db7d0 Fix Prettier 2.0 blog post 2021-03-16 15:05:15 +02:00
Georgii Dolzhykov 4fc2630c16 Remove stale plugins from home page and docs (#10538) 2021-03-15 03:54:59 +02:00
Georgii Dolzhykov f7fe6f52ca docs: refine browser.md (#10539) 2021-03-15 02:25:18 +02:00
Georgii Dolzhykov 6a87ce138a Improve detection of AMD define (#10528) 2021-03-15 00:08:37 +02:00
Georgii Dolzhykov 2740ea6ee8 Avoid last-argument hugging for number-only arrays (#10517) 2021-03-14 12:15:53 +02:00
Georgii Dolzhykov 169faf39ac Update yaml to 1.10.2 (#10516) 2021-03-14 12:14:08 +02:00
Georgii Dolzhykov 4ece300581 Fix Flow range formatting (#10505)
* Fix Flow range formatting

* Add changelog
2021-03-10 15:12:27 +02:00
Georgii Dolzhykov 33ab1fccc8 Clarify docs about pragma (#10500) 2021-03-10 03:40:15 +02:00
Georgii Dolzhykov 6be741d74e Fix PR number in changelog 2021-03-10 03:02:43 +02:00
Georgii Dolzhykov 109492a497 Clarify prettier.format docs (#10499) 2021-03-10 02:54:50 +02:00
Georgii Dolzhykov ceb7ee62f8 typechecking: remove @typescript-eslint/types from devDependencies (#10470)
@typescript-eslint/typescript-estree reexports these types.
2021-03-06 17:10:50 +02:00
Georgii Dolzhykov 37aa31e929 Remove hacks for single-element unions/intersections (#10457)
* Remove hacks for degenerate unions/intersection

* Add changelog
2021-03-04 01:21:03 +02:00
Georgii DolzhykovandSosuke Suzuki 5f8fee4d07 Prevent wrapping object properties with short keys (#10335)
* Prevent wrapping object properties with short keys

* Update src/language-js/print/assignment.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

* Use getStringWidth instead of .length

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-03-03 01:43:46 +02:00
Georgii Dolzhykov 23b4822e66 Disable Jest's default transformer (Babel) (#10454)
* Disable Jest's default transform (Babel)

https://jestjs.io/docs/en/next/code-transformation#defaults

Otherwise, I sometimes get this error because Babel tries to resolve Browserslist:

----
  ● plugin search should not crash when prettier isn't inside a directory › encountered a declaration exception

    ENOENT: no such file or directory, stat '/mnt/d/dev/prettier/tests_integration/mnt/d/dev/prettier/tests_integration/runPrettier.js'

      52 |   jest.spyOn(fs, "statSync").mockImplementation((filename) => {
      53 |     if (path.basename(filename) === "virtualDirectory") {
    > 54 |       return origStatSync(path.join(__dirname, __filename));
         |              ^
      55 |     }
      56 |     return origStatSync(filename);
      57 |   });

      at Object.<anonymous> (tests_integration/runPrettier.js:54:14)
      at isFile (node_modules/browserslist/node.js:38:42)
      at eachParent (node_modules/browserslist/node.js:46:13)
      at Object.getStat (node_modules/browserslist/node.js:197:15)
      at browserslist (node_modules/browserslist/index.js:433:19)
      at resolveTargets (node_modules/@babel/helper-compilation-targets/lib/index.js:174:46)
----
2021-03-01 13:55:20 +02:00
Georgii Dolzhykov 4a8fe3bc3c Fix --debug-print-doc (#10445) 2021-02-28 20:52:57 +02:00
Georgii Dolzhykov ff7a194e8a Recreate yarn.lock 2021-02-28 18:49:56 +02:00
Georgii Dolzhykov 285c15ef08 docs: how to ignore files using negative patterns (#10400) 2021-02-24 21:47:07 +02:00
Georgii Dolzhykov 3dfdb2cff5 Add Support Requests bot config file (#10387) 2021-02-23 20:17:15 +02:00
Georgii Dolzhykov ec27ade49b Heuristic for grouping parameters in method signatures (#10357)
* Heuristic for grouping parameters in method signatures
* Apply the same logic to function declaration and Flow types
* Group only if there is only one parameter
* Don't group if type param has constraints/default or >1 type param
2021-02-23 16:38:56 +02:00
Georgii Dolzhykov ca7c6fdec5 Add issue template config (#10386) 2021-02-22 16:45:02 +02:00
Georgii Dolzhykov 42f8271a1e Indent type assertions in heads of call and member expressions (#10341) 2021-02-20 14:37:08 +02:00
Georgii Dolzhykov 31b3351800 Better formatting for nested await in member/call expression heads (#10342) 2021-02-20 12:50:44 +02:00
Georgii Dolzhykov aef9277ada Print trailing comma for TS type parameters but not type arguments (#10353) 2021-02-20 12:47:56 +02:00
Georgii Dolzhykov e147c3b1c4 Fix ASI protection for private fields (#10334) 2021-02-18 12:39:56 +02:00
Georgii Dolzhykov 3950ce194d Correct parentheses for non-null assertions (#10337) 2021-02-18 01:52:24 +02:00
Georgii Dolzhykov 0a647a0d31 Format assignments more consistently (#10222) 2021-02-16 21:25:11 +02:00
Georgii Dolzhykov 9a2dc517ad Fix yarn.lock 2021-02-16 13:23:14 +02:00
Georgii Dolzhykovandfisker Cheung 2d1186995d Refine CONTRIBUTING.md (#10324)
* Slightly refine CONTRIBUTING.md

* Write more about run_spec

* Wording

* Deeper tests is an advanced topic. Move to bottom

* Mention prettier-regression-testing

* Fix the type for snippets

* Typo

* Add 'Advanced topics' heading

* Fix run_spec types

* Minor edits

* Add link

* Wording around yarn fix

* Update CONTRIBUTING.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-16 08:56:32 +02:00
Georgii Dolzhykov 3a73f48a0e Don't use smart quotes for JSON5 with --quote-props=preserve (#10323) 2021-02-15 19:13:33 +02:00
Georgii Dolzhykov 81e6208e63 Allow arg hugging for non-concise arrow functions with return type (#10316) 2021-02-15 19:13:09 +02:00
Georgii Dolzhykov a322cf152a Disable Babel error recovery for invalid escaped characters in identifiers (#10322) 2021-02-15 16:58:50 +02:00
Georgii Dolzhykov 7e8f746a4e website: remove svgo (#10315) 2021-02-15 05:29:24 +02:00
Georgii Dolzhykov ca4a51dcd9 build: fix tree shaking for front matter related functions (#10314) 2021-02-15 05:29:15 +02:00
Georgii Dolzhykov 8ba12c9d0d website: remove js for removed elements 2021-02-15 02:09:07 +02:00
Georgii Dolzhykov d3757fb6b4 website: add State of JS 2020 (#10312) 2021-02-15 00:22:08 +02:00
Georgii Dolzhykov 662cdb04db RFC: label doc (#10275)
* RFC: label doc

* Update functions in doc-utils
2021-02-10 17:08:54 +02:00
Georgii Dolzhykov f3906d84d4 Refactor: rename FastPath → AstPath (#10276) 2021-02-10 13:42:06 +02:00
Georgii Dolzhykov a55fe2d961 Add tests for #2239 (#10286) 2021-02-10 01:06:14 +02:00
Georgii Dolzhykov 03a43ae55f Fix error thrown on expressions like a(b => c => function (){}) (#10278) 2021-02-09 11:08:14 +02:00
Georgii Dolzhykov 0b5f259c08 Another minor fix in doc-debug 2021-02-06 14:41:02 +02:00
Georgii Dolzhykov 5a33fec904 RFC: indentIfBreak (#10221) 2021-02-05 01:03:40 +02:00
Georgii Dolzhykov 575be32c05 Minor fixes in doc-debug 2021-02-04 13:42:47 +02:00
Georgii Dolzhykovandfisker Cheung 58173be8b8 docs: revise commands.md (#10181)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-02 22:43:43 +02:00
Georgii Dolzhykov 62561039ac Playground: show sidebar by default (#10204)
Show sidebar by default. Hide if window width < height (likely mobile)
2021-02-02 02:23:16 +02:00
Georgii Dolzhykov 56840d4890 Followup for #10169: minor tweaks (#10177)
* Followup for #10169: minor tweaks

* Add Copy doc button to Playground
2021-01-30 18:25:43 +02:00
Georgii Dolzhykov 78b38d2282 Round-trippable --debug-print-doc (#10169) 2021-01-29 21:48:34 +02:00
Georgii Dolzhykov a7ea77e0ef Fix regression after pr-10106 (#10160) 2021-01-29 19:58:24 +02:00
Georgii Dolzhykov 8846448b85 Handlebars: fix formatting of attributes (#10145)
* Handlebars: fix formatting of attributes

* Add group only for class

* Add changelog

* Update clean.js

* Simplify ConcatStatement

* Lowercase attr name in clean

* Use text instead of n.chars
2021-01-28 23:45:08 +02:00
Georgii Dolzhykov b7a0e253f6 Fix changelog for #8233 2021-01-28 00:34:39 +02:00
Georgii Dolzhykov 53b59d2d39 Fix lineSuffixBoundary (#10122) 2021-01-28 00:29:34 +02:00
Georgii Dolzhykov 79d2f4a295 Add CLI flag for debugging comment attachment issues (#10124) 2021-01-27 12:30:10 +02:00
Georgii Dolzhykov 63a771db55 Add parallel-prettier to "Related Projects" (#10147) 2021-01-27 10:06:03 +02:00
Georgii Dolzhykov 1df287acc8 Use default parameters where possible and other microrefactoring (#10135) 2021-01-27 12:36:39 +08:00
Georgii Dolzhykov 343d372845 Document that Prettier never unquotes numeric properties in TS and Flow (#10126)
* Document that Prettier never unquotes numeric properties in TS and Flow

* Add Angular

* Mention Vue
2021-01-26 20:17:30 +02:00
Georgii Dolzhykov c5484f7a0a website: bigger font for <h5> in blog (#10142) 2021-01-26 18:56:42 +02:00
Georgii Dolzhykov 2b3716d527 Add skipped changelog entry to 2.2.0 blog post 2021-01-25 14:15:47 +02:00
Georgii Dolzhykov 24433cbbf6 Use fill to print number-only arrays (#10106) 2021-01-25 10:07:06 +02:00
Georgii Dolzhykov f333c65231 Minor spellchecking and typechecking fixes (#10125) 2021-01-25 02:43:42 +02:00