Commit Graph
55 Commits
Author SHA1 Message Date
fisker CheungandChris Brody 73e3976c34 Add espree parser (#9000)
Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
2020-10-13 09:14:02 +08:00
Sosuke Suzuki bba196abc8 Improve formatting for AssignmentExpression with ClassExpression that has long superClass (#9341)
* Improve formatting for AssignmentExpression with ClassExpression that has long superClass

Fix by prettier

* Add changelog

* Remove unnecesary concat call

* Mention abount Google Closure Library in changelog
2020-10-08 20:11:15 +09:00
Sosuke Suzuki bb238f5765 Fix placing leading comments for a body of while statement (#9345)
* Add leading comments for while

* Add tests

* Add changelog
2020-10-08 17:08:40 +09:00
fisker CheungandGeorgii Dolzhykov 64cb7abed8 JS: Fix comments inside template (#9278)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-10-05 05:49:52 +08:00
fisker Cheung 203be9da5a Change test package name (#8848) 2020-09-18 14:05:29 +08: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
fisker Cheung 4de63cfc4f Test: add test for issue 5961 (#9153) 2020-09-07 17:59:50 +03:00
fisker Cheung 370844cc4c Run full test on every parser (#9070)
* Refactor test

* Fix

* Improve `hasPragma` & `insertPragma` on files has BOM

* Fix `coreFormat` cursorOffset

* Code style

* Update snapshots

* Refactor

* Restore BOM test

* Add export

* Empty file

* return after SyntaxError

* EOL test

* Fix eol tests

* Named export

* Tweak matrix

* Disable on `requirePragma`

* Disable `cr` test

* Simplify logic

* Update `verbose`

* Remove `test:full-test`

* Typo
2020-09-04 23:43:41 +08:00
dependabot[bot]andfisker 6c05c75e06 Build(deps): Bump flow-parser from 0.132.0 to 0.133.0 (#9135)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-09-04 16:00:08 +08:00
Sosuke Suzuki 2c0e9838f2 Fix line breaks for CSS in JS (#9136)
* Fix 2.1 regression for css-in-js

* Add changelog
2020-09-04 13:12:58 +09:00
dependabot[bot]andfisker 0983660aa8 Build(deps): Bump @babel/parser from 7.11.2 to 7.11.5 (#8947)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-09-01 19:26:19 +08:00
Sosuke Suzuki cc63358c90 Respect spacing between template values in embedded css (#9078)
* Respect no space for embedded css

* Fix by lint

* Add changelog
2020-08-28 11:08:29 +09:00
Sosuke Suzuki c4e9dd9c36 Continuation of revert 7889 (#9024)
* Continuation of revert 7889

* Remove isLiteralLikeValue

* Revert callHasComplexArguments

* Revert usage of shouldMerge
2020-08-23 01:23:41 +09:00
fisker Cheung 08e8b40ac6 Move non-js syntax test out of tests/js/ dir (#9023) 2020-08-22 14:50:54 +08:00
fisker Cheung 95ba0aeb79 Update javascript tests to avoid syntax errors (#9019) 2020-08-22 01:00:14 +08:00
Sosuke SuzukiandChristopher 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
fisker Cheung 1d2ff824cc Improve requirePragma on files with BOM (#9003) 2020-08-21 10:30:42 +08:00
fisker Cheung d31ebf4619 Test: Improve coverage (#8811) 2020-08-21 09:43:24 +08:00
fisker Cheung dc46155962 Revert #7367 "Fix: remove unnecessary parens when yielding jsx" (#9011) 2020-08-21 09:09:45 +08:00
fisker Cheung 2ff156136f Improve internal cursorOffset calculate (#9013) 2020-08-21 09:09:15 +08:00
Sosuke Suzuki e3f075b3e7 Revert #7889 (#8861)
* Revert #7889

* Remove changelog

* Run prettier
2020-08-20 00:00:27 +09:00
fisker Cheung 6833310f87 Fix wrong range format on files with BOM (#8936) 2020-08-10 22:18:55 +08:00
fisker Cheung 0a2ec1b4a2 Fix range tests with TEST_CRLF and endOfLine option (#8821) 2020-08-08 16:45:44 +08:00
dependabot[bot]andfisker 74b5f65565 Build(deps): Bump @babel/parser from 7.11.1 to 7.11.2 (#8922)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-08-06 20:19:11 +08:00
dependabot[bot]andfisker 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
fisker Cheung 797e93fc0a Support Decimal Proposal (#8901) 2020-08-05 11:04:30 +08:00
dependabot[bot]andfisker 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 CheungandGeorgii Dolzhykov 07e5b06a1f Fix unstable pair of comments between class methods (#8731)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-07-15 12:16:49 +08:00
fisker Cheung 639e7fc869 Fix duplicated comments (#8742)
* Add failed test

* Fix issue

* more tests

* Restore verify parser

* Add changelog

* Update snapshots
2020-07-14 15:06:57 +03:00
Sosuke Suzuki 85a81e47b7 Add more tests for logical assignment operator (#8692)
* Add more tests for logical assignment operator

* Make tests shorter
2020-07-03 01:24:24 +09:00
dependabot[bot]andfisker 35ac6f0752 Build(deps): Bump @babel/parser from 7.10.3 to 7.10.4 (#8688)
* Build(deps): Bump @babel/parser from 7.10.3 to 7.10.4

Bumps [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) from 7.10.3 to 7.10.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.4/packages/babel-parser)

Signed-off-by: dependabot[bot] <support@github.com>

* Add `delete obj?.#x.a` test

* Add new `tuple` and `record` tests. Fix old test

* Fix test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-07-02 08:02:36 +08:00
b27f84438d Update remark parse v8 (#8140)
* Update `remark-parse` to v7

* fix `link` title and  `inlineCode`

* fix `code` meta

* fix code meta

* fix ListItem print

* fix heading print result

* remove blank line before childList

* trim `inlineCode` ast

* use List.spread

* use ListItem.spread

* fix `example-550.md` snap

* update `example-522.md` snap

* update `example-508.md` snap

* update `example-509.md` snap

* update `example-222.md` snap

* Update listitem print

* lower case definition.label to match ast

* trim definition.label to match ast

* trim definition.label to match ast

* unescape Link.title

* filter link with no title

* fix link title

* fix link title

* restore preprocess

* fix ast massage

* Restore list

* Update to remark-parse 8.0.2

* Update snapshot tests after rebase

* Create legacy `loose` attribute from `spread`

Uses @duailibe's suggestion from here:
https://github.com/prettier/prettier/issues/6180#issuecomment-499498432

Also backtracks some other unnecessary changes.

* Update test case for shortcut reference-style links

The commonmark spec does not allow for whitespace between the left and right
parts of a full reference-style link.

https://spec.commonmark.org/dingus/?text=%5Bfoo%5D%20%5Bbar%5D%0A%0A%5Bbar%5D%3A%20%2Furl%20%22title%22%0A

Notice that the `[foo]` is parsed as plain text, while the `[bar]` is parsed
as a shortcut reference link.

When there is a space between the two, each part is parsed as a separate
shortcut style reference link node:

https://astexplorer.net/#/gist/d69f5a227e2cbde3f43f0a639bee165c/822b531c252c162faba78e38607db73ef72886d5

Previously they would have been parsed as a single full reference link.

Here I update the test-case to account for the shortcut style links.

* Add remark-footnotes plugin to replace legacy footnotes option

Remark removed the footnotes option in favor of a new remark-footnotes
plugin in https://github.com/remarkjs/remark/pull/483

Here I've simply switched to use the plugin instead of the removed
option and updated the snapshot tests.

* Add test case for #4369

* Do not add gap if has leading space

* Restore `inlineCode` ast compare

* Restore `isPrevNodeLooseListItem`

* Ignore some ast property

* Restore blank line, Fix `isPrevNodeLooseListItem` check

* Title compare

* Ignore `loose`

* Fix footnoteDefinition

* Fix tabWidth

* Style

* `footnoteDefinition` is stable now

* Fix `_` after link

* Revert workaround, url tests

* Fix idempotence issue with underscores and autolinks

* Fix idempotence issue with underscores and autolinks - attempt # 2

* Fix idempotence issue with underscores and autolinks - attempt # 3

* Fix idempotence issue with underscores and autolinks - part # 4

* More tests

* Code style

* Only test master passed tests

* Update list

* Update list

* Use code as test name

* Fix idempotence issue with underscores and autolinks - part # 5

* Fix idempotence issue with underscores and autolinks - part # 6

* Linting fix

* More autolink tests

* Fix tests

* Rename to `auto-link`

* More tests

* Disable new cases

* tests for issue 4122

* add changelog

Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-06-23 13:52:50 +03: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
Simon Lydell 9184743081 Quote and unquote number keys (#8508)
* Quote and unquote number keys

* Add changelog entry

* Add tests for escapes

* Fix idempotency

* Only run flow-repo/ tests with flow

271 jsfmt.spec.js in flow-repo use only the flow parser.
18 use flow and babel.
Now, all of them use only flow.

* Don’t unquote negative numbers

* Don’t quote/unquote numbers in TypeScript

* Quote BigInt

* Fix AST check

* Fix condition

* Fix BigInt to string

* Fix ESLint not recognizing BigInt

* Only quote/unquote “simple” numbers

* No need to clean BigIntLiteral anymore

* Add tests for 1. and .1

* Fix 1. and .1

* Remove unnecessary babel-ts from tests

* Only unquote numbers for babel

* Update changelog
2020-06-18 18:13:25 +03:00
Mellina Yonashiro ad855e4e03 Fix: don't wrap arrays in test.each template strings (#8354) 2020-06-15 00:09:23 +03:00
fisker Cheung 34d847c1cc Remove extra line after directive with comment (#8536) 2020-06-11 08:45:44 +08:00
Georgii Dolzhykov 3094ad5aa2 Fix unstable comments in binary expressions (#8491) 2020-06-05 09:55:22 +03:00
Georgii Dolzhykov 1df6838b0e Revert #7787 (#8495) 2020-06-04 14:38:51 +03:00
Sosuke SuzukiandGeorgii Dolzhykov 9c67e7b7f1 JavaScript: Fix indentation for binary expressions with trailing comments (#8476)
* Modify to align binaryish expression with trailing comment

* Add tests

* Add comment

* Add test

* Add changelog

* Fix by lint

* Modify to move transformation to printBinaryishExpressions

* Remove unnecessary new line

* Fix hasTrailingCommentInBinaryish

* Add shouldReturnParts option to printComments

* Add tests from review

* Fix by lint

* Extract and use normalizeParts

* Group CallExpression when parent node is binaryish

* Fix by lint

* Remove unnecessary change

* Wrap the doc of most left node with group

* Add tests

* Update pr-8476.md

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-06-04 08:59:05 +03:00
7659a867ad Added chained "pipe" function formatting tests (#6818)
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
Co-authored-by: fisker <lionkay@gmail.com>
2020-06-03 20:31:22 +08:00
fisker Cheung 2b68f981fd Babel: support record and tuple syntax (#8453) 2020-06-03 09:35:13 +08:00
fisker Cheung 7d2e57c67f Babel: support moduleAttributes (#8436) 2020-06-02 20:31:33 +08:00
Michael Mattiacci ffceb60e92 CSS: Fix url() unquoted content manipulation (#2835) (#7592) 2020-05-29 16:09:15 +03: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 e143e58545 JS: clean up babel plugins (#8435) 2020-05-29 09:26:52 +08:00
Sosuke Suzuki f31430d7be JavaScript: Support Babel 7.10 private field in in (#8431)
* Support Babel 7.10 private in

* Add changelog

* Fix changelog
2020-05-28 03:02:10 +09:00
fisker Cheung 12d379d29d Test: visualize the range (#8420) 2020-05-28 01:16:52 +08:00
Georgii Dolzhykov cf5d899d44 fix(typescript): remove now-unneeded workaround for directives (#8422)
* fix(typescript): remove unneeded workaround for directives

* Add changelog entry
2020-05-27 17:55:59 +03:00
Georgii Dolzhykov 81d7e06973 Fix range indentation (#8410) 2020-05-27 11:48:32 +03:00
fisker Cheung 408bbd4cbb Fix empty files with shebang (#8414) 2020-05-26 16:58:00 +03:00