Sosuke Suzuki
c7a3c16f7d
Improve visual separation between header and body in classes with multiline headers ( #10085 )
...
* Add hardline for a class whose extends part is broken
refactor
Use groupId
Remove isPreviousLineEmpty
* Avoid leading comments
* Rename to heritage
* Add heuristic for implements
* Fix lint problems
* Fix
Fix
Fix
* Extract getGroupId patterns
* Adopots solution 2
* Fix
* Fix lint problem
* Add changelog
* Address reviews
* Update tests
* Rename to createGroupIdMapper
* Split files
* Add tests for complex extends
* Fix changelog
2021-01-20 15:01:16 +09:00
fisker Cheung
099ba04327
TypeScript: Fix missing comments in MethodDefinition ( #9872 )
2020-12-15 12:22:56 +08:00
dependabot[bot] and fisker
82603f2609
Build(deps): Bump @babel/parser from 7.12.5 to 7.12.7 ( #9748 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com >
2020-11-24 14:24:30 +08:00
Sosuke Suzuki and fisker Cheung
4cc149248a
Support TypeScript 4.1 via typescript-estree ( #9636 )
...
* Update typescript and typescript-estree
* Add AST transformation for TSTemplateLiteralType
* Update tests for template-literal-types
* Fix transformChainExpression
* Update tests for key-remapping-in-mapped-types
* Implement recoverInvalidDecorators
* Update changelog
* Avoid typecheck error
* Add os.platform() shim
* Update config.js
* Update config.js
* Shim os.cpus
* Update `process.versions.node`
* Attempt to fix build
* Update ts parserOptions
* Fix code style
* Remove `errorOnUnknownASTType`, fix code style
* Use `[] ||` instead of `[] //`
* Fix hack
* Add invalid tests
* checkMissingDecorators
* Update tests
* Fix tests
* Add comment
* Revert "Implement recoverInvalidDecorators"
This reverts commit 27e7b46ed41df36fb585791117c85e1b2dab932c.
* Add ref pr link
* Simplify logic
* Don't transform `TSTemplateLiteralType`
* Add `TSTemplateLiteralType` as simple type
* Fix tests
* Update comments
* Add comment
* Fix logic
* Minor tweak
* use multiple parsers
* Update @typescript-eslint/typescript-estree to v4.8.0
* Switch to `parseWithNodeMaps`
* Rename `esNode` -> `esTreeNode`
* Update @typescript-eslint/typescript-estree to 4.8.1-alpha.1
* Use @typescript-eslint/typescript-estree 4.8.1
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2020-11-18 10:59:58 +09:00
fisker Cheung and Georgii Dolzhykov
2a9d0f66d5
Typescript: Fix prettier-ignored mapped types ( #9551 )
...
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2020-11-13 09:06:02 +08:00
c91914e610
Build(deps): Bump @babel/parser from 7.12.3 to 7.12.5 ( #9597 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com >
Co-authored-by: fisker <lionkay@gmail.com >
2020-11-06 19:30:42 +08:00
fisker Cheung
7836466d67
Test: snapshot parse errors ( #9467 )
2020-11-06 15:27:04 +08:00
fisker Cheung
3f4c8c1df0
Treat more types as simple type ( #9543 )
2020-10-31 21:15:35 +08:00
fisker Cheung
d2ce7d44d5
Refactor: Improve readability ( #9539 )
2020-10-30 16:52:17 +08:00
fisker Cheung
eabceb2dcb
Consistent type print ( #9521 )
2020-10-30 09:56:47 +08:00
Sosuke Suzuki
56e9602a28
Support TypeScript 4.1 via Babel ( #9473 )
...
* Support Key Remapping In Mapped Types
* Fix by Prettier
* Add changelog
* Fix jsfmt.spec.js
* Update cspell.json
2020-10-22 21:12:24 +09:00
Sosuke Suzuki
3b7a7ba3c9
Update @babel/parser to 7.12 ( #9408 )
...
* Install babel/parser 7.12
* Add tests for babel/babel#12161
* Add test for babel/babel#12076
* Add test for babel/babel#12085
* Add test for babel/babel#12108
* Add test for babel/babel#12120
* Add test for babel/babel#12054
* Add test for babel/babel#12061
* Add test babel/babel#12093
* Add test for babel/babel#12065
* Add test for babel/babel#12111
* Add test for babel/babel#12072
* Switch syntax-module-attributes to syntax-import-assertion
* Support "String import/export specifier"
* Remove tests for module-attributes
* Add changelog
* Update to 7.12.3
* Fix by linter
* Fix by spellchecker
* Add tests for module attributes to errors
* Add error test for module string name with import
* Remove TSTypeCastExpression
* Add tests for funny import-assertions
* Update snapshots|
* Add more tests
2020-10-20 19:01:30 +09:00
fisker Cheung
1005954c75
Test: use errors options instead of disableBabelTS ( #9387 )
2020-10-13 17:16:40 +08:00
Sosuke Suzuki
e1eecfd7eb
TypeScript: Preserve a last separator for ignored object and interface types ( #9318 )
...
* Preserve ignored TypeScript signature
* Add Changelog
2020-10-06 15:09:22 +09:00
fisker Cheung
94ef5f5683
Test: Fix indexes calculation ( #9152 )
...
* Test: Fix indexes calculation
* Simplify logic
* Update snapshots
2020-09-17 07:31:29 +08:00
golergka
7131347cde
Typescript tagged template literal test ( #9195 )
2020-09-14 14:20:24 +03:00
Chris Brody
77c8da7691
test(TypeScript): test ...infer type with parens ( #9056 )
2020-08-26 09:02:58 +08:00
fisker Cheung
9a9dcbe12b
Fix broken format for ...infer T ( #9044 )
2020-08-25 12:36:54 +03:00
fisker Cheung
08e8b40ac6
Move non-js syntax test out of tests/js/ dir ( #9023 )
2020-08-22 14:50:54 +08:00
Sosuke Suzuki and Christopher J. Brody
751f67af1f
Upgrade to TypeScript 4.0 ( #8982 )
...
* Upgrade to TypeScript 4.0
* Update tests
* Fix changelog
* Revert invalid label tests
* Set loggerFn to false
* Use TS 4.0
* Apply logical assginment test for TypeScript
* Remove hack for NamedTupleMember
* workaround for TypeScript 4.0 in src/language-js/utils.js
Co-authored-by: Christopher J. Brody <chris.brody+brodybits@gmail.com >
2020-08-21 16:09:28 +09:00
Sosuke Suzuki and fisker Cheung
6dbef8681e
Fix interface extends with long type parameters ( #8981 )
...
* Try the same way as #8967
* Update src/language-js/printer-estree.js
Co-authored-by: fisker Cheung <lionkay@gmail.com >
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2020-08-19 23:51:49 +09:00
Sosuke Suzuki
36c35be210
Fix class implements with long type parameters ( #8967 )
...
* Fix class implements
* Extract extendsParts and indent
* Refactor
* Refactor
* Fix by Prettier
* Refactor
* Refactor getTypeParametersGroupId with WeakMap
2020-08-19 20:21:52 +09:00
dependabot[bot] and fisker
e2e0ddf08c
Build(deps): Bump @babel/parser from 7.11.0 to 7.11.1 ( #8914 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com >
2020-08-06 10:40:49 +08:00
dependabot[bot] and fisker
8f58bffecf
Build(deps): Bump @babel/parser from 7.10.5 to 7.11.0 ( #8869 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com >
2020-08-03 21:13:19 +08:00
fisker Cheung
170033f3f8
Update @typescript-eslint/typescript-estree to v3.7.1 ( #8805 )
2020-08-02 07:03:20 +08:00
Sosuke Suzuki
02137069a7
JavaScript: Break ternary expressions containing a multi-line block comment ( #8592 )
...
* Break ternary expression when there is multiline block comment
* Add changelog
2020-06-21 17:02:58 +09:00
Sosuke Suzuki
29959103a9
TypeScript: Prefer leading comment when there is a comment on after "?" in conditional types ( #8557 )
...
* Fix #8555
* Add changelog
2020-06-15 20:08:43 +09:00
fisker Cheung
db05f0f36f
Add tests for issue 6678 ( #8513 )
2020-06-08 16:17:04 +03:00
Sosuke Suzuki
3fc75799ee
TypeScript: Support a TS 3.9 breaking change for Optional Chaining and Non-Null Assertions ( #8450 )
...
* Suuport improvement optional chaining ergonomics
* Add changelog
* Fix reviewed points
2020-05-31 09:17:39 +09:00
Georgii Dolzhykov
5a0e33cc84
fix(range): improve detection of JS source elements ( #8419 )
...
* fix(range): improve detection of JS source elements
* Add changelog entry
* Remove unneeded comment
* Add more types and update snapshots
2020-05-29 07:29:09 +03:00
fisker Cheung
12d379d29d
Test: visualize the range ( #8420 )
2020-05-28 01:16:52 +08:00
Georgii Dolzhykov
81d7e06973
Fix range indentation ( #8410 )
2020-05-27 11:48:32 +03:00
Georgii Dolzhykov
d420202df4
fix(js): comments after superclass ( #8312 )
...
* Fix comments after superclass
* add changelog
* refactor
* Organize tests
* Use addBlockStatementFirstComment
* Amend unstableTests list
* Avoid identical comments in tests
* Add tests for `implements`
* Handle comments in interfaces
* Remove an always-false condition
* Almost a fix
* Further fixes
* Add DeclareClass
* Add DeclareInterface, mixins
* Fix extends in DeclareClass
* Fix DeclareClass
* Fix mixins
* Refactor: remove unused parameters
* Add marked dangling comments
* Unify printing of interface for TS and Flow
* Fix unstable interfaces
* Remove comment
* Restore the original behavior for interfaces with multiple inheritance
* Refactoring, tests
* Remove unused code
* Include a file accidentally omitted from the merge commit
* Remove unused type import
2020-05-24 21:53:29 +03:00
fisker Cheung
4b95c408ae
Add test for #6988 ( #8391 )
...
* Add test for #6988
* Move files
2020-05-24 17:27:25 +03:00
fisker Cheung
243a06f073
Test: correct file extensions ( #8362 )
2020-05-21 21:10:00 +08:00
fisker Cheung
2c8b419837
Test: Fix parsers ( #8278 )
2020-05-12 19:21:47 +08:00
Georgii Dolzhykov
746fee6fef
Add tests to close issues ( #8276 )
...
* add tests for #6899
* add tests for #6326
* add tests for #8154
2020-05-11 11:49:04 +03:00
fisker Cheung
ed3eeb82f8
Test: add parser check ( #8256 )
2020-05-08 10:56:09 +08:00
fisker Cheung
7ad515111e
Categorize tests part 4(CSS, flow, misc) ( #8251 )
2020-05-08 01:29:34 +08:00
fisker Cheung
b622578896
Categorize tests part 3 (js) ( #8249 )
...
* Categorize tests(js)
2020-05-08 00:55:46 +08:00
fisker Cheung
f8c5b1fd1d
Categorize tests part 2 ( #8248 )
...
* Categorize tests (yaml, markdown)
* Categorize tests (handlebars)
* Categorize tests (graphql)
* Categorize tests (typescript)
* Categorize tests (json)
* Categorize tests (jsx)
2020-05-07 23:54:44 +08:00
fisker Cheung and Georgii Dolzhykov
aa3141c24e
Wrap tests in describe ( #7934 )
...
* Run `format()` in test function
* Wrap `test`s in `describe`
* Update tests_config/run_spec.js
Co-Authored-By: Georgii Dolzhykov <thorn.mailbox@gmail.com >
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2020-04-10 19:12:01 +08:00
Georgii Dolzhykov
605e57dd3e
fix .prettierignore (jsfmt.spec.js files were ignored)
2020-03-27 23:40:45 +02:00
fisker Cheung
c82ce657e3
Run verify test on disabled babel-ts tests ( #7786 )
2020-03-18 15:35:13 +02:00
JounQin and Georgii Dolzhykov
c1937cb1b8
feat: add new parser babel-ts to parse TypeScript syntaxes via Babel ( #6400 )
...
* feat: add new parser `babel-ts` to parse TypeScript syntaxes via Babel
* docs: document parser babel-ts
* chore: enable babel-ts in markdown and worker.js
* verify all TS tests against babel-ts except disabled by disableBabelTS
* support for TSDeclareMethod; fix abstract properties and methods
* fix embedded angular templates and styles
* fix TSImportType
* simplify babel options combinations
* fix method decorators
* fix ranges
* work around loc inconsistencies for SequenceExpression
* don't print trailing comma in type parameters (unsupported in TS < 3.3)
* preserve quotes for class properties
* align printing of single-parameter functions
* fix comments in degenerate single-element unions and intersections
* fix comments for methods
* fix comments for mapped types
* edit docs, change 'since' to 2.0.0
* add changelog
* fix code sample on playground
* update snapshots after rebase
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2020-01-29 14:11:16 +02:00
Alexander Kachkaev
e00ce8c2c8
Change arrowParens to always by default for 2.0 ( #7430 )
2020-01-29 13:31:25 +02:00
b47f7bae43
RFC: Always add a space after the function keyword ( #3903 )
...
* Always add a space after the `function` keyword
* WIP update snapshots
* WIP put generator function asterisk before space
https://github.com/prettier/prettier/issues/3847#issuecomment-363449250
* WIP update snapshots
* Add changelog
* Add tests for anonymouse generator function
* print space between `function` and generator star
* update changelog
* print space between yield and *
Co-authored-by: Joseph Frazier <1212jtraceur@gmail.com >
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com >
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2020-01-20 16:26:47 +02:00
fisker Cheung
791996df7b
Set trailingComma default value to es5 ( #6963 )
...
* Set `trailingComma` default value to `es5`
* Update `options` documentation
* Update tests
* style
* fix js code style
* change options order
* update tests_integration snap
* disable es5 for __ng_interpolation
* fix angular tests
* fix scss test
* fix `css_trailing_comma` snap
* fix css_scss snapshot
2019-11-18 11:39:12 +01:00
Sosuke Suzuki
9b37dca0e9
TypeScript: Fix formatting of type operators as arrow function… ( #6901 )
2019-11-12 19:13:03 +01:00
Georgii Dolzhykov
ab598e6e23
tests: rename duplicate bindings to be ready for #6400 ( #6662 )
2019-10-15 18:27:39 +03:00