Commit Graph
58 Commits
Author SHA1 Message Date
fisker Cheung f0f18d3090 Enable unicorn/prefer-number-properties (#9935) 2020-12-21 17:09:20 +08:00
fisker Cheung 28d914b811 Vue: Consistent slot, support Vue3 (#9609) 2020-11-13 09:05:30 +08:00
fisker Cheung 5b6d1dfd91 Refactor: getParserName -> inferParserByLanguage (#9556) 2020-11-02 10:41:03 +08:00
fisker Cheungandprettifier[bot] ee57066cb4 HTML: Fix format on style[lang="sass"] (#9051)
Co-authored-by: prettifier[bot] <45367598+prettifier[bot]@users.noreply.github.com>
2020-08-26 00:26:03 +08:00
fisker Cheung 073dfd9fa2 Vue: fix format on blocks with src attribute (#9052) 2020-08-25 23:06:25 +08:00
fisker Cheung d31ebf4619 Test: Improve coverage (#8811) 2020-08-21 09:43:24 +08:00
fisker Cheung 26740d54a5 Recognize known html tags (#8621) 2020-07-14 22:02:32 +08: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
fisker Cheung cd2b8a32b5 Revert #7392 (#8645) 2020-06-30 20:00:33 +08:00
fisker Cheung 0c2b918078 ESLint: enable import/order (#8635) 2020-06-26 20:30:21 +08:00
fisker Cheung 8999cc7811 Format Vue SFC root blocks (#8465) 2020-06-17 19:18:29 +08: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
fisker Cheung 44bae94647 Support dynamic languages in front matter (#8381) 2020-05-26 16:18:39 +08:00
Sosuke Suzuki b44e702679 HTML: Support <script type="text/html"> (#8371)
* Support HTML Script

* Add changelog

* Remove lang support
2020-05-21 20:29:10 +09:00
Sosuke Suzuki f3e59453cd Vue: Improve upper case HTML tag formatting in DOM template (#8337)
* Treat upper case HTML same as lower case one

* Add changelog

* Support mixed case html tag
2020-05-19 10:30:03 +09:00
Sosuke Suzuki 34bfaf87e6 Vue: Fix ugly formatting for one line template in SFC (#8325)
* Fix ugly formatting for one line template in Vue SFC

* Add changelog

* Modify to treat all root elements as block
2020-05-18 18:50:15 +09:00
Sosuke Suzuki 531b7ca139 Vue: improve parsing custom blocks with angular-html-parser@1.5.0 (#8153)
* Parse twice for vue

* Remove 'html' from vueRootElementsSet

* Add link for Vue SFC spec

* Modify to don't format pug code

* Add changelog

* Fix typo

* Change lang, pug => unknown in tests

* Support top-level html

* Refactor shouldParseAsHTML

* Fix multiple template formatting

* Tiny fix

* Fix by Lint

* Remove console.log

* Support nested template tag

* Meke expected syntax errors

* Update tests

* Support unclosed node

* Update to angular-html-parser@1.7.0

* Update

* Remove failed tests

* Modify to throw first parsing error

* Remove options for error tests

* Optimize parse

* Fix reviewed points

* Fix by lint
2020-05-14 22:08:40 +08:00
fisker Cheung f83eb9d5ef Preserve non-ASCII whitespace characters in HTML (#8137)
* Add html whitespace tests

* `U+0005` -> `U+2005`

* Update tests

* Fix whitespace

* Add changelog

* Another space

* Restore `non-breaking` check

* Add space between tests

* Extract all space related codes to utils

* Fix indent detect

* Update changelog

* Another space

* Rename

* Rename

* Rename

* Use `htmlTrimFirstLine` and `htmlTrimEnd`

* Assert with output

* `htmlTrimPreserveIndentation`

* Update changelog

* Fix another space
2020-04-25 16:56:28 +03:00
Sosuke Suzukiandfisker Cheung 915327d61d Vue: Support custom blocks (#8023)
* Support Vue Custom Block

* Add changelog

* Udpate snapshots

* Support "type" for json

* Remove guessing languages

* Modify to reuse inferScriptParser logic

* Implement withInnerParts arg for stripTrailingHardline

* Rename isVueCustomBlock

* Set `verbose: true`

* Use getParserName

* Ignore vueIndentScriptAndStyle

* tmp

* Fix formatting

* Add tests

* Fix by lint

* Revert "Set `verbose: true`"

This reverts commit f65c7cd7d814d3149aadbeb3cfd00c5372887c33.

* loop with i--

* Modify to preserve unknown langauge

* Support embeddedLanguageFormatting

* Fix by lint

* Fix mistake

* Modify to preserve unknown lang

* Remove unnecesary condition

* Add error tests

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2020-04-17 07:54:24 +09:00
fisker Cheung e199e68bff Format script content inside HTML tag with colon (#7916)
* Format script content inside HTML tag with colon

* Fix mistake
2020-04-01 20:35:58 +03:00
Georgii Dolzhykov 9dad95b35f Bump Prettier dependency to 2.0.0 2020-03-21 22:09:54 +02:00
Graeme Worthy 7f2b103cf6 Support <!-- prettier ignore --> for text (#7654) 2020-02-25 13:11:08 +02:00
Shinigami 59e15ec744 Use spread syntax (convert to es2015) (#6317) 2020-02-25 03:05:49 +02:00
Georgii Dolzhykov 37a7e9cd42 Merge branch 'master' into next 2020-01-22 14:55:22 +02:00
Cyrille David 97a878632c Support printing inline handlebars in html (through embed function) (#7306)
* Move old handlebars to html file

This kind of handlebars code is supposed to be in html files.

* Remove useless file

* Uglify our old handlebars file

* Move venerable hbs tests to their folder

Because of their config

* html: Use glimmer for script tags of type handlebars

* Record snapshots

* Add CHANGELOG entry

* Add the CHANGELOG test

* Make the PR changes more obvious
2020-01-21 08:55:29 +02:00
fisker Cheung 9900174d50 HTML: don't treat colons as namespace prefix delimiters in tag names (#7273) 2020-01-20 16:39:19 +02:00
fisker Cheung 5330d9d4a6 Fix error throws on unclosed tag in pre (#7392) 2020-01-20 13:49:36 +03:00
Georgii Dolzhykov 7e3c0c73b3 Merge branch 'master' into next 2020-01-14 20:36:21 +02:00
fisker Cheung 02c161cf33 Fix: don't throw on broken html (#7293) 2020-01-13 17:31:03 +03:00
Georgii Dolzhykov 42e7f7f1a5 Merge remote-tracking branch 'remotes/upstream/master' into next 2020-01-09 16:55:41 +02:00
Sosuke Suzuki 332a55179e Vue: format sfc jsx (#7180)
* Modify to enable to format vue jsx sfc

* add changelog

* Modify to avoid cspell checking, "sfcs" -> "SFC"
2020-01-09 05:14:19 +09:00
Panayiotis Lipiridis 35fe9ccada Merge with master 2020-01-08 14:43:19 +02:00
Selvazhagan 024f51e5f8 Fixes : #5915 HTML comments in pre tags causes bad formatting o… (#5959) 2020-01-06 21:00:09 +02:00
fisker Cheung 57f0dd56dd Replace indexOf with includes (#6967)
* Replace `indexOf` with `includes`

* Add `unicorn/prefer-includes`
2019-11-17 11:06:14 +01:00
Simon Lydell 98d27c7de2 Bump Prettier dependency to 1.19.0 2019-11-09 01:14:31 +01:00
fisker Cheung 460ea2f459 Format style[lang="css"] (#6875) 2019-11-08 19:33:59 +01:00
Sosuke Suzuki d66c5f82da fix(HTML, Vue): don't break the template element included in a line shorter than print-width (#6284) 2019-08-08 15:18:37 +03:00
Matt KaneandSimon Lydell 7286413ee5 Add JSON script types (#6293)
* Add JSON mimetypes

* Use endsWith

Co-Authored-By: Simon Lydell <simon.lydell@gmail.com>
2019-07-22 16:48:03 +03:00
Wei-Wei Wu 91c20f7fbe Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
Ika cbf06bf388 feat(html): format script with "application/ld+json" (#5642) 2018-12-16 16:21:10 +08:00
Ika d97fe0a1e0 feat(html): preserve surrounding linebreaks (#5596) 2018-12-11 12:43:53 +08:00
Ika 952bc0cc03 fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika cd28c22dbe feat(html): smart quote for attributes (#5590) 2018-12-05 11:15:09 +08:00
Ika 7da4ed76ad fix(html): do not touch comments (#5525) 2018-11-23 21:25:58 +08:00
Ika b2eadd234b fix(vue): preserve custom block (#5458) 2018-11-23 12:33:48 +08:00
Ika 4f63be05e8 fix(html): leading space for leading interpolation in textarea is sensitive (#5468) 2018-11-15 10:34:42 +08:00
Ika 182a92eb28 fix(html): preserve incomplete ie conditional comment (#5429) 2018-11-10 16:44:44 +08:00
Ika 1bce579f8d fix(ng|vue): whitespaces between interpolation and text are sensitive (#5396) 2018-11-10 01:00:26 +08:00
Ika de11f69889 fix(html): preserve unterminated ie conditional comments (#5424) 2018-11-09 23:26:59 +08:00
Ika 6f6b634948 fix(html): preserve content for <template> with unknown lang (#5388) 2018-11-09 19:19:03 +08:00