Commit Graph
1298 Commits
Author SHA1 Message Date
fisker Cheung 9900174d50 HTML: don't treat colons as namespace prefix delimiters in tag names (#7273) 2020-01-20 16:39:19 +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 5330d9d4a6 Fix error throws on unclosed tag in pre (#7392) 2020-01-20 13:49:36 +03:00
Chad Carbert aa248378e6 handlebars: Add prettier-ignore (#7275) 2020-01-20 12:19:09 +02:00
Sosuke Suzuki ac72cd3e94 Merge branch 'master' into next 2020-01-18 06:49:52 +09:00
Georgii Dolzhykov 3fd0d56a95 angular: fix i18n attr with @@ (#7371)
* angular: fix i18n attr with @@

* changelog
2020-01-16 15:57:33 +02:00
Kohei Ueno 9c9ff092f5 Fix: remove unnecessary parens when yielding jsx (#7367)
* support YieldExpression inside jsx

* add test cases

* add changelog for pr-7367

* fix changelog file name
2020-01-16 15:54:23 +02:00
fisker Cheung da8d082ce0 Add changelog lint script (#7320)
* Add changelog lint script

* Refactor lint script

* spell

* Fix indent

* fix templateComment

* add H4 check

* Add category in title check

* use array destructuring

* Add space check
2020-01-15 19:25:55 +02: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
fisker Cheung ac3c046747 Run lint-docs on changelogs (#7253) 2020-01-13 15:13:38 +03:00
fisker Cheung 34253b0b89 Fix #5959 changlog (#7294) 2020-01-13 11:41:38 +02:00
Misha KaletskyandGeorgii Dolzhykov 911fe7776e method chain breaking heuristic (#6685)
* examples from various issues about method chaining

this commit includes no prettier functionality changes, so that diffs will be easily visible.

specifically:

* https://github.com/prettier/prettier/issues/4125
* https://github.com/prettier/prettier/pull/4765
* https://github.com/prettier/prettier/issues/1565
* https://github.com/prettier/prettier/issues/3107

* add heuristic for breaking method chains

* fix: remove unnecessary escape characters

* initial non-regex isSimple implementation

* handle babel literal types properly

found here: https://github.com/babel/babel/blob/fe258dec047f473fb5a35172b2ff8cb172051dec/packages/babel-parser/ast/spec.md

* template literal + test

* use !every instead of some(!)

* fix: some test cases

* fix: object expressions and some more simple node types

* some test cases showing need for depth check

* depth check

* update test to test thing it's supposed to test

* optional expressions

* test case for missing isSimple depth

* fix isSimple depth bug

* fix: comment check

* test for ts non-null operator

* make object properties behave similarly to arrays

* isSimple -> isSimpleCallArgument; move to utils; add unaries

* add Import to the list of simple things

* only short regexps to be considered simple (<= 5 chars)

* add changelog entry in the new format

* update snapshots

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-01-10 18:00:23 +02:00
Daiki Ihara 209cee6cea Scss: fix scss variable string concatenation removing spaces (#7211) 2020-01-09 23:38:16 +02:00
Sosuke Suzuki 76020c3526 Update linguist-languages to support file extensions .cjs and .yaml.sed (#7210)
* Update linguist-language

* Add changelog
2020-01-09 17:15:17 +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
1e65456960 markdown: fix redundant leading spaces in markdown list (#7178)
* fix rebundant leading spaces in markdown list

* add test for rebundant leading spaces in markdown_list

* add changelog_unreleased file of pr-7178

* Update changelog_unreleased/markdown/pr-7178.md

Co-Authored-By: Sosuke Suzuki <aosukeke@gmail.com>

* Update changelog_unreleased/markdown/pr-7178.md

Co-Authored-By: Sosuke Suzuki <aosukeke@gmail.com>

* fix minor issues

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-01-08 16:27:28 +02:00
Kohei Ueno 5d165eb850 Fix printing both index signatures without type annotations and… (#7228) 2020-01-08 16:19:34 +02:00
Cyrille David 0bb75fd1b9 handlebars: Fix superfluous line breaks in ConcatStatement (#7051) 2020-01-08 14:24:45 +02:00
Daiki Ihara 87d532b1b6 Markdown: fix PR 7181 broke HTML blocks inside list items (#7220)
* fix PR 7181 broke HTML blocks inside list items

* add test for indented html after list item

* add changelog_unreleased for pr-7220

* update changelog of pr-7181

* fix pointed out
2020-01-07 23:17:52 +02:00
Kohei UenoandGeorgii Dolzhykov e11b6e8992 Fix adding unnecessary colons on Mapped Types (#7221)
* fix #7174 by checking typeAnnotation existance

* add changelog for pr-7174

* fix typo

* revert mappedType test in conformance/

* add new directory and tests

* fix missing a line

* Update changelog_unreleased/typescript/pr-7174.md

Co-Authored-By: Georgii Dolzhykov <thorn.mailbox@gmail.com>

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-01-06 22:25:22 +02:00
Selvazhagan 024f51e5f8 Fixes : #5915 HTML comments in pre tags causes bad formatting o… (#5959) 2020-01-06 21:00:09 +02:00
ArmanoandGeorgii Dolzhykov bda0632890 fix: comments for typescript function like nodes (#7144)
* test: add test cases for method_types comments

* fix: improve handling comments withing typescript function like nodes

* fix: correct position of trailing comments in TSMethodSignature

* fix: allow to use comments on TSAbstractMethodDefinition and fix TSDeclareFunction

* refactor: move real function node type check to function

* refactor: invert if in handleTSFunctionTrailingComments

* refactor: move isRealFunctionLikeNode into end of file

* chore: add changelog

* chore: update changelog

* chore: update changelog

* make changelog more concise

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-01-06 11:18:10 +02:00
Cyrille David c1b6e1c401 handlebars: Improve MustacheStatement printing (#7157)
* Address https://github.com/prettier/prettier/pull/7051#discussion_r351877770

* Add isParentOfType helper fun

* Add CHANGELOG

* Fix a typo

* CHANGELOG: Remove --print-width option

* Add tests
2020-01-05 18:36:34 +02:00
Daiki Ihara 47ece13d78 Markdown: fix HTML formatting broken if the beginning tag start… (#7181)
* fix markdown formatting broken if the beginning html tag starts after a list item

* add test for beginning-tag-after-a-list-item in markdown_html

* add changelog_unreleased of pr-7181

* fix test of ast breaking for beginning-tag-after-a-list-item

* update changelog_unreleased pr-7181

* fix changelog_unreleased

* fix beginning tag starts after a list item in markdown

* add test case for beginning-tag-after-a-list-item

* update changelog_unreleased
2020-01-02 14:02:17 +02:00
Sosuke Suzuki d1771e8652 JavaScript: Fix moving semi for return to end of line-comment (#7140)
* Modify to fix semi for return with comment

* Add complex test case

* Add null check

* Add changelog
2019-12-16 20:11:39 +03:00
Brian Kim 64d4b2f49f revert function composition logic for decorators (#7138)
fixes #6953
2019-12-14 19:41:15 +02:00
Georgii Dolzhykov f421c7f613 fix(typescript): align printing of comments in function types w… (#7104)
* fix(typescript): align printing of comments in function types with Flow and Babel

* add changelog

* add tests for --no-semi
2019-12-06 19:03:26 +01:00
Sosuke Suzuki fa723deee2 TypeScript: remove extra indentation for arrow function on variable declaration with comment (#7094)
* Remove extra indent

* add changelog

* Fix postprocess for range of TypeScript

* Remove locend from postprocess

* Add test for no-smei

* Remove hasLeadingComment
2019-12-06 12:18:38 +03:00
Georgii Dolzhykov 3c13329f4f fix indentation in ternaries nested in conditions of other ternaries (#7087)
* fix indentation in ternaries nested in conditions of other ternaries

* fix giant indent when tabWidth=4

* refactoring: remove breakNested as it was always true

* break between parens

* add changelog

* microfix

* fix TS conditional types

* Update pr-7087.md
2019-12-04 12:39:29 +03:00
Georgii Dolzhykov 26a0bc3305 Don't print trailing commas after rest elements in tuples (#7075) 2019-12-02 13:34:04 +03:00
Sosuke Suzuki 2eca6193d7 JavaScript: Format ThrowStatement like ReturnStatement (#7070) 2019-12-01 12:59:15 +01:00
Cyrille David 021eec8d73 Fix a falling mustache issue (#7052)
* Add a test highlighting the falling mustache issue

* Use concat helper instead of manual concat

* Fix the falling mustache issue

* Add a CHANGELOG
2019-11-28 17:12:57 +01:00
Evilebot Tnawi cad32c0e22 fix formatting of logical and binary expressions in template literals (#7010) 2019-11-22 15:36:34 +03:00
Georgii Dolzhykov bf2989718b fix unstable formatting of logical expressions (#7026) 2019-11-22 00:14:34 +02:00
Georgii Dolzhykov 13d37dac20 TypeScript: print JSDoc-only types (#7020)
* TypeScript: print JSDoc-only types

* add changelog
2019-11-21 12:27:23 +02:00
Evilebot Tnawi 90eed411d4 preserve parentheses for JSDoc type casting with extra spaces a… (#7011) 2019-11-20 18:59:25 +01:00
JounQin 257fba9b30 fix: format JSX Fragment correctly, consider Fragment as block (#6398) 2019-11-18 13:06:48 +02:00
Clément Dessoude 262f27bc61 Fix handling comments in labeled statements (#6984) 2019-11-18 06:41:44 +01:00
Gustav Tiger e76ce2725b Fix MDX html parsing errors (#6949)
* Fix MDX html parsing errors

For MDX wrap JSX parsing in a fragment before sending it of to babel for
parsing and formatting. In MDX adjacent JSX tags are permitted in the
root.

An option sent to the babel parser omits printing the root fragment and
instead just prints its children.

Solves #6943

* an attempt to address JounQin's comments

* use <$>...</$> instead of <>...</>

* refactoring
2019-11-15 12:01:58 +02:00
Evilebot Tnawi 61a2482c48 fix: issue #6813 (Zero-based lists are broken) (#6852) 2019-11-14 20:59:20 +03:00
ark120202 4ed5253509 Don't lowercase element names in CSS selectors (#6947)
Fixes #5788.
2019-11-13 18:13:55 +01:00
Sosuke Suzuki 9b37dca0e9 TypeScript: Fix formatting of type operators as arrow function… (#6901) 2019-11-12 19:13:03 +01:00
fisker Cheung 11d032365e SCSS: don't add extra comma after last comment in map (#6918) 2019-11-12 19:09:46 +01:00
Simon Lydell 95b8e54d1a Release 1.19.1 2019-11-09 13:20:32 +01:00
Simon Lydell 9b1726d3cd Quick-fix for stdin being broken in 1.19.0 (#6894)
Closes #6891.

This downgrades the get-stream package from 5.x to 4.x, which does not
use `async` functions which works around the problem of
`regeneratorRuntime` not being defined (it shouldn’t be needed).

This is an alternative solution to #6893 because I don’t know yet if we
want to enable `corejs` given that we will most likely drop support for
Node.js 8 and older in the next version.

Just like #6893 this PR comes without tests, but I verified locally that
`--stdin` works after this change.
2019-11-09 12:48:56 +01:00
Georgii Dolzhykov 58c6b42aa8 fix formatting of union type as arrow function return type (#6896) 2019-11-09 11:47:54 +01:00
Simon Lydell 4eb3e2650a Blog post, changelog and docs for 1.19 (#6787) 2019-11-09 01:23:57 +01:00