Commit Graph
2090 Commits
Author SHA1 Message Date
Georgii Dolzhykov 7f2ba08fb0 refactor(range): minor cleanup (#8421) 2020-05-27 11:48:02 +03:00
fisker Cheung 408bbd4cbb Fix empty files with shebang (#8414) 2020-05-26 16:58:00 +03:00
fisker Cheung 44bae94647 Support dynamic languages in front matter (#8381) 2020-05-26 16:18:39 +08:00
Georgii Dolzhykov 67cbab7f48 Add plugins' parsers to the parser option (#8390)
* Add plugins' parsers to the `parser` option

* Add changelog entry

* Add plugin name to value description

* Update snapshot
2020-05-25 14:03:20 +03:00
Cyrille David 40ade963a8 Respect singleQuote option around attribute value more complex than a bare text (#8375)
* Apply singleQuote option to attributes

* Add changelog
2020-05-25 13:18:49 +03:00
fisker Cheung 3606c2e192 Support babel data-type="module" (#8394)
* Support babel `data-type="module"`

* Update changelog
2020-05-25 12:48:31 +03:00
fisker Cheung 82a319898d Flow: fix function type param (#8365) 2020-05-25 16:47:04 +08: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 f2c1d70918 JS: pragma support files with shebang (#8376) 2020-05-23 19:28:05 +08:00
fisker Cheung ea84392af2 YAML: Preserve blank lines in comments (#8356)
* YAML: Fix ugly comments

* Add changelog

* Use common utils
2020-05-21 19:24:51 +03: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
fisker Cheung 8ebda75fec Fix unstable yaml print (#8355) 2020-05-21 19:04:06 +08:00
fisker Cheung 6d49e3b3c1 Revert #7381 (#8359) 2020-05-21 12:25:01 +08:00
fisker Cheung b438ad47d1 Less: Fix inline comments contains /* (#8360) 2020-05-20 22:26:30 +08: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 b94e41aae4 Vue: Support Vue DOM template formatting (#8326) 2020-05-18 21:22:30 +08: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
Georgii Dolzhykov 5dcadf43ab Fix babel-ts to emit a proper syntax error for (a:b) (#8046) 2020-05-16 02:48:45 +03:00
Georgii Dolzhykov b1791e0def refactor(css): calculate correct location data for value-* nodes (#8266)
* calculate correct loc for value-* nodes

* update clean.js to fix idempotence tests
2020-05-16 02:48:25 +03:00
dependabot-preview[bot] 5a7162d063 Bump flow-parser from 0.122.0 to 0.124.0 (#8230) 2020-05-15 18:49:59 +08: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 76b4970c2e Update ESLint related dependencies (#8299) 2020-05-14 10:51:11 +08:00
fisker Cheung 2c8b419837 Test: Fix parsers (#8278) 2020-05-12 19:21:47 +08:00
fisker Cheung cde4a0af9d Fix broken format with upper case HTML tag (#8280)
* Fix broken format with upper case HTML tag

* Add changelog
2020-05-11 21:26:24 +03:00
Georgii Dolzhykov ddd6001520 Treat <select> and <optgroup> as inline-block for whitespace sensitivity (#8275) 2020-05-11 14:13:40 +03:00
fisker Cheung c768be4dd3 Switch dedent to outdent (#8240) 2020-05-11 09:05:06 +08:00
fisker Cheung e1611e855a Update @angular/compiler and angular-estree-parse (#7942) 2020-05-11 09:03:39 +08:00
Georgii Dolzhykov ce2114533a Fix extra space after minus in CSS-in-JS (#8255)
* Fix extra space after minus in CSS-in-JS

* add changelog entry
2020-05-08 16:53:36 +03:00
Evilebot Tnawiandfisker 3f4da31c62 fix: comment at end of at-rule with selector (#7009)
* fix: comment at end of at-rule with selector

* Improve a little bit

* Fix test

* sass directives

Co-authored-by: fisker <lionkay@gmail.com>
2020-05-08 21:39:41 +08:00
fisker Cheung aa2c003aa2 Support HTML-like Comments(only in html) (#8173) 2020-05-08 21:37:59 +08:00
Georgii Dolzhykov 018a5b0803 Workaround optional chaining parser bug in Angular expressions (#8253)
* Workaround optional chaining parser bug in Angular expressions

* add changelog entry

* fix changelog entry
2020-05-08 13:40:16 +03:00
Georgii Dolzhykov 1a3fc0082b Preserve parens around pipes in objects in Angular expressions (#8254) 2020-05-08 13:39:51 +03:00
Abdullah AttaandGeorgii Dolzhykov 8acc9e2a48 fix inconsistent parsing of injected expressions in styled-components' css (#8097)
* fix inconsistent parsing of styled-components' css

* fix for multiple placeholders in one line

* add test for multiple placeholders in one line

* add changelog for the pr

* fix multi part placeholders

* make placeholderMatch regex stricter

* add tests for all fixed cases

* update changelog

* fix changelog link

* do not edit the original doc.parts

* fix changelog output

* simplify logic

* remove unnecessary `tokens` array

* simplify logic even more

* changes according to review

* finalize

* update snapshots after merge

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-05-07 16:06:13 +03:00
Masashi HiranoandGeorgii Dolzhykov 3b78c021d1 JS: Keep the position of end-of-line comments in binary expressions (#7787)
* JS: block comments with LogicalExpression

* Add changelog_unreleased for #7787

* Add handleBinaryExpression in comments.js

* Refactor comments.js to use isBlockComment

* Update pr-7787.md

* Update pr-7787.md

* test: regenerate snapshot for comments/logical-expression

* test: logical-expression.js as unstable tests

* test: add comments/binary-expressions-trailing-space.js

* fix: make two functions one 'handleEndOfLineBlockComments'

* Rename handleEndOfLineBlockComments to handleBinaryExpression

* Refactor handleBinaryExpression to remove unneed condition & params

* Divide and rename test files for handleBinaryExpression()

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-05-07 16:05:27 +03:00
fisker Cheung 207d5245c5 Build: exclude index.js from bin-prettier (#8119) 2020-05-06 18:43:04 +08:00
004cacda97 Improve wrapping of GraphQL fragment directives (#7721)
* fix GraphQL line wrapping for fragment directives is ugly

* update test of graphql for fixing directives

* add changelog_unreleased for pr-7721

* fix graphql directive

* update test of graphql

* update changelog_unreleased

* Update changelog_unreleased/graphql/pr-7721.md

Co-authored-by: Jed Fox <git@twopointzero.us>

* Fix comment in changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2020-05-06 11:27:49 +03:00
fisker Cheung 14f5f8589f Less: parser :extend as selector (#8178) 2020-04-30 11:58:21 +03:00
fisker Cheung 82676f6308 Keep object key with escape sequence as it is (#8160) 2020-04-27 10:30:00 +08:00
fisker Cheung e69e90f067 Fix object trailing commas that last property is ignored (#8111)
* Add failed tests

* Fix trailing commas when last property is ignored

* Add changelog

* Add nested tests

* changelog title
2020-04-25 17:54:10 +03: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
Masashi Hiranoandfisker Cheung 1528e45ff2 JS: Fix end-of-line comments if followed by trailing whitespace (#8069)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2020-04-25 10:38:06 +08:00
Brian Schlenker 2a7515b77e Remove trailing semicolon on single line html style attribute (#8013) 2020-04-25 09:48:26 +08:00
fisker Cheung 09d24debf0 Test json parse errors (#8103) 2020-04-21 14:38:30 +03:00
fisker Cheung d2f51d7494 Fix ignore bug on windows (#8098)
* Fix file ignore bug on windows

* Use `ignore.ignores`

* Fix -stdin-filepath

* Add changelog
2020-04-21 14:33:20 +03:00
fisker Cheung cfb28d632c Use resolve if require.resolve is overridden (#8072) 2020-04-21 10:09:26 +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
Georgii Dolzhykov f67f65055b Further improve method chain breaking heuristic (#7889) 2020-04-16 00:07:44 +03:00
Georgii Dolzhykov 20f02b06f3 Refactor printer-estree.js: extract printing of member chains and call args to separate files (#8061) 2020-04-15 22:31:08 +03:00
Kevin Gibbons 22d149b9f6 Add --embedded-language-formatting={auto,off} option (#7875) 2020-04-11 20:22:44 +03:00
Robson Roberto Souza Peixoto 5569e3306e Use yaml formatter to format ansible files (#7992)
The Ansible[1] extension define a new language for yaml files that describe
ansible playbooks and because of that is not possible use the prettier
extension with ansible files.

1 - https://marketplace.visualstudio.com/items?itemName=vscoss.vscode-ansible
2020-04-11 18:12:21 +03:00