Commit Graph
220 Commits
Author SHA1 Message Date
e3d1f0dee0 CLI: Add --ignore-unknown (#8829)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2020-08-21 09:11:59 +08:00
fisker Cheung dc46155962 Revert #7367 "Fix: remove unnecessary parens when yielding jsx" (#9011) 2020-08-21 09:09:45 +08:00
Sosuke Suzuki e3f075b3e7 Revert #7889 (#8861)
* Revert #7889

* Remove changelog

* Run prettier
2020-08-20 00:00:27 +09:00
fisker Cheung 7c318cc677 Support .prettierrc.json5 config file (#8957) 2020-08-15 21:16:49 +08:00
fisker Cheung 6833310f87 Fix wrong range format on files with BOM (#8936) 2020-08-10 22:18:55 +08:00
dependabot[bot]andfisker 07fbf265fa Build(deps): Bump cosmiconfig from 6.0.0 to 7.0.0 (#8890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-08-10 21:59:41 +08:00
fisker Cheung a340799a3d CLI: Don't suggest -_ for unknown flags (#8934) 2020-08-10 21:57:54 +08:00
fisker Cheung 797e93fc0a Support Decimal Proposal (#8901) 2020-08-05 11:04:30 +08:00
fisker Cheung 967bc6f502 Support babel TSNamedTupleMember (#8885) 2020-08-04 12:17:53 +08:00
dependabot[bot]andfisker 0509833f0a Build(deps): Bump yaml-unist-parser from 1.2.1 to 1.3.0 (#8888)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-08-03 21:20:03 +08:00
fisker Cheung 170033f3f8 Update @typescript-eslint/typescript-estree to v3.7.1 (#8805) 2020-08-02 07:03:20 +08:00
Wenfang 5da1ee8b07 fix(vue): named slots shorthand value is not formatted (#8839) 2020-07-28 07:05:48 +09:00
fisker Cheung 466d4638b4 CLI: Add -w alias for --write option (#8833) 2020-07-27 10:10:01 +08:00
fisker Cheung d725261fc5 MDX: fix unstable format when embedded off (#8825) 2020-07-25 02:06:22 +08:00
fisker Cheung 86b8395ed7 Fix cli --file-info bug (part 2) (#8830) 2020-07-24 23:31:59 +08:00
Cyrille ed9d399a47 handlebars: Do not format html element attributes but class (#8677) 2020-07-24 00:40:35 +08:00
George Zahariev bd8992d53b When default exporting a Flow Enum, do not append semicolon (#8768)
* When default exporting a Flow Enum, do not append semicolon

* Add changelog entry for #8768
2020-07-16 21:50:31 +09: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 f2b0aec555 Vue: Fix parenthesized interpolation format (#8747) 2020-07-15 12:16:16 +08:00
fisker CheungandGeorgii Dolzhykov c0abefb662 SCSS: Fix Comments at the end of the file were lost if the final semicolon was omitted (#8675)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-07-14 23:36:40 +08:00
fisker Cheung 26740d54a5 Recognize known html tags (#8621) 2020-07-14 22:02:32 +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
fisker CheungandGeorgii Dolzhykov b01591770a HTML: Don't preserve line breaks around text-only content (#8614)
* Fix inconsistent formatting on Vue interpolation

* Fix text

* Update changelog

* Fix snapshot

* Add an explanation to the changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-07-06 09:18:22 +03:00
1d6d60ee37 Fix: at rule supports selector (#8545)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Boyen Vaesen <boyen.vaesen@kbc.be>
2020-07-03 09:24:27 +08:00
dependabot[bot]andfisker 1a4eb6c89a Build(deps): Bump angular-html-parser from 1.7.0 to 1.7.1 (#8643)
* Build(deps): Bump angular-html-parser from 1.7.0 to 1.7.1

Bumps [angular-html-parser](https://github.com/ikatyang/angular-html-parser) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/ikatyang/angular-html-parser/releases)
- [Changelog](https://github.com/ikatyang/angular-html-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ikatyang/angular-html-parser/compare/v1.7.0...v1.7.1)

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

* Add test for issue 8626

* Rename pr-8626.md to pr-8643.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-07-01 13:30:15 +03:00
554b15473d Document recommended setup and improve docs overall (#8510)
Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-06-28 09:47:29 +08:00
fisker Cheung 9e8df9d922 Fix resolve EditorConfig for files in deep directory (#8591)
* Fix resolve editorConfig for files in deep directory

* Add  changelog,  remove `find-project-root`

* Simplify

* Use `existsSync` instead of `readdirSync`
2020-06-24 23:58:02 +03:00
Michał Staśkiewicz aa1088fbd7 Handlebars: Fix incorrect classic component syntax formatting (#8593)
* Test: Add test addressing #8584

* Fix: Resolves problem with incorrect component formatting (#8584)

* Docs: Add changelog note

* Test: Add test for yield formatting case

* Fix: Fix handlebars yield opening tag break

* Test: Add case for any helper with params

* Fix: Fix opening tag for every helper with params

* Chore: Revert whitespaces

* Chore: Revert whitespaces in tests
2020-06-24 23:55:59 +03:00
Cyrille David bff049fd96 handlebars: Support escaping a mustache with a backslash (#8634)
* Add a failing test

* Support escaping a mustache with `\`

It is documented in handlebarjs documentation here:
https://handlebarsjs.com/guide/expressions.html#escaping-handlebars-expressions

* Preprocess TextNode to adjust the need of backslashes

Given that template:
```hbs
a non-escaped mustache: \\\{{helper}}
```

Glimmer parser will produce two body nodes:
- a TextNode where `node.chars === "a non-escaped mustache: \\\\"`
- a MustacheStatement for `{{helper}}`

In order to correctly print the input, we need to adjust the TextNode to
`node.chars === "a non-escaped mustache: \\\\\\"`, namely we have to add
a backslash that is removed by Glimmer parser. This is this commit
purpose.

* Add changelog note
2020-06-24 23:55:02 +03:00
fisker Cheung 63a37a2a1d Treat <option> and <optgroup> as block (#8620) 2020-06-24 18:33:13 +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
fisker Cheung b9ea67f32a Fix: resolving to incorrect config in getFileInfo() (#8585) 2020-06-19 22:28:27 +08:00
fisker Cheung a4e5f2053d Fix cli --file-info bug (#8586)
* Fix cli `--file-info` bug

* Add changelog

* Update pr-8586.md
2020-06-18 18:18:19 +03: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
Boyen Vaesen 4009ecf70d Fix: Prettier breaks code when inline number lists are used as arbitrary arguments [SCSS] (#8566) 2020-06-18 12:12:31 +03:00
fisker Cheung 8999cc7811 Format Vue SFC root blocks (#8465) 2020-06-17 19:18:29 +08:00
fisker Cheung fbf0beb716 Fix inferredParser when calling getFileInfo() with resolveConfig: true (#8551) 2020-06-17 18:47:56 +08:00
Boyen VaesenandBoyen Vaesen aefc9a48e5 Fix: [Sass] Unexpectedly add extra space after function when passing arbitrary arguments (#8567)
Co-authored-by: Boyen Vaesen <boyen.vaesen@kbc.be>
2020-06-17 09:26:28 +08: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
Mellina Yonashiro ad855e4e03 Fix: don't wrap arrays in test.each template strings (#8354) 2020-06-15 00:09:23 +03:00
boyennandBoyen Vaesen ff865794a6 Fix: Incorrect whitespace added after escaped colon in css line name (#8535)
* {fix}: Incorrect whitespace added after escaped colon in css grid line name

* {chore}: update changelog

* {fix}: add check for prevNode to be defined

Co-authored-by: Boyen Vaesen <boyen.vaesen@kbc.be>
2020-06-10 14:05:21 +03:00
fisker Cheung 3e44061f84 SCSS: Fix broken comments between declaration prop and value (#8366) 2020-06-09 18:41:16 +03:00
boyennandBoyen Vaesen f051170f98 fix: Update scss comment indentation (#7844)
Co-authored-by: Boyen Vaesen <boyen.vaesen@kbc.be>
2020-06-09 14:55:24 +08:00
さっちゃん 0f8cc01aa5 Correctly format CJK sentences with Variation Selector. (#8511)
* Correctly format CJK sentences with IVS.

* Changelog pr-8511

* Changelog title should contain the title

* GitHub user name can contain `-`.

https://github.com/prettier/prettier/pull/8511#issuecomment-640231668
2020-06-08 10:01:31 +03: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
Sosuke Suzuki 85f0b0cc79 Fix Stage-1 => Stage-2 (#8487) 2020-06-03 19:22:11 +09:00
fisker Cheung 2b68f981fd Babel: support record and tuple syntax (#8453) 2020-06-03 09:35:13 +08:00