Commit Graph

1713 Commits (2169357c17fb6e8552af2ca69e80d8fc385aa664)

Author SHA1 Message Date
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
Chris Voll 4a6b61aaf3 fix: support sequential CallExpressions in member chains (#2990)
* fix: support sequential CallExpressions in member chains

fixes #2832

* test: add additional test cases for sequential CallExpressions

* test: regenerate method-chain snapshot
2017-10-08 12:12:17 +11:00
Ika 6c8cde9672 fix(cli): do not early exit for `--debug-check` (#2987)
* test: add failing test

* fix(cli): do not early exit for `--debug-check`
2017-10-07 04:36:43 -05:00
Lucas Azzola 23f7e92162 Handle comments between function name and open paren (#2979) 2017-10-06 20:07:58 +11:00
Joern Bernhardt 3c00979530 Fix typo in test files (`*formated` -> `*formatted`) (#2982)
* Fix typo in test files

Signed-off-by: Joern Bernhardt <jb@campudus.com>

* Rename cursot-offset.js to cursor-offset.js

Signed-off-by: Joern Bernhardt <jb@campudus.com>
2017-10-06 20:01:21 +11:00
Jake 50f3e646c7 Add option to insert @format to first docblock if absent (#2865)
* Add option to insert @format pragma if absent

prependPragma --> insertPragma

add tst dir, move stripBom, add to README, update snapshots

remove noise from test + update snapshots

use jest@test new functions, update docs, rerun snapshots

fix accidental upgrade to jest@test

update jest-docblock again to latest with strip()

updated snapshot

* updated snapshots

* revert jest dep change

* apply a trim to parsed comments

* remove empty object

* Revert "apply a trim to parsed comments"

This reverts commit 467f71ce5f4b4f8a1b5c4474ee0484bc96c92141.

* rerun snapshots with proper jest version

* pin jest-docblock to latest @test release

* comment out docs for new feature from readme

* remove leading newlines

* ensure blank line between docblock and rest of file

* remove backtick string
2017-10-06 19:37:14 +11:00
Simon Lydell bc420370c6 Include duration in --write snapshots (#2960) 2017-10-06 08:20:47 +02:00
Lucas Azzola 482ec01c8e Fix build (#2981) 2017-10-06 14:12:32 +11:00
Joern Bernhardt 201105334d Don't use ANSI codes if stdout isn't a TTY (#2903)
Don't use ANSI codes if stdout isn't a TTY
2017-10-05 22:02:31 +11:00
Lucas Duailibe f82fcbc98e Prevent formatting GQL template literals with expressions (#2975)
* Prevent formatting GQL template literals with expressions

* Remove unnecessary check

* Change quasis check to expression check
2017-10-05 11:23:57 +11:00
Ahmed El Gabri 2fed6c873b Use relative paths with CLI (#2969)
* always get relative paths

* Add test

* update snapshots
2017-10-04 18:56:01 +11:00
Alex Rattray a7223d8262 Merge pull request #2973 from karl/jsx-collapse-multiple-jsx-whitespaces
Collapse multiple JSX whitespaces
2017-10-03 23:31:16 -07:00
Karl O'Keeffe e9b82074a6 Collapse multiple JSX whitespaces 2017-10-03 21:15:49 +01:00
Kaelig Deloumeau-Prigent 4adc7a3096 Fix typo and escape code block character (#2972) 2017-10-03 20:39:52 +02:00
Lucas Azzola 212e5f4a20 Fix website getStream regression (#2967) 2017-10-04 00:03:52 +11:00