Commit Graph
2503 Commits
Author SHA1 Message Date
fisker Cheung 863eb079dc Forbid AstPath.call without name (#10541) 2021-03-15 17:20:27 +08: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
fisker Cheung 3995c2a1a1 Whitelist recovered babel parse errors (#10495) 2021-03-13 22:07:22 +02:00
fisker Cheung 1ce6b8dc3d Fix syntax error on JSON range formatting (#10497) 2021-03-12 00:24:45 +02:00
fisker Cheung d3a0699148 Rename n to node (#10504) 2021-03-10 22: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
fisker Cheung 02f803ac8d JSON: Only allow +/- number in UnaryExpression (#10434) 2021-03-09 10:58:31 +08:00
046ffb11f9 Support better formatting for curried arrow functions (#9992)
* Support formatting for curried arrow functions

* Fix test file name

* Fix threshold

* Add changelog

* Fix operator for comparing

* Fix return pos

* Fix eslint

* level 2

* Refactor for level2

* Update tests

* Remove concat

* If it fits on one line, print on one line

* Indent second level arg

* Break before last return value

* Use isCallLikeExpression

* Improve printing

* Add tests

* Remove unnecesary condition

* Fix lint problems

* Update src/language-js/utils.js

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>

* Update changelog

* Add ImportExpression

* Add ImportExpression to isCallLikeExpression

* Resolve conflicts

* Address reviews

* Fix ESLint problem

* Fix changelog

* Add tests

* More tests

* Print simple arrow chains on one line

* Don't forcibly break chain when a segment has a return type but no params

* Prevent excessive wrapping in assignments

* Simplify

* Format object bodies like blocks

* Update changelog

* Fix last arg expansion

* Simplify

* Fix arrow chains in assignment chains

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-08 23:18:53 +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
fisker Cheung 2f6580bebc Simplify babel parser (#10437) 2021-03-05 19:27:08 +08:00
Sosuke Suzukiandfisker Cheung f1b5720fc7 Remove unstable AST testing (#10462)
* Add unstable AST testing for json-stringify parser

* Deduplicate yarn.lock

* Ignore `tokens`

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-03-05 12:17:42 +02:00
Sosuke Suzuki eb5139b7a9 Remove unnecessary condition (#10032) 2021-03-05 09:24:46 +02:00
fisker CheungandGeorgii Dolzhykov 8a1ee9ad1b Support JSON6 (#10456)
* Add test

* Support JSON6

* Test

* Print `null` instead of holes

* More tests

* Update changelog

* Style

* Minor refactor

* Fix AST clean

* Fix `Identifier` clean

* Fix AST compare

* Style

* Reword changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-04 19:37:42 +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
fisker Cheung 2edfec5eda JSON: Better error message (#10452) 2021-03-02 13:42:49 +08:00
fisker Cheung ed9e9ab649 Improve json error code frame (#10433) 2021-03-01 10:04:09 +08:00
fisker Cheung 7aff95cac1 Refactor semicolon check (#10355) 2021-03-01 10:03:28 +08:00
fisker Cheung 9324380c53 JSON: Disallow sparse array (#10443) 2021-03-01 09:53:32 +08:00
fisker Cheung ed64ce0f0e JSON: Allow Infinity and NaN (#10451) 2021-03-01 09:14:20 +08:00
Sosuke Suzuki fc396277fc Support TS 4.2 abstract constructor signature (#10418) 2021-02-28 22:00:17 +02:00
fisker CheungandGeorgii Dolzhykov 383e17665e Refactor decorators print (#10296)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-01 02:58:43 +08:00
Georgii Dolzhykov 4a8fe3bc3c Fix --debug-print-doc (#10445) 2021-02-28 20:52:57 +02:00
fisker Cheung c163d346d4 Extract json parser (#10405) 2021-02-28 11:38:21 +08:00
fisker Cheung 95c8086c2c Add flat-ast-path-call rule (#10354) 2021-02-26 09:26:50 +08:00
fisker Cheung 64a3906571 Enable unicorn/prefer-optional-catch-binding (#9464) 2021-02-25 18:28:55 +08:00
Sosuke Suzuki feacf82892 Update babel/parser to v7.12.17 (#10345) 2021-02-25 18:28:06 +08:00
fisker Cheung 5682d2f440 Add printDirective (#10396) 2021-02-24 02:29:50 +08:00
dependabot[bot] 975e77ea4f Build(deps): Bump flow-parser from 0.144.0 to 0.145.0 (#10368) 2021-02-23 14:57:21 +00: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
fisker Cheung d544585d87 Make JSON parser stricter (#10346) 2021-02-23 13:33:10 +02:00
dependabot[bot]andGeorgii Dolzhykov eea7d11883 Build(deps): Bump linguist-languages from 7.12.2 to 7.13.0 (#10379)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-02-23 13:07:46 +08:00
fisker Cheung f392c7c526 Simplify JS locEnd (#10389) 2021-02-23 12:43:38 +08:00
fisker Cheung 3fc92980f2 Refactor: Switch second parameter of printComments from function to Doc (#10376) 2021-02-23 12:42:13 +08:00
fisker Cheung a9088a0b74 Refactor(JS): Extract printLiteral (#10392) 2021-02-23 12:41:54 +08:00
Sosuke Suzuki b0d66bb3c6 Support TS 4.1 intrinsic keyword (#10390) 2021-02-22 13:49:49 +02:00
fisker Cheung a07de7220c Consistent document import style (#10378) 2021-02-21 22:41:36 +02:00
fisker Cheung 9c6de24405 Style: Disallow == (#10338) 2021-02-21 02:44:16 +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
fisker Cheung 04988c3aa0 Remove OptionalMemberExpression clean (#10347) 2021-02-20 09:07:27 +08: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 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
fisker Cheung c3d08c943e Style: Disallow else if in no-else-return (#10310) 2021-02-15 05:29:58 +02:00