Commit Graph

2485 Commits (54b1f8562d03e858eef8c9034274839316f66772)

Author SHA1 Message Date
Ika 1062f2a889
feat: support JSON.stringify formatting (#4450)
* test: move tests

* feat: support legacy JSON formatting

* fix: add missing assertion

* test: fix coverage

* fix: same output as JSON.stringify

* refactor: fix linting

* refactor: rename to json-stringify

* refactor: fix linting

* fix: should fix the production build

* docs: remove outdated name

* fix(playgound): add lib/parser-json-stringify.js

* feat(playgound): add example for json-stringify

* fix: no error on singleQuote string

* fix(playground): correctly load json-stringify

* fix: identifier is only allowed in ObjectProperty.key

* refactor: clearer
2018-05-14 09:12:25 +08:00
Christian Gill 18eebc89fc Add HousingAnywhere to users (#4476) 2018-05-13 16:53:21 -04:00
Evilebot Tnawi bc2f57dcf9
fix: css variables and scss interpolation (#4471) 2018-05-12 22:38:28 +03:00
Elias Meire 2f5c00ad18 Fix: not greedy match the frontmatter in postcss parser (#4457) 2018-05-10 13:50:19 -03:00
Hozefa b504e79113 update doc with example for JSX Brackets config (#4455)
* update doc with example for JSX Brackets config

* Put ignore comment before code blocks

* Make Prettier happy
2018-05-10 15:07:52 +02:00
Ika 6447d30b0b
feat(markdown): change unordered list symbol to hyphen (#4440) 2018-05-10 14:32:52 +08:00
Alexander Kachkaev bc78541274 Improve plugin resolution when path does not start with ./ (#4451)
* Fix plugin resolution when path does not start with ./

* Minor consistency fix: use "if (resolvedPluginSearchDir) {...}" in load-plugins

* Use more appropriate quotes in plugin-resolution.js

* Try both local paths and node modules when resolving plugins manually

* Test bespoke plugin loading by node module name

* Simplify getFileInfo() as suggested by @j-f1

https://github.com/prettier/prettier/pull/4341#discussion_r187112707
2018-05-10 10:27:41 +10:00
Ika 92485601eb
refactor: fix linting 2018-05-10 02:27:56 +08:00
Ika 0f02940de2
refactor(javascript): move loc util (#4443) 2018-05-10 02:23:40 +08:00
Lucas Duailibe f48dd0ea3b
Simplify `build-docs.js` (#4453) 2018-05-09 14:41:51 -03:00
Lucas Duailibe edcebb0d54
Fix playground (#4454) 2018-05-09 14:27:25 -03:00
Alexander Kachkaev cc734753fc Implement prettier.getFileInfo() method and --file-info CLI option (#4341)
* Implement prettier.getFileInfo() method and --file-info CLI option

* Add empty line between functions in index.js

* Support --plugin-search-dirs / pluginSearchDirs() in --file-info / getFileInfo()

* Address review comments by @ikatyang
2018-05-10 00:53:44 +08:00
Soo Jae Hwang ee96e97c77 Fix: Group long name method in bind expressions (#4447)
* Fix: Group long name method in bind expressions

* Add test for short name method in bind expressions
2018-05-09 10:42:16 -06:00
Alexander Kachkaev 7345a38e64 Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir (#4192)
* Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir

* Use find-parent-dir instead of find-up and test autoloading (with mocked fn)

* Add two test cases where --plugin-search-dir is not .

* Do not mutate pluginSearchDirs argument in load-plugins.js

* Do not test automatic plugin resolution as mocking of "find-parent-dir" does not work due to rollup

* Document --plugin-search-dir / pluginSearchDirs and improve spacing

* Address @ikatyang's review comments

* Fix require path for third-party

* Undo alphabetic sorting of third-party scripts
2018-05-09 19:17:12 +08:00
tjallingt 8cf591447c Added support for the graph ql comment tag (#4395)
* Added support for the graph ql comment tag

As described in the issue https://github.com/prettier/prettier/issues/4360
Prettier still adds a space inbetween the comment tag and the template literal.

* Added comment explaining the random spaces around GraphQL

* Fixed failing AST_COMPARE tests
2018-05-09 01:52:35 -06:00
Nicolò Ribaudo ab452ddc38 Fix: Correctly break class prperties initializer. (#4442) 2018-05-08 20:35:49 -04:00
Lucas Duailibe ef932741ad
Add concurrently to website `yarn start` (#4441) 2018-05-08 16:53:49 -03:00
Ika 3fe790d4b7
refactor: fix linting 2018-05-08 12:42:02 +08:00
Ika 76a5f3c7b6
fix(typescript): add missing `qualifier` and `typeof` in TSImportType (#4438) 2018-05-08 12:35:12 +08:00
Kevin Donnelly c6e7c1966e Improve formatting of TS casts with generics and unions (#4219)
* Add tests showing existing behavior of various TS casts.

* Improve formatting of TS casts with generics and unions.

By adding a soft break between the cast and the expression. Also
includes wrapping parentheses for clarity as suggested in #4171.

Avoids changing behavior at all though if casting an array or object
literal because those already have good behavior where the array or
object literal breaks before the cast does so including them would just
result in a pointless extra layer of parentheses that would add no
clarity.

* Update tests in prepation for updating long cast format.

* Update so nested breaks inside type cast are indented.

* Add tests where expression being cast is too long itself.

* Update cast formatting to only sometimes break after cast.

Specifically it will break after the cast if that makes the cast itself
fit on a single line. If the cast itself won't fit on a single line then
the expression being cast will be placed directly after the `>` at the
end of the cast.
2018-05-07 22:26:01 -06:00
Suchipi ed18f9f7d7
Add heuristic to format functional composition more nicely (#4431)
* Add heuristic to format functional composition more nicely

* Regex -> array

* Use object instead of array for faster lookup

* Remove empty lines

* Add redux connect

Also add comments for libraries
2018-05-07 21:46:30 -06:00
Ika df3eb0cf68
refactor(massageAst): move target props to corresponding plugins (#4430) 2018-05-08 10:48:29 +08:00
Alexander Kachkaev 218abba141 Add /coverage/ to .eslintignore (#4436) 2018-05-07 14:07:48 -03:00
Lucas Duailibe f6b22e3fd1 feat: support styled-components Foo.extend.attrs()`` (#4434)
* Support styled-components Foo.extend.attrs()``

* update snapshot
2018-05-07 12:38:19 +03:00
Ika cc4392e5c0
feat(typescript): support TSImportType (#4429)
* feat(typescript): support TSImportType

* test: add singleQuote test
2018-05-07 07:57:57 +08:00
Aakansha Doshi 299cc97ceb Fix spacing issue in postcss simple vars (#4408) 2018-05-06 13:51:28 +02:00
Ika 7e81a613b5
feat(javascript): support jest-each template string (#4423)
* feat(javascript): support jest-each

* test: add trailing newline

* fix: there can be no trailing newline

* refactor: simplify regex

* refactor: Array.from

* refactor

* fix: print quasis safely
2018-05-06 14:52:34 +08:00
Lucas Duailibe 5776c8405a
Fix TSMappedType comments (#4418) 2018-05-05 15:43:53 -03:00
Johann Hubert Sonntagbauer 1a6cf3d071 revert changes to code mirror gutter styles (#4419) 2018-05-04 13:31:53 -03:00
Lucas Duailibe 8e1b60e943
Fix trailing JSDoc comments with trailing regular comments (#4414) 2018-05-04 10:15:30 -03:00
Lucas Duailibe bafa76f613
Wrap modulo operation in parens inside additive operation (#4413) 2018-05-03 12:28:37 -03:00
Lucas Duailibe c77f1e5987 [playground] Fix doc debug 2018-05-03 10:12:06 -03:00
Lucas Duailibe e3223fe9af Prevent flattening multiplicative operations (#4407) 2018-05-02 23:48:40 +02:00
Lucas Duailibe 6ceba37f9f
Add miniprettier to website and docs (#4411) 2018-05-02 12:51:28 -03:00
Lucas Duailibe 32900842e3
Apply destructuring rules in functions to catch param (#4385) 2018-05-01 10:24:46 -03:00
David Sheldrick d77f5e9c3a Fix cursor offset tracking (#4397)
* handle cusor position relative to comments correctly

* use more robust method of cursor offset tracking

* add support for cursorOffset with rangeStart/End

* add tests for cursorOffset

* use old JS syntax for node4

* add another cursor offset test case

* remove trailing whitespace in cursor tests

* fix null findNodeAtOffset handling

* remove dead code

* add more test cases

* use indexOf for node4

* revert comments.js

* add more comment tests

* change tests infra

* Fix AST_COMPARE

* move CURSOR to top level of file

* mutate result

* use es6 property shorthand

* simplify diff offset calculation

* put remaining test cases in individual files
2018-05-01 09:42:59 -03:00
Johann Hubert Sonntagbauer 3a99fe5d65 [playground] fix overflow in safari (#4406)
* [playground] fix overflow in safari

* options panel will not outgrow editors panel

* fix overflow in safari 10.1

* fix odd code mirror gutter placement during overflow
2018-05-01 09:41:25 -03:00
Johann Hubert Sonntagbauer 1e69119354 [playground Prevent overflow in Firefox (#4394) 2018-04-28 17:38:22 -03:00
Elias Meire 5b7ebb18ba Fix: Always preserve frontmatter, remove dependency (#4392)
* Fix: Always preserve frontmatter, remove dependency

* Move correct test to correct filename

* Add test for malformed frontmatter, finetune regex

* Use other malformed test case

* Update yarn.lock
2018-04-28 08:53:30 -03:00
Nate Pendleton 91c701886d fix(glimmer): preserve leading/trailing spaces in text nodes undernea… (#4288)
* fix(glimmer): preserve leading/trailing spaces in text nodes underneath attribute nodes when next to mustache statements.

* fix(glimmer): format printer-glimmer.js

* fix(glimmer): lint fix

* fix(glimmer): removed decomposition assignments to be compatible with Node 4

* fix(glimmer): Array.includes() -> indexOf() for Node 4
2018-04-27 14:20:10 -06:00
Huy Vo 2ad7576d3a Remove newline in empty .md files (#4388)
* Remove newline in empty .md files

* Fix cannot read property 'type' of undefined bug
2018-04-27 15:01:14 +08:00
Lucas Duailibe 8015e417c0
Separate entry for web bundle (#4386) 2018-04-26 13:38:57 -03:00
Ika 9cc5d4f162
fix(json): jsonc is considered JSON instead of JSON5 (#4374)
* fix(json): jsonc in consider JSON instead of JSON5

* feat: add json5 id
2018-04-27 00:09:36 +08:00
Jed Fox c37861d08b
Add a redirects file (#4321)
* Add a redirects file

* Remove non-working redirects
2018-04-26 11:41:52 -04:00
Evilebot Tnawi 2fe5263ff9
refactor: `printer-postcss` (#4378) 2018-04-26 13:53:52 +03:00
Ika ff38aaff95 fix(javascript): correct escape for markdown in js (#4381)
* test: add tests

* fix(javascript): correct escape for markdown in js

* test: add trailing newline
2018-04-26 13:22:43 +03:00
Ika b46a46b112 fix(playground): add missing `input` code sample for `copy markdown` (#4382) 2018-04-26 00:37:29 -03:00
Kostas Bariotis 9d5a7c7c66 Edit metrics as seen at NPM/GitHub network (#4379) 2018-04-26 10:54:45 +08:00
Lipis 37eea26acf Make Travis green again (#4380) 2018-04-26 10:17:19 +08:00
Evilebot Tnawi 2a3c616787
refactor: remove unused `css-import` node (#4375) 2018-04-25 21:29:59 +03:00