Commit Graph

210 Commits (6ba4be015b3f10be4da13d4252060bc641ccd1a5)

Author SHA1 Message Date
Georgii Dolzhykov 6ba4be015b fix: numeric separators were removed from BigInt literals (#6796) 2019-11-04 18:21:29 +01:00
Georgii Dolzhykov 12ba997207 disable optimization from #6229 for calls with type arguments (#6791) 2019-11-03 13:05:08 +01:00
Zhongliang Wang 2cfd8fb518 Support TypeScript 3.7 (and drop Node 6 support for direct inst… (#6657)
* WIP: Support TypeScript 3.7

* Add support for `asserts` keyword; Update snapshots

* Update typescript-estree to v2.5.0 to remove the dependency on chokidar

* Update TypeScript

* Update CHANGELOG.unreleased.md

* Add examples for TypeScript 3.7

* Update TypeScript 3.7 to latest dev version

* Correct wording

* Support `declare` keyword on class members (TypeScript 3.7 feature)

* Update Changelog and downgrade TypeScript from 3.8.0-dev to 3.7.1-rc

* Add a note regarding to dropping Node 6 support for direct installation

* tweak build config to repair build

* update CHANGELOG.unreleased.md

* TSTypePredicate microrefactoring

* fix formatting

* clean up tests

* fix parens for optional chaining inside computed properties

* update CHANGELOG.unreleased.md

* unify output across parsers for template literals

* enable more tests with optional chaining

* fix unneeded parens inside computed key of OptionalMemberExpression

* fix paren issues for OptionalCallExpression

* more fixes for OptionalCallExpression

* @typescript-eslint/typescript-estree 2.5.1-alpha.4

* fix lint

* revert build hacks

* fix one more parens issue

* @typescript-eslint/typescript-estree 2.5.1-alpha.5, remove loggerFn override

* drop node 6 for direct installing from github

* fix another parens issue, disable some tests for flow

* workaround for flow bug

* fix issues with comments


Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2019-10-28 17:53:57 +01:00
Sosuke Suzuki f207e665bc JavaScript: Break arrays of arrays/objects if each element has more than one element/property (#6694)
* Modify to define isJestEachFunctionCall

* Modify to break ArrayExpression when parent is jest each function

* Add tests

* Update CHANGELOG.unreleased.md

* Fix comment

* Add pr number

* Update CHANGELOG.unreleased.md

* Remove hasNewLineInRange

* Modify to change logic for breaking jest each call function

* Modify to add logic for breaking ArrayExpression

* Modify to avoid mixed nested array

* Modify to remove changes for jest

* Update CHANGELOG.unreleased.md

* Update CHANGELOG.unreleased.md
2019-10-25 19:12:07 +03:00
Sosuke Suzuki 7f68db8e88 JavaScript: arguments with object contains newline in arrow function (#6382)
* Modify to fix arguments with object contains newline in arrow function(nested)

* Update CHANGELOG.unreleased.md

* Update tests

* Modify to refactor

* Modify to refactor

* Add pr number and link

* Update CHANGELOG.unreleased.md

* Modify to remove unnecessary null checking

* Fix for ArrayPattern

* Fix for RestElement

* Fix for AssignmentPattern

* Update tests

* Fix for nested array and object

* Update tests

* Fix for nested array pattern

* Update tests

* Modify to discard unnecessary node type check

* Fix for rest element

* Fix for array in rest

* Fix for array in assignment pattern

* Update tests

* Fix for CallExpression with Assignment

* Fix for ArrowFunction with AssignmentPattern

* Update tests

* Modify to support generally pattern

* Update tests

* Modify to use path.each instead of path.map

* Fix for multi arguments

* Fix typo, Argments => Arguments
2019-10-22 16:05:10 +03:00
Selvazhagan 10deb1f086 Angular: closing parenthesis on a new line after ternaries passed to pipes (#5902) 2019-10-21 12:38:21 +03:00
JounQin 9a0bdf71cb feat: add support for PartialApplication (#6397) 2019-10-17 16:45:24 +03:00
Georgii Dolzhykov 80260555c9 ts: fix optional computed methods (#6673) 2019-10-17 14:23:14 +03:00
Eric Sakmar 10bd71e478 fix(js): Object destructuring in method shorthand #6515 (#6646) 2019-10-16 10:46:20 +03:00
Sosuke Suzuki 3a998df02e
TSX: Fix incorrectly removing parentheses around jsx elements being accessed in tsx file (#6640)
* Modify to wrap jsx element used with member-expression in tsx

* Add tests

* Update CHANGELOG.unreleased.md

* Modify to support no-inline jsx element

* Add pr number

* Fix from lint-docs

* Modify to rename isTsx => isTSXFile

* Modify to no considering file ext

* Support JSXFragment and add tests

* Update CHANGELOG.unreleased.md
2019-10-16 00:11:48 +09:00
Georgii Dolzhykov 3a8ebae57d refactoring: unify code for printing methods, remove isNodeStar… (#6637)
* unify code for printing methods, remove isNodeStartingWithDeclare hacks

* body is BlockStatement, not an array

* getters and setters can't be async

* unify printPropertyKey calls
2019-10-14 17:39:36 +02:00
Georgii Dolzhykov 977b828666 Get rid of TSParenthesizedType nodes before proceeding with formatting (#6605)
* get rid of TSParenthesizedType nodes before proceeding with formatting

* fix parens for TSIndexedAccessType, TSFunctionType, TSConditionalType

fixes #6603

* workaround edge cases with one-item unions and intersections

* fix parens for TSInferType

* fix parens for rest elements in tuple types

* refactoring

* fix function types in conditional types

* move tests for rest and optional tuple elements

* fix comment issues

* tests for unions and intersections

* add parens around multiline unions in tuple

* move the parens check for TS nodes closer to the one for Flow nodes

* update CHANGELOG.unreleased.md

* remove dead code

* fix parens for TSConstructorType

* better wording in CHANGELOG.unreleased.md
2019-10-14 15:00:21 +03:00
Georgii Dolzhykov f8a4a61a62 fix typos (#6642) 2019-10-13 21:51:58 +02:00
Ingvar Stepanyan 282d1017f3 Add support for V8 intrinsics via Babel (#6496)
This plugin was recently added on Babel side and allows to parse custom syntax for V8 intrinsics.

They don't clash with any real-world JavaScript syntax, so adding this option should be as safe as any other plugin, and would allow to format JavaScript that uses such intrinsics (e.g. code inside Node.js or V8 itself).
2019-10-09 07:29:37 -07:00
Martin Donath 385c2dcc4f [typescript, flow]: double indent for unions inside of tuples (#6381) 2019-10-08 17:37:40 +03:00
Sosuke Suzuki 32dd447271 Refactor: Move functions unrelated to printing from printer-estree.js to utils.js (#6562) 2019-10-03 17:45:03 +03:00
Brian Kim 38ae5d5210 Javascript: Use function literals in arguments to detect function composition (#6033) 2019-10-01 13:53:45 +03:00
Matthew Leffler bb037eb218 TypeScript: Improve argument expansion with `as` type expressions (#6471) 2019-09-25 09:51:50 -03:00
Sosuke Suzuki 27e777e476 TypeScript: Keep type parameters inline for a variable declaration (#6467)
* Modify to keep inline type parameter with variable declaration

* Update CHENGELOG.unreleased.md

* Add tests

* Add tests

* Add pr number and link
2019-09-24 18:59:54 +03:00
Sosuke Suzuki 2e2368f5d7 JavaScript: Fix inconsistent indentation in switch statement (#6514)
* Add "SwitchStatement" to isInsideParenthesis

* Change tests

* Add tests

* Update CHANGELOG.unreleased.md

* Add pr number and link
2019-09-23 18:35:06 +02:00
Sosuke Suzuki 3f89bba231 JavaScript: Fix formatting on long named exports (#6446)
* Modify to put specific export inline

* Add tests

* Fix tests

* Modify to support default exports

* Update CHANGELOG.unreleased.md

* Modify to refactor

* Add pr link

* Modify to rename "content" -> "printed"

* Modify to define canBreak helpter

* Fix from linter

* Update CHANGELOG.unreleased.md

* Add tests
2019-09-11 12:10:34 +03:00
Sosuke Suzuki 8f0fdba4ba JavaScript: Fix ugly formatting parens wrap binary expressions… (#6441)
* Modify to break specific call expression correctly

* Add tests

* Update CHANGELOG.unreleased.md

* Add tests

* Fix tests

* Add pr link
2019-09-07 14:46:00 +02:00
Kevin Gibbons fd6ad2a623 handle empty object param patterns with type annotations (#6438)
* handle object patterns in function parameters with type annotations

* fix lint

* update changelog
2019-09-05 21:56:30 +02:00
Sosuke Suzuki 2523a017aa JavaScript: object destructuring with parameter decorators (#6411) 2019-08-30 07:07:00 +02:00
Sosuke Suzuki 77e79bbfa5 TypeScript: Fixed to break line and add a semi in one execution on one line long mapped types (#6420) 2019-08-29 20:14:45 +02:00
Sosuke Suzuki 9e5a5435a1 fix(TypeScript): specific union type breaks after opening parenthesis, but not before closing (#6307) 2019-08-08 16:48:37 +03:00
Sosuke Suzuki ce366f0834 fix(JavaScript): bug when arrow fn as function parameter with newline (#6301) 2019-08-08 16:06:28 +03:00
Sosuke Suzuki 033002cdc3 TypeScript, Flow: Fix breaking ordering comments in React.useEffect (#6270) 2019-07-10 11:34:23 -03:00
Sosuke Suzuki 74f4d2b3c0 JavaScript: Keep line breaks when tagged template literal has a single line comment. (#6236) 2019-07-10 10:56:53 -03:00
Sosuke Suzuki cfba21f493 JavaScript: Keep unary expressions parentheses with comments (#6217) 2019-07-10 10:06:08 -03:00
Lucas Duailibe 8fcc7c18b3
Printing arguments: short circuiting some cases (#6229) 2019-06-17 06:14:16 -03:00
Lucas Duailibe 4e8f911a29
Print comment following a JSX generic (#6209) 2019-06-10 09:30:54 -03:00
Lucas Duailibe a90adf4753
Fix adding trailing comma in TS tuples (#6199) 2019-06-07 11:18:42 -03:00
Sosuke Suzuki 8812792e93 [TypeScript] Add trailing comma for only arrow functions in tsx. (#6190)
* Modify to add traling comma only for allow-function

* Add tests

* Update CHANGELOG.unreleased.md

* Add pr number and link

* Modify to improve RegExp to detect tsx file
2019-06-07 09:01:58 -03:00
Lucas Duailibe 2e6191fe77
Prevent adding quotes if there's a numeric literal as key (#6138) 2019-06-04 13:45:29 -03:00
Julian Rosse 64ab703d41 Pass options to willPrintOwnComments() (#6081) 2019-06-04 12:48:51 -03:00
Sosuke Suzuki ed2055b81f [TypeScript]Keep a trailing comma on tuple types (#6172) 2019-06-03 09:59:34 -03:00
Sosuke Suzuki 3654108ebe TypeScript: Keep line breaks within mapped types. (#6146) 2019-05-24 19:00:32 -03:00
Lucas Duailibe 7e47b4ea26
Preserve parens around expressions in default export declaration that start with function or class (#6133) 2019-05-20 09:31:38 -03:00
Lucas Duailibe eca23e111f
Stop converting empty JSX elements to self-closing elements (#6127)
Co-Authored-By: Simon Lydell <simon.lydell@gmail.com>
2019-05-16 15:14:35 -03:00
Evilebot Tnawi 2cebeecb4f fix(javascript): do not hug sequence expression in object properties (#6088) 2019-05-15 12:29:45 -03:00
Lucas Duailibe 012b7a653e
Prevent adding unnecessary quotes when a computed key exists (#6119) 2019-05-14 19:41:49 -03:00
Brian Kim 48d542ec1e TypeScript: Don’t breakup call expressions when the last argument is an arrow function with a simple return type (#6106) 2019-05-14 10:57:42 -03:00
Sosuke Suzuki e3b2f4adb4 Keep a trailing comma in type parameter in .tsx files (#6115) 2019-05-13 14:53:45 -03:00
jwbay 6cee80b5b5 Don't break simple template literals (#5979)
A simple template literal is initially defined as a literal wherein all the expressions are identifiers or member access expressions where all parts are identifiers. We print these expressions into strings with infinite print width before printing the template.
2019-05-08 13:14:55 -03:00
Evilebot Tnawi dcaed91518 fix: respect newlines in parameters (#5836) 2019-04-04 09:50:07 -03:00
Noah Sugarman 0b07e10833 fix multiline dynamic import comments (#6025) 2019-04-02 12:35:03 -07:00
Lucas Azzola f526c47b1e
Add an option to modify when Prettier quotes object properties (#5934)
* Implement quote-props=preserve

* Implement quote-props=consistent

* Add tests

* Enable quoteProps in playground

* Add documentation

* Cache objectHasStringProp calculations

* Fixup changelog
2019-03-06 20:33:08 +11:00
Yang Su 71b815f583 JavaScript: Fix parens logic for optional chaining expressions and closure type casts (#5843) 2019-02-11 13:33:56 -02:00
James Henry 1143619600
chore: update typescript-estree to new package name (#5799) 2019-01-28 19:46:51 -05:00