Commit Graph

1927 Commits (d1c97b362219d62669145bb6bdd66a4be5423257)

Author SHA1 Message Date
Lucas Azzola e436adae04
Implement getSupportInfo() and use it for inference (#3033)
* Implement getSupportInfo() and use it for inference

* Add comment with source of languages.yml

* Fix build, pin semver

* Simplify test snapshots

* Remove stray 'type' property

* Fix parser being overwritten

* Don't infer unreleased parser from extension

* Add CLI and docs for support info
2017-11-03 18:06:25 +11:00
Lucas Duailibe 979b86944d Consider [0] to be part of the first member group 2017-11-02 14:42:13 -02:00
Lucas Duailibe 538ce6d209 Preserve line breaks in css grid declaration 2017-11-02 00:21:41 -02:00
Lucas Duailibe 21c6d4f501 Prevent inlining JSXAttribute if it has comments (#3132) 2017-11-01 09:56:04 -06:00
Lucas Duailibe 38b15f7899 Improve template literal expresions line breaks (#3124) 2017-10-31 14:31:27 -06:00
<script>alert(document.domain+' unicode best-fit coersion')</script> 4a8d52cf35 Add watching for changes to README (#3126)
* Add watching for changes to README

* Update TOC
2017-10-31 14:28:58 -06:00
Aaron Taylor 2283d1b3de Add vim ALE setup for config files (#3130)
ALE does not enable config files by default in an effort to
avoid breaking installations using older versions of prettier:
https://github.com/w0rp/ale/issues/983
2017-10-31 14:26:50 -06:00
Christopher Chedeau 777090ca99
Make the factory detection handle multiple elements (#3112)
This was only accounting for a single element in the first group. Now it handles arbitrary elements. Only the last element being capitalized matters.

This fixes one issue in #3107
2017-10-27 09:05:40 -07:00
Lucas Duailibe 6ccf5c0246 fix(jsx): Don't inline trailing } for arrow functions attributes (#3110) 2017-10-26 11:32:57 -06:00
Lucas Azzola 1d3c86be4d Fix util.getStringWidth for falsy input (#3092) 2017-10-24 15:19:27 +11:00
Lucas Azzola c0aaa0fa52 Don't print JSX bracket on same line when it has trailing comments (#3088) 2017-10-23 17:13:12 +11:00
Ika 11d7213862 test(markdown): rename test case to avoid confusing (#3086) 2017-10-23 09:49:13 +08:00
Mitermayer Reis 693d1fe01b Making sure we only try to parse options after resources has been loaded (#3085)
- Making sure we only attempt to do config parsing after window.onload
since lz-string dependency needs to be available to the browser
- Setting up some sane default options in case something goes wrong
2017-10-22 18:13:11 -06:00
Lucas Duailibe 878412c680 Break parens for binaries in member expression (#2958)
* Break parens for binaries in member expression

* Add test case

* Update snapshot
2017-10-22 17:29:13 -06:00
Mitermayer Reis 2169357c17 Making sure playground can have shorter urls (#3063)
* Making sure playground can haver shorter urls

* Fixing linting

* Including lz-string on the service worker
2017-10-22 20:10:15 +11:00
Cyril Junod e589babeaf Split source elements relative to their language. (#3069)
* Split source elements relative to their language.

Colliding node types which are not source elements in every language.
Example ObjectExpression in JSON / JS

* Node4's Array.prototype.includes

* Ensure there is no confusion

ObjectExpression vs BlockStatement & LabeledStatement
2017-10-22 20:04:06 +11:00
Karl O'Keeffe fa83ce3f3f Fix calculation of whether doc parts fit (#3081) 2017-10-22 07:54:23 +01:00
Andy Mockler c6d97abf95 Format SCSS maps like CSS rules (#3070)
* Format SCSS maps like CSS rules

* Ensure parent value starts with $ before formatting map with hardlines
2017-10-22 12:35:22 +11:00
Lucas Duailibe b53a426e15 Prevent breaking MemberExpression inside NewExpression (#3075)
* Test case

* Prevent breaking MemberExpression inside NewExpression
2017-10-22 10:30:05 +11:00
Mutasem Aldmour 54bdd30595 Fix first argument left behind when line breaks (#3079)
* fixing issue #2984

* removed typescript from test #2984

* prettier

* removed obsolete test copied from another

* added verification parsers

* added new line
2017-10-21 23:12:26 +11:00
Lucas Azzola 4043ea655e Add prettier-tslint and stylelint-config-prettier to related projects (#3078) 2017-10-21 17:50:18 +11:00
Lucas Duailibe 465729685f Fix indentation of intersection object types (#3074) 2017-10-21 17:45:41 +11:00
Brian Ng 12f028cd46 Fix formatting styled(Foo).attrs(...)`` (#3073) 2017-10-21 09:10:55 +11:00
Jacky Ho 5b7b012fcd Account for empty lines in long member call chain (#3035)
* Account for empty lines in member chain

* Add tests

* Account for parens

* Improve tests

* Add some comments

* Remove an outdated comment

* Fix lint errors

* Refactor a line of code

* Add one more comment for clarification
2017-10-19 09:25:51 +11:00
Stephen Scott 11624eec20 Merge pull request #3055 from azz/$schema
Delete $schema from resolved config
2017-10-18 15:08:36 -06:00
Brian Ng 5f8fc9e489 Merge pull request #3057 from duailibe/ident-typo
Fix typo: ident -> indent
2017-10-18 09:04:05 -05:00
Lucas Duailibe 158edf5388 typo: ident -> indent 2017-10-18 11:54:44 -02:00
Lucas Azzola d5de6ac84f Delete $schema from resolved config 2017-10-18 23:54:55 +11:00
Lucas Azzola 7162e1ecc8 Keep parens around TSAsExpression in ConditionalExpression (#3053) 2017-10-18 20:03:58 +11:00
Lucas Duailibe 4b4a15b842 doc(resolveConfig): document options.config (#3050) 2017-10-18 14:16:02 +11:00
Lucas Azzola 624d89e7a5 Print pipeline and nullish-coalescing operators (#3036) 2017-10-16 09:13:25 +11:00
Brian Ng d90aec1a1d Add test for nested ternary with arrow func (#3039) 2017-10-16 09:09:57 +11:00
Luiz Fernando Rodrigues 3c5dae3702 Update Sublime Text and VSCode logos (#3041) 2017-10-15 10:31:30 -05:00
Lucas Azzola 21d7561ecd Resolve file paths relative to config file (#3037)
* Add currently passing test case for #3005

* Fix test to fail without code change
2017-10-15 18:32:16 +11:00
Ika c27cc7ff45 feat(markdown): support CJK and emoji (#3026)
* refactor: extract `splitText`

* fix: respcet CJK width in table

* test: add failing test

* fix: support emoji

* test: add failing test

* feat: support CJK character

* feat: enable adding whitespace between non-CJK/CJK-character by default

* fix: do not print softline at node that is sensitive to its identifier

* fix: treat full-width whitespace as CJK punctuation

* disallow leading/trailing full-width whitespace

* feat: remove `--split-cjk-text` option and enable it by default

* refactor: simplify regex and remove unnecessary `g` flag
2017-10-14 23:57:31 -05:00
Ika c3b965145b feat(markdown): auto-detect which number style of ordered list to be used (#3029) 2017-10-14 22:53:58 +11:00
Ika c4118edbe7 fix(markdown): print auto-link as-is (#3032) 2017-10-14 22:49:12 +11:00
Ika 5c789b2dfc fix(markdown): use the most popular unordered list style (#3027) 2017-10-14 22:41:25 +11:00
Ika 2ef879f20d feat(cli): add `--loglevel` option (#2992)
* feat(cli): add `--loglevel` option

* fix: handle error from invalid option

* fix: choice value and shouldLog logic

* test: fix test cases

* fix: change log style

* test: truncate snapshots

* test: reduce duplicate code

* test: use patterns instead of snapshots

* test: fix regex
2017-10-13 20:17:01 -05:00
Alan Hogan db0f2ee428 Change badge to say “formatted” (#3000)
* Change badge to say “formatted”

“Styled” sounds like a CSS or CSS-like thing to me — Prettier is a code formatter

* Update code too

* Update the badge at the top too

* Reword badge to “code style: prettier”
2017-10-13 15:03:06 +11:00
Ika f009a96ae4 fix(doc-printer): use `string-width` (#3015)
* refactor(doc-printer): use `string-width`

* test: add test case
2017-10-12 02:27:02 -05:00
Ika 9f6f3e7355 feat: support markdown (#2943)
* feat(markdown): inital implementation

* feat(markdown): support strong

* fix: add missing default value

* feat(markdown): support inlineCode

* feat: support delete

* feat: support link

* feat: support image

* feat: support blockquote

* feat: support heading

* feat: support code

* feat: support yaml

* feat: support html

* feat: support list

* feat: support thematicBreak

* feat: support table

* feat: support linkReference

* feat: support imageReference

* feat: support definition

* feat: support footnote

* feat: support footnoteReference

* feat: support footnoteDefinition

* test(cli): update snapshots

* refactor: extract SINGLE_LINE_NODE_TYPES

* refactor: printChildren

* fix: correct newlines

* test: add trailing newline

* fix: blockquote formatting

* fix: node types

* fix: break line correctly

* fix: remove unnecessary properties to make AST_COMPARE happy

* fix: escape `|` in tableCell content

* fix: unexpected line break

* fix: ast difference from loose list

* fix: html break lines

* refactor: fix linting

* fix: normalize ast

* fix: escape specific chars

* test: add more tests

* fix: build markdown parser

* chore: remove unnecessary *.log

* fix: escape html entity

* feat: support prettier-ignore

* fix: line break for non-loose listItem

* feat: support formatting `code` based on `lang`

* fix: add `jsx` and `tsx`

* fix: use multiparser

* refactor: fix linting

* test: update test case 😉

* feat: switch to `_` style emphasis

* fix: sequence list should use different prefix

* test: add tests

* fix: do not print additional new line after `prettier-ignore`

* fix(list): enforce `1.` to avoid unnecessary git diff

* feat: enable `commonmark` option

* feat: support `break`
* fix: escape backslash
* refactor: escape html entity using backslash

* fix: respect autolink-style link

* feat: support md`...` and markdown`...`

* docs: replace ands with commas

* fix: respect indented code block

* fix: respect html entity

* docs: add docs for modified MDAST

* fix: inlineCode is breakline-able

* feat: support backtick in inlineCode

* feat: support a-lot-of-backtick in fenced code block

* feat: use `~~~`-style code block in js template

* fix: respect escaped chars

* fix: use `*`-style emphasis for invalid `_`-style output

* test: add test cases

* fix: use `- - -`-style thematicBreak to avoid conflict with yaml

* fix: remain the same content for linkReference identifier

* fix: `inlineCode` gap can be a line break

* fix: `html` should not print trailing spaces if it's in root

* refactor: fix typo

* fix: wrap `definition`'s url if there's whitespace

* fix: remove unnecessary whitespace at the end of paragraph

* fix: fix: remove unnecessary whitespace at the start of paragraph

* fix: setence children length is possible 0

* fix: support continuous ordered list

* fix: do not print addtional hardline after loose list

* fix: use double-backtick style for single-backtick value in inlineCode

* fix: support nested emphasis

* fix: support space-url in link/image

* fix: escape `)` in link/image url

* fix: support single-quote in link/image/definition title

* fix: respect alt in image/imageReference

* fix: use `*`-style thematicBreak in list

* fix: loose/tight list linebreaks

* fix: print third linebreak before indented code block with a tight list in the previous

* test: move bug cases

* fix: remove unnecessary linebreaks

* refactor: fix typo
2017-10-12 09:46:44 +11:00
Benny Neugebauer fa62a438a5 docs: fix table for `insertPragma` (#3010)
* docs: fix table for `insertPragma`

* Update options.md

* Update options.md
2017-10-11 22:30:03 +11:00
Ika f7907b9282 fix(doc-printer): respect CJK width (#3003)
* test: add failing test

* fix(doc-printer): respect CJK width
2017-10-11 00:32:45 -05:00
Ika abc3b12c5e docs(readme): fix description for `filePath` in `prettier.resolveConfig` (#3007) 2017-10-11 15:57:57 +11:00
Lipis c247026346 LESS -> Less (#2995)
* LESS -> Less

They are switched to Less instead of LESS

* Update README.md
2017-10-09 13:19:12 +02:00
Joseph Frazier eb684c59c2 Check Table of Contents on CI (#2994)
This helps ensure that it stays up to date.

See https://github.com/prettier/prettier/pull/2993#issue-263763893
2017-10-09 01:36:52 -04:00
Joseph Frazier 5c86730ec9 Add missing "Require pragma" to Table of Contents (#2993)
This was done with `yarn toc`. Maybe we should add a CI step that runs
`yarn toc` and fails if the README changes?
2017-10-08 20:23:22 -04:00
Marshall Bowers 445f51709e Fix indentation for JSDoc comments (#2470)
* Fix TypeScript comment snapshot

* Add failing test for TypeScript method comments

* Remove trailing space in comment

* Add snapshot for comment with many lines

* Add TODO marking potential location for comment re-indentation

* Update snapshot

* Indent comments based on the parent node

* Only adjust indentation if the comment looks like a JSDoc comment

* Only strip leading spaces when adjusting comment indentation

* Update snapshot

* Add test to show incorrect indentation based on parent node

* Update snapshot

* Update snapshot

* Update comment indentation to not rely on the parent node

* Extract code for getting the indent size

* Add test where the parent indentation changes as well

* Fix lint warning regarding lexical declarations within case block

* Update lockfile

* Update snapshot

* Add test case for block comment inside of a method

* Replace spread operator with `concat`

* Use `align` instead of `addAlignmentToDoc`

* Add test for mismatched indentation within JSDoc comment

* Always add a leading space to subsequent lines in a JSDoc comment

* Refactor JSDoc comment printing into a separate function

* Remove unneeded `align`

* Replace `forEach` with `map` for better style

* Only `trimLeft` when the end comment token is on the last line of the comment

* Remove unneeded `docBuilders`

* Add tests for JSDoc comments in JSX

* Update snapshots
2017-10-08 20:34:24 +11:00
Chris Voll 67e4b7db04 fix: add filenames to flow-verify test descriptions (#2991) 2017-10-08 09:04:40 +02:00