Commit Graph
100 Commits
Author SHA1 Message Date
Georgii Dolzhykov 2a864e5157 Fix playground: AST is massaged for Prettier 2.x (#14852) 2023-05-25 14:33:39 +09:00
Georgii Dolzhykov cfa5f27afe Avoid adding unnecessary indent to nested await (#14192) 2023-01-20 12:58:44 +02:00
Georgii Dolzhykov 201e02e14e Fix displacing of comments in default switch case (#14047) 2022-12-29 10:13:02 +08:00
Georgii Dolzhykov 7682464887 Tweak gap regex for Flow (#13703) 2022-10-24 12:20:44 +03:00
Georgii Dolzhykov e67d8d6c1e Remove support for Flow comment types (#13687) 2022-10-23 01:00:01 +03:00
Georgii Dolzhykov effe30a3b8 Playground: show preprocessed AST (#13606) 2022-10-10 14:26:55 +03:00
Georgii Dolzhykov 2c1532b823 Merge remote-tracking branch 'remotes/upstream/main' into next 2022-10-09 22:10:00 +03:00
Georgii Dolzhykov b893eeefb2 Update angular-html-parser (#13578) 2022-10-03 16:38:22 +03:00
Georgii Dolzhykov 6d4d011252 Fix unstable embedded template literals (#13532) 2022-09-26 16:24:41 +03:00
Georgii Dolzhykov 04faada98b Refactor handling or whitespace-only template literals in JS embed (#13517)
* Refactor handling or whitespace-only template literals in JS embed

* Rename "format" to "embed"
2022-09-25 15:26:14 +03:00
Georgii Dolzhykov 1f46accde5 Support nestled JSDoc comments (#13445) 2022-09-13 15:24:45 +03:00
Georgii Dolzhykov 47350dba05 Avoid throwing in path getters (#13455) 2022-09-11 21:53:31 +03:00
Georgii Dolzhykov 3f21de6583 Move comment-related printer methods to separate directory (#13454) 2022-09-11 21:53:11 +03:00
Georgii Dolzhykovandfisker Cheung 299503f9be Add getters to path object (#13448)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-09-09 21:28:14 +08:00
Georgii Dolzhykov 87d724f418 Refactor: use path.getValue() everywhere instead of getNode() (#13447)
Use path.getValue() everywhere instead of getNode()
2022-09-08 21:11:00 +03:00
Georgii Dolzhykov d2a0c778ef Fix merged line comments (#13438) 2022-09-08 09:45:33 +03:00
Georgii Dolzhykov 5766433a62 Get rid of regexp and handle cursor in trim in doc printer (#13426) 2022-09-06 15:57:47 +03:00
Georgii Dolzhykov 2a70ee49a6 Fix leading comments in mapped types with readonly (#13427) 2022-09-06 11:55:11 +03:00
Georgii Dolzhykov 9cf3c09be9 Override version for the trim package to fix Markdown perf (#13415) 2022-09-04 09:08:42 +08:00
Georgii Dolzhykov 39a89c6519 Don't break signature of hugged function expression if parameters are identifiers without types (#13410) 2022-09-03 17:49:57 +03:00
Georgii Dolzhykov a82a7e0233 Playground: press ctrl-q to generate a dummy id (#13405) 2022-09-01 23:20:56 +03:00
Georgii Dolzhykov f5610b8510 Hug object types in function parameters in Flow like in TS (#13396) 2022-08-30 17:38:50 +03:00
Georgii Dolzhykov 41ff44e0c6 Refactor, optimize and fix call args expansion (#13341) 2022-08-29 14:37:09 +03:00
Georgii Dolzhykov 1ea5c993a0 Fix arrow chain indentation in calls and binaries (#13391) 2022-08-29 12:27:24 +03:00
Georgii Dolzhykovandfisker Cheung c8ff3870c3 Refactor printObject (#13393)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-08-28 22:47:31 +03:00
Georgii Dolzhykov 0e17e18893 Refactor isSimpleCallArgument (#13359)
Refactor isSimpleCallArgument and make it a bit stricter
2022-08-26 18:11:25 +03:00
Georgii Dolzhykov 05c873f09d Playground: fix 'show doc', add folding for doc-explorer (#13336) 2022-08-22 09:25:18 +03:00
Georgii Dolzhykov 17081e6cf6 Support decorated function pattern (#10714) 2022-08-08 21:57:19 +03:00
Georgii Dolzhykov 67efa96da6 Custom parser API: deprecation notice (#13252) 2022-08-07 14:12:17 +03:00
Georgii Dolzhykov 21b4045dfa Link option philosophy from the main page (#13231)
website: link Option Philosophy from the main page
2022-08-06 19:48:37 +03:00
Georgii Dolzhykovandfisker Cheung 4d5b645e0e Support async parser for embedded languages (#13211)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-08-07 00:45:06 +08:00
Georgii Dolzhykovandfisker 2c77149e6a Add benchmark script (#13224)
Co-authored-by: fisker <lionkay@gmail.com>
2022-08-06 11:25:34 +08:00
Georgii Dolzhykov bbbeeb07f6 Playground: "Rethrow embed errors" checkbox (#13227) 2022-08-05 17:05:50 +03:00
Georgii Dolzhykov cd9955f143 Fix range format for function bodies (#13173) 2022-07-25 12:28:24 +03:00
Georgii Dolzhykov b65cb6c1f6 Playground: doc explorer (#10183) 2022-07-23 22:46:16 +03:00
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