diff --git a/CHANGELOG.md b/CHANGELOG.md index 61e6b706e..3351b15da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,222 +2,222 @@ [link](https://github.com/prettier/prettier/compare/1.12.1...1.13.0) -* [Release Notes](https://prettier.io/blog/2018/05/23/1.13.0.html) +- [Release Notes](https://prettier.io/blog/2018/05/23/1.13.0.html) # 1.12.1 [link](https://github.com/prettier/prettier/compare/1.12.0...1.12.1) -* Fix for tag being removed from CSS with embedded expressions ([#4302](https://github.com/prettier/prettier/pull/4302)) -* Wrap awaits in unary expressions with parens ([#4315](https://github.com/prettier/prettier/pull/4315)) -* Fix style regression on flow union types ([#4325](https://github.com/prettier/prettier/pull/4325)) +- Fix for tag being removed from CSS with embedded expressions ([#4302](https://github.com/prettier/prettier/pull/4302)) +- Wrap awaits in unary expressions with parens ([#4315](https://github.com/prettier/prettier/pull/4315)) +- Fix style regression on flow union types ([#4325](https://github.com/prettier/prettier/pull/4325)) # 1.12.0 [link](https://github.com/prettier/prettier/compare/1.11.1...1.12.0) -* [Release Notes](https://prettier.io/blog/2018/04/11/1.12.0.html) +- [Release Notes](https://prettier.io/blog/2018/04/11/1.12.0.html) # 1.11.1 [link](https://github.com/prettier/prettier/compare/1.11.0...1.11.1) -* 1.11.0 was incorrectly shipped with the wrong version of the TypeScript parser, which broke conditional types. This release fixes it. -* Fixed an issue relating to deprecated parsers ([#4072](https://github.com/prettier/prettier/pull/4072)) +- 1.11.0 was incorrectly shipped with the wrong version of the TypeScript parser, which broke conditional types. This release fixes it. +- Fixed an issue relating to deprecated parsers ([#4072](https://github.com/prettier/prettier/pull/4072)) # 1.11.0 [link](https://github.com/prettier/prettier/compare/1.10.2...1.11.0) -* [Release Notes](https://prettier.io/blog/2018/02/26/1.11.0.html) +- [Release Notes](https://prettier.io/blog/2018/02/26/1.11.0.html) # 1.10.2 [link](https://github.com/prettier/prettier/compare/1.10.1...1.10.2) -* Fixed an issue printing .vue files with self-closing tags. (#3705 by duailibe) +- Fixed an issue printing .vue files with self-closing tags. (#3705 by duailibe) # 1.10.1 [link](https://github.com/prettier/prettier/compare/1.10.0...1.10.1) -* Fixed an issue where the CLI fails to resolve a file. +- Fixed an issue where the CLI fails to resolve a file. # 1.10.0 [link](https://github.com/prettier/prettier/compare/1.9.2...1.10.0) -* [Release Notes](https://prettier.io/blog/2018/01/10/1.10.0.html) +- [Release Notes](https://prettier.io/blog/2018/01/10/1.10.0.html) # 1.9.2 [link](https://github.com/prettier/prettier/compare/1.9.1...1.9.2) -* Fixed trailing comma not being printed in function calls if the last arg was an arrow (#3428 by duailibe) -* Ignore whitespace after the `/**` in docblocks (#3430 by duailibe) -* Fixed a bug where `get` and `set` class properties arrows would print an unnecessary semicolon with `--no-semi` (#3434 by duailibe) -* Fixed a bug for missing `.editorconfig` files (#3439 by josephfrazier) -* Fix comments being moved in class methods and object properties with the babylon parser (#3441 by duailibe) -* Better printing of member chains with a TSNonNullExpression (`!` character) (#3442 by duailibe) -* Fix missing commas in object properties when a `pretter-ignore` comment is present (#3448 by duailibe) -* Fix printing union types inside a function param type (#3446 by duailibe) -* Fix closing parens on multi-line intersection/union type (#3436 by josephfrazier) -* Don't break single argument destructuring arguments (for arrays and with simple default values) (#3443 by duailibe) +- Fixed trailing comma not being printed in function calls if the last arg was an arrow (#3428 by duailibe) +- Ignore whitespace after the `/**` in docblocks (#3430 by duailibe) +- Fixed a bug where `get` and `set` class properties arrows would print an unnecessary semicolon with `--no-semi` (#3434 by duailibe) +- Fixed a bug for missing `.editorconfig` files (#3439 by josephfrazier) +- Fix comments being moved in class methods and object properties with the babylon parser (#3441 by duailibe) +- Better printing of member chains with a TSNonNullExpression (`!` character) (#3442 by duailibe) +- Fix missing commas in object properties when a `pretter-ignore` comment is present (#3448 by duailibe) +- Fix printing union types inside a function param type (#3446 by duailibe) +- Fix closing parens on multi-line intersection/union type (#3436 by josephfrazier) +- Don't break single argument destructuring arguments (for arrays and with simple default values) (#3443 by duailibe) # 1.9.1 [link](https://github.com/prettier/prettier/compare/1.9.0...1.9.1) -* Fixed a bug of comments with JSX fragments being duplicated in output (#3398 by duailibe) -* Fixed a bug that Prettier would fail when using tabs (#3401 by ikatyang) -* Fixed a regression that removed trailing commas when printing JS code blocks in Markdown (#3405 by azz) -* Fixed a bug when using glob `**/*` which would try to format directories (#3411 by duailibe) -* Fixed a bug when `.editorconfig` had `max_line_length = "off"` (#3412 by duailibe) +- Fixed a bug of comments with JSX fragments being duplicated in output (#3398 by duailibe) +- Fixed a bug that Prettier would fail when using tabs (#3401 by ikatyang) +- Fixed a regression that removed trailing commas when printing JS code blocks in Markdown (#3405 by azz) +- Fixed a bug when using glob `**/*` which would try to format directories (#3411 by duailibe) +- Fixed a bug when `.editorconfig` had `max_line_length = "off"` (#3412 by duailibe) # 1.9.0 [link](https://github.com/prettier/prettier/compare/1.8.2...1.9.0) -* [Release Notes](https://prettier.io/blog/2017/12/05/1.9.0.html) +- [Release Notes](https://prettier.io/blog/2017/12/05/1.9.0.html) # 1.8.2 [link](https://github.com/prettier/prettier/compare/1.8.1...1.8.2) -* Markdown: Don't break on links (#3204 by ikatyang) -* Markdown: Add `--no-prose-wrap` option (#3199 by ikatyang) -* TypeScript: Parenthesis around TSAsExpression inside TSAbstractClassDeclaration (#3191 by duailibe) -* JSON: Print JSON top comments as leading comments of root node (#3187 by duailibe) +- Markdown: Don't break on links (#3204 by ikatyang) +- Markdown: Add `--no-prose-wrap` option (#3199 by ikatyang) +- TypeScript: Parenthesis around TSAsExpression inside TSAbstractClassDeclaration (#3191 by duailibe) +- JSON: Print JSON top comments as leading comments of root node (#3187 by duailibe) # 1.8.1 [link](https://github.com/prettier/prettier/compare/1.8.0...1.8.1) -* Force JSON to no trailing comma in multiparser (#3182 by azz) -* Don't add trailing commas in JSXAttribute for arrow functions (#3181 by duailibe) -* Markdown: Allow more cases that `_`-style emphasis is available (#3186 by ikatyang) -* Markdown: Handle additional spaces before `code` (#3180 by ikatyang) -* Markdown: Do not break on unbreakable place (#3177 by ikatyang) -* Markdown: Do not break before special prefix (#3172 by ikatyang) +- Force JSON to no trailing comma in multiparser (#3182 by azz) +- Don't add trailing commas in JSXAttribute for arrow functions (#3181 by duailibe) +- Markdown: Allow more cases that `_`-style emphasis is available (#3186 by ikatyang) +- Markdown: Handle additional spaces before `code` (#3180 by ikatyang) +- Markdown: Do not break on unbreakable place (#3177 by ikatyang) +- Markdown: Do not break before special prefix (#3172 by ikatyang) # 1.8.0 [link](https://github.com/prettier/prettier/compare/1.7.4...1.8.0) -* [Release Notes](https://prettier.io/blog/2017/11/07/1.8.0.html) +- [Release Notes](https://prettier.io/blog/2017/11/07/1.8.0.html) # 1.7.4 [link](https://github.com/prettier/prettier/compare/1.7.3...1.7.4) -* Force template literals to break after \` for styled-components (#2926 by duailibe) -* Update cosmiconfig to v3.1.0 (#2952 by ikatyang) -* Respect --stdin-filepath, regardless of config source (#2948 by azz) +- Force template literals to break after \` for styled-components (#2926 by duailibe) +- Update cosmiconfig to v3.1.0 (#2952 by ikatyang) +- Respect --stdin-filepath, regardless of config source (#2948 by azz) # 1.7.3 [link](https://github.com/prettier/prettier/compare/1.7.2...1.7.3) -* Fix cosmiconfig in the built version of Prettier (#2930 by lydell) -* Fix: ignore and show warning for unknown option from config file (#2929 by ikatyang) -* Don't use parens with optional chaining meber expressions (#2921 by azz) +- Fix cosmiconfig in the built version of Prettier (#2930 by lydell) +- Fix: ignore and show warning for unknown option from config file (#2929 by ikatyang) +- Don't use parens with optional chaining meber expressions (#2921 by azz) # 1.7.2 [link](https://github.com/prettier/prettier/compare/1.7.1...1.7.2) -* Revert "Fix line break in test declarations with a single argument function declaration" (#2912) +- Revert "Fix line break in test declarations with a single argument function declaration" (#2912) # 1.7.1 [link](https://github.com/prettier/prettier/compare/1.7.0...1.7.1) -* Enable cosmiconfig rcExtensions (#2749 by elektronik2k5) -* Keep original empty lines in argument list (#2763 by jackyho112) -* Upgrade prettier dependency to 1.7.0, fix lint (#2821 by josephfrazier) -* Fix different precedence binary expression when inlining (#2827 by duailibe) -* Bump Babylon (#2831 by existentialism) -* Don't lowercase Less variables when parsed with SCSS parser (#2833 by lydell) -* Don't lowercase `&class` in SCSS/Less selectors (#2834 by lydell) -* Add support for ClassPrivateProperty (#2837 by existentialism) -* Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem (#2843 by azz) -* Split Less and SCSS parsing into different parsers (#2844 by lydell) -* feat: support detailed `--help` (#2847 by ikatyang) -* Update cosmiconfig to 3.0.1 to avoid memory leak (#2848 by danez) -* chore: add prettier-stylelint to the related projects (#2859 by hugomrdias) -* Don't lowercase SCSS placeholder selectors (#2876 by lydell) -* Fix line break in test declarations with 2nd argument as a function (#2877 by duailibe) -* Use semicolons in Flow interface-like bodies (#2593) (#2888 by motiz88) -* We do not need to have a reference to the toolbox-companion since we (#2892 by mitermayer) -* fix(cli): validate options for every `config-precedence` (#2894 by ikatyang) -* fix: do not print stack trace for invalid option (#2895 by ikatyang) -* refactor: use custom error (#2896 by ikatyang) -* fix(typescript): allow symbol type (#2899 by ikatyang) -* Support fit(), xit(), it.only(), etc (#2900 by azz) -* Fix editor styling on empty editors (#2904 by jakegavin) -* Fix printing of comments between decorators and method names (#2906 by azz) +- Enable cosmiconfig rcExtensions (#2749 by elektronik2k5) +- Keep original empty lines in argument list (#2763 by jackyho112) +- Upgrade prettier dependency to 1.7.0, fix lint (#2821 by josephfrazier) +- Fix different precedence binary expression when inlining (#2827 by duailibe) +- Bump Babylon (#2831 by existentialism) +- Don't lowercase Less variables when parsed with SCSS parser (#2833 by lydell) +- Don't lowercase `&class` in SCSS/Less selectors (#2834 by lydell) +- Add support for ClassPrivateProperty (#2837 by existentialism) +- Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem (#2843 by azz) +- Split Less and SCSS parsing into different parsers (#2844 by lydell) +- feat: support detailed `--help` (#2847 by ikatyang) +- Update cosmiconfig to 3.0.1 to avoid memory leak (#2848 by danez) +- chore: add prettier-stylelint to the related projects (#2859 by hugomrdias) +- Don't lowercase SCSS placeholder selectors (#2876 by lydell) +- Fix line break in test declarations with 2nd argument as a function (#2877 by duailibe) +- Use semicolons in Flow interface-like bodies (#2593) (#2888 by motiz88) +- We do not need to have a reference to the toolbox-companion since we (#2892 by mitermayer) +- fix(cli): validate options for every `config-precedence` (#2894 by ikatyang) +- fix: do not print stack trace for invalid option (#2895 by ikatyang) +- refactor: use custom error (#2896 by ikatyang) +- fix(typescript): allow symbol type (#2899 by ikatyang) +- Support fit(), xit(), it.only(), etc (#2900 by azz) +- Fix editor styling on empty editors (#2904 by jakegavin) +- Fix printing of comments between decorators and method names (#2906 by azz) # 1.7.0 [link](https://github.com/prettier/prettier/compare/1.6.1...1.7.0) -* [Release Notes](https://prettier.io/blog/2017/09/15/1.7.0.html) +- [Release Notes](https://prettier.io/blog/2017/09/15/1.7.0.html) # 1.6.1 [link](https://github.com/prettier/prettier/compare/1.6.0...1.6.1) -* Fix CLI option parsing with no arguments (#2684) -* Fix config file finding when using stdin (#2692) -* Fix union type with type params regression (#2688) -* Fix flow parenthesis regression (#2687) +- Fix CLI option parsing with no arguments (#2684) +- Fix config file finding when using stdin (#2692) +- Fix union type with type params regression (#2688) +- Fix flow parenthesis regression (#2687) # 1.6.0 [link](https://github.com/prettier/prettier/compare/1.5.3...1.6.0) -* [Release Notes](https://prettier.io/blog/2017/08/29/1.6.0.html) +- [Release Notes](https://prettier.io/blog/2017/08/29/1.6.0.html) # 1.5.3 [link](https://github.com/prettier/prettier/compare/1.5.2...1.5.3) -* Force trailingComma option to "none" when parser is JSON (#2335) +- Force trailingComma option to "none" when parser is JSON (#2335) # 1.5.2 [link](https://github.com/prettier/prettier/compare/1.5.1...1.5.2) -* Full printing support for GraphQL and various bug fixes -* Fixes for range formatting for JSON and CSS (#2295, #2298) +- Full printing support for GraphQL and various bug fixes +- Fixes for range formatting for JSON and CSS (#2295, #2298) # 1.5.1 [link](https://github.com/prettier/prettier/compare/1.5.0...1.5.1) -* Go back to babylon beta 13 (#2289) -* Inline import('x') to avoid having trailing comma (#2288) +- Go back to babylon beta 13 (#2289) +- Inline import('x') to avoid having trailing comma (#2288) # 1.5.0 [link](https://github.com/prettier/prettier/compare/1.4.4...1.5.0) -* [Release Notes](https://prettier.io/blog/2017/06/28/1.5.0.html) +- [Release Notes](https://prettier.io/blog/2017/06/28/1.5.0.html) # 1.4.4 -* Fix postcss, I forgot to re-run the build script :( +- Fix postcss, I forgot to re-run the build script :( # 1.4.3 [link](https://github.com/prettier/prettier/compare/1.4.2...1.4.3) -* Fix support for node 4 (#1988) -* Fix website on iOS Safari (#1970) +- Fix support for node 4 (#1988) +- Fix website on iOS Safari (#1970) Formatting change: -* Position JSX whitespace (`{" "}`) at the end of lines (#1964) +- Position JSX whitespace (`{" "}`) at the end of lines (#1964) Lots of small fixes, mainly for TypeScript. @@ -225,439 +225,439 @@ Lots of small fixes, mainly for TypeScript. [link](https://github.com/prettier/prettier/compare/1.4.1...1.4.2) -* fix(decorators): do not inline methods with decorators with babylon (#1934) -* fix(typescript): print semi with inline interfaces/types (#1936) -* fix(typescript): no semi after export default abstract class, fixes (#1937) -* TypeScript: fix trailing comma in enum (#1938) +- fix(decorators): do not inline methods with decorators with babylon (#1934) +- fix(typescript): print semi with inline interfaces/types (#1936) +- fix(typescript): no semi after export default abstract class, fixes (#1937) +- TypeScript: fix trailing comma in enum (#1938) # 1.4.1 [link](https://github.com/prettier/prettier/compare/1.4.0...1.4.1) -* Lots of fixes for TypeScript and regressions from 1.4.0. If you are using 1.4.0, you should migrate to 1.4.1 asap ;) +- Lots of fixes for TypeScript and regressions from 1.4.0. If you are using 1.4.0, you should migrate to 1.4.1 asap ;) # 1.4.0 [link](https://github.com/prettier/prettier/compare/1.3.1...1.4.0) -* [Release Notes](https://prettier.io/blog/2017/06/03/1.4.0.html) +- [Release Notes](https://prettier.io/blog/2017/06/03/1.4.0.html) # 1.3.1 -* Respect template inline-ness (#1497) +- Respect template inline-ness (#1497) # 1.3.0 [link](https://github.com/prettier/prettier/compare/1.2.2...1.3.0) -* [Release Notes](https://prettier.io/blog/2017/05/03/1.3.0.html) +- [Release Notes](https://prettier.io/blog/2017/05/03/1.3.0.html) -* add printer branches for some TypeScript nodes (#1331) -* Skip trailing commas with FlowShorthandWithOneArg (#1364) -* add TSLastTypeNode and TSIndexedAccessType (#1370) -* add TSConstructorType (#1367) -* fix do-while break (#1373) -* Fix missing trailing commas on flow generics (#1381) -* Add example of using yarn test with arguments (#1383) -* Have --debug-check also run ast verification (#1337) -* Fix empty line in block with EmptyStatement (#1375) -* parent decides how to print type annotations (#1391) -* add TSTypeOperator (#1396) -* fix TSTypeReference not printing typeArguments (#1392) -* add TSMappedType and TSTypeParameter (#1393) -* fix TSFunctionType failing on TypeParameters (#1394) -* add TSIntersectionType (#1395) -* fix typeParameters printing TSFunctionType w/o breaking flow (#1397) -* Fix optional flow parenthesis (#1357) -* [experimental] Add linting step in test pipeline (#1172) -* fix VariableDeclarator not printing type parameters (#1415) -* add TSMethodSignature (#1416) -* Add TSParameterProperty, TSAbstractClassDeclaration and TSAbstractMethodDefinition (#1410) -* Inline nullable in flow generics (#1426) -* fixed method 'check' error 'format' of undefined (#1424) -* feat(typescript): add delcare modifier support for vars, classes and functions (#1436) -* Allow flow declarations to break on StringLiteralTypeAnnotations (#1437) -* Require '::a.b' to have a preceding ; in no-semi style (#1442) -* Require '(a || b).c++' to have a preceding ; in no-semi style (#1443) -* Upgrade flow parser to 0.45 (#1447) -* Add supertype tests and add TSAbstractClassProperty (#1467) -* Break class expression returned by arrow call (#1464) -* update typescript snapshots to account for #1464 (#1470) -* [WIP] add TSNamespaceExportDeclaration (#1459) -* update yarn.lock (#1471) -* [RFC] Do not indent calls with a single template literal argument (#873) -* Proper indentation for template literals (#1385) -* Add parenthesis for unusual nested ternaries (#1386) -* Preserve inline comment as last argument (#1390) -* Only add parenthesis on ternaries inside of arrow functions if doesn't break (#1450) -* Fix windows line ending on template literals (#1439) -* Add space around `=` for flow generics default arguments (#1476) -* Don't break for unparenthesised single argument flow function (#1452) -* Don't break on empty arrays and objects (#1440) -* Do not break on `[0]` (#1441) -* Reorder flow object props (#1451) -* Break inline object first in function arguments (#1453) -* Break inline object first in function arguments (#1453) (#1173) -* Inline template literals as arrow body (#1485) +- add printer branches for some TypeScript nodes (#1331) +- Skip trailing commas with FlowShorthandWithOneArg (#1364) +- add TSLastTypeNode and TSIndexedAccessType (#1370) +- add TSConstructorType (#1367) +- fix do-while break (#1373) +- Fix missing trailing commas on flow generics (#1381) +- Add example of using yarn test with arguments (#1383) +- Have --debug-check also run ast verification (#1337) +- Fix empty line in block with EmptyStatement (#1375) +- parent decides how to print type annotations (#1391) +- add TSTypeOperator (#1396) +- fix TSTypeReference not printing typeArguments (#1392) +- add TSMappedType and TSTypeParameter (#1393) +- fix TSFunctionType failing on TypeParameters (#1394) +- add TSIntersectionType (#1395) +- fix typeParameters printing TSFunctionType w/o breaking flow (#1397) +- Fix optional flow parenthesis (#1357) +- [experimental] Add linting step in test pipeline (#1172) +- fix VariableDeclarator not printing type parameters (#1415) +- add TSMethodSignature (#1416) +- Add TSParameterProperty, TSAbstractClassDeclaration and TSAbstractMethodDefinition (#1410) +- Inline nullable in flow generics (#1426) +- fixed method 'check' error 'format' of undefined (#1424) +- feat(typescript): add delcare modifier support for vars, classes and functions (#1436) +- Allow flow declarations to break on StringLiteralTypeAnnotations (#1437) +- Require '::a.b' to have a preceding ; in no-semi style (#1442) +- Require '(a || b).c++' to have a preceding ; in no-semi style (#1443) +- Upgrade flow parser to 0.45 (#1447) +- Add supertype tests and add TSAbstractClassProperty (#1467) +- Break class expression returned by arrow call (#1464) +- update typescript snapshots to account for #1464 (#1470) +- [WIP] add TSNamespaceExportDeclaration (#1459) +- update yarn.lock (#1471) +- [RFC] Do not indent calls with a single template literal argument (#873) +- Proper indentation for template literals (#1385) +- Add parenthesis for unusual nested ternaries (#1386) +- Preserve inline comment as last argument (#1390) +- Only add parenthesis on ternaries inside of arrow functions if doesn't break (#1450) +- Fix windows line ending on template literals (#1439) +- Add space around `=` for flow generics default arguments (#1476) +- Don't break for unparenthesised single argument flow function (#1452) +- Don't break on empty arrays and objects (#1440) +- Do not break on `[0]` (#1441) +- Reorder flow object props (#1451) +- Break inline object first in function arguments (#1453) +- Break inline object first in function arguments (#1453) (#1173) +- Inline template literals as arrow body (#1485) # 1.2.2 [link](https://github.com/prettier/prettier/compare/1.2.1...1.2.2) -* Only break for conditionals (#1350) +- Only break for conditionals (#1350) # 1.2.1 [link](https://github.com/prettier/prettier/compare/1.2.0...1.2.1) -* Fix duplicate comments in classes (#1349) +- Fix duplicate comments in classes (#1349) # 1.2.0 [link](https://github.com/prettier/prettier/compare/1.1.0...1.2.0) -* [Release Notes](https://prettier.io/blog/2017/04/20/1.2.0.html) +- [Release Notes](https://prettier.io/blog/2017/04/20/1.2.0.html) -* match jsx files in pre-commit hook (#1276) -* Fix isPreviousLineEmpty on Windows (#1263) -* Add --dev option to suggested install cmd (#1289) -* Write out change CLI changes synchronously. Fixes #1287. (#1292) -* Remove emoji part from lint-staged's name (#1302) -* omit 'doc' key from options object before passing it to format() (#1299) -* Skip globbing filenames with node-glob when the filename is not a glob (#1307) -* FIX: more documentation for jetbrains (#1265) -* Fix template literal comments (#1296) -* Double quotes for option values in Readme file (#1314) -* Do not print the sub-tree when using prettier-ignore (#1286) -* Bail when traversing === groups (#1294) -* Avoid breaking arguments for last arg expansion (#1305) -* Add typescript as a valid parser value (#1318) -* Add jestbrains filewatcher docs (#1310) -* Add prettier_d to Related Projects (#1328) -* Add parentheses for assignment as body of arrow (#1326) -* Add information about Vim's other autocmd events (#1333) -* add printer branch for TSFirstTypeNode (#1332) -* Optimize `prettier --help` for humans (#1340) -* Update link to @vjeux's React London presentation (#1330) -* Improve regex printing (#1341) -* Fix arrow function parenthesis with comments in flow (#1339) -* Break if () if conditional inside breaks (#1344) -* Don't inline paren at right of arguments (#1345) +- match jsx files in pre-commit hook (#1276) +- Fix isPreviousLineEmpty on Windows (#1263) +- Add --dev option to suggested install cmd (#1289) +- Write out change CLI changes synchronously. Fixes #1287. (#1292) +- Remove emoji part from lint-staged's name (#1302) +- omit 'doc' key from options object before passing it to format() (#1299) +- Skip globbing filenames with node-glob when the filename is not a glob (#1307) +- FIX: more documentation for jetbrains (#1265) +- Fix template literal comments (#1296) +- Double quotes for option values in Readme file (#1314) +- Do not print the sub-tree when using prettier-ignore (#1286) +- Bail when traversing === groups (#1294) +- Avoid breaking arguments for last arg expansion (#1305) +- Add typescript as a valid parser value (#1318) +- Add jestbrains filewatcher docs (#1310) +- Add prettier_d to Related Projects (#1328) +- Add parentheses for assignment as body of arrow (#1326) +- Add information about Vim's other autocmd events (#1333) +- add printer branch for TSFirstTypeNode (#1332) +- Optimize `prettier --help` for humans (#1340) +- Update link to @vjeux's React London presentation (#1330) +- Improve regex printing (#1341) +- Fix arrow function parenthesis with comments in flow (#1339) +- Break if () if conditional inside breaks (#1344) +- Don't inline paren at right of arguments (#1345) # 1.1.0 [link](https://github.com/prettier/prettier/compare/1.0.0...1.1.0) -* Prettier 1.0 is the stabler release we've been waiting for (#1242) -* fix small typo (#1255) -* Fix : ReferenceError: err is not defined (#1254) -* Document debugging strategies (#1253) -* Do not inline member expressions as part of assignments (#1256) -* Fix flow union params (#1251) -* Use a whitelist instead of blacklist for member breaking (#1261) -* Remove trailing whitespace (#1259) -* Get rid of fixFaultyLocations code (#1252) -* Fixing n.comments check in printer (#1239) -* [WIP] no-semi comments (#1257) +- Prettier 1.0 is the stabler release we've been waiting for (#1242) +- fix small typo (#1255) +- Fix : ReferenceError: err is not defined (#1254) +- Document debugging strategies (#1253) +- Do not inline member expressions as part of assignments (#1256) +- Fix flow union params (#1251) +- Use a whitelist instead of blacklist for member breaking (#1261) +- Remove trailing whitespace (#1259) +- Get rid of fixFaultyLocations code (#1252) +- Fixing n.comments check in printer (#1239) +- [WIP] no-semi comments (#1257) # 1.0.1 -* change semi default +- change semi default # 1.0.0 [link](https://github.com/prettier/prettier/compare/0.22.0...1.0.0) -* See announcement blog post: [http://jlongster.com/prettier-1.0](http://jlongster.com/prettier-1.0) +- See announcement blog post: [http://jlongster.com/prettier-1.0](http://jlongster.com/prettier-1.0) # 0.22.0 [link](https://github.com/prettier/prettier/compare/0.21.0...0.22.0) -* Run 0.21.0 (#876) -* Fix paren removal on UnionTypeAnnotation (#878) -* Fix typo (#891) -* Ensure no parens for JSX inside of an ArrayExpression (#895) -* Fix object expression in arrow function expression (#897) -* Fix unprinted comments in destructuring (#898) -* Fix bug with importing empty type (#904) -* Fix broken export comment (#899) -* Add CLI Example to Readme (#909) -* Fix 0.5e0 (#911) -* Fix binary expression instanceof in arrow function expression (#913) -* Improve readme CLI usage example (#910) -* Do not break long it/test calls when template literal (#893) -* Update lint-staged docs to use husky for less config. (#923) -* Fix files with comments only (#813) -* Update README.md (#928) -* Fix binary op as body in arrow expression (#921) -* cleanup needsParens (#935) -* [JSX] Break if opening element breaks (#942) -* Parenthesize function expressions in expression position (#941) -* update the README to add a pre-commit hook (#944) -* Fix #951: properly parenthesize \*\* expressions (#952) -* [WIP] TypeScript Parser (#915) -* Do not break long `describe` calls (#953) -* Recursively find leading comments inside ReturnStatements (#955) -* Fix `in` inside of a for in a nested way (#954) -* Make comments around empty parenthesis be inside (#957) -* Stabilize comment after object label (#958) -* Inline BinaryExpressions inside JSXExpression (#965) -* Only allow same-line arrow-less body for explicit nodes (#966) +- Run 0.21.0 (#876) +- Fix paren removal on UnionTypeAnnotation (#878) +- Fix typo (#891) +- Ensure no parens for JSX inside of an ArrayExpression (#895) +- Fix object expression in arrow function expression (#897) +- Fix unprinted comments in destructuring (#898) +- Fix bug with importing empty type (#904) +- Fix broken export comment (#899) +- Add CLI Example to Readme (#909) +- Fix 0.5e0 (#911) +- Fix binary expression instanceof in arrow function expression (#913) +- Improve readme CLI usage example (#910) +- Do not break long it/test calls when template literal (#893) +- Update lint-staged docs to use husky for less config. (#923) +- Fix files with comments only (#813) +- Update README.md (#928) +- Fix binary op as body in arrow expression (#921) +- cleanup needsParens (#935) +- [JSX] Break if opening element breaks (#942) +- Parenthesize function expressions in expression position (#941) +- update the README to add a pre-commit hook (#944) +- Fix #951: properly parenthesize \*\* expressions (#952) +- [WIP] TypeScript Parser (#915) +- Do not break long `describe` calls (#953) +- Recursively find leading comments inside ReturnStatements (#955) +- Fix `in` inside of a for in a nested way (#954) +- Make comments around empty parenthesis be inside (#957) +- Stabilize comment after object label (#958) +- Inline BinaryExpressions inside JSXExpression (#965) +- Only allow same-line arrow-less body for explicit nodes (#966) # 0.21.0 [link](https://github.com/prettier/prettier/compare/0.20.0...0.21.0) -* [JSX] Break before and after jsx whitespace (#836) -* re-run snapshot tests -* Run prettier 0.20.0 (#835) -* [JSX] Don't wrap JSX Elements in parentheses in {} (#845) -* Fix comment after the last argument of a function (#856) -* Fix travis build imag -* Do not break require calls (#841) -* Stabilize import as comments (#855) -* Fix jsx expression comment that break (#852) -* Inline last arg function arguments (#847) -* Keep parenthesis on export default function (#844) -* Inline short expressions for boolean operators too (#826) -* Introduce -l option (#854) -* Add parenthesis around assignments (#862) -* Do not put \n after label (#860) -* Fix comment for `call( // comment` (#858) -* Do not break long it calls (#842) -* Fix flow union comments (#853) +- [JSX] Break before and after jsx whitespace (#836) +- re-run snapshot tests +- Run prettier 0.20.0 (#835) +- [JSX] Don't wrap JSX Elements in parentheses in {} (#845) +- Fix comment after the last argument of a function (#856) +- Fix travis build imag +- Do not break require calls (#841) +- Stabilize import as comments (#855) +- Fix jsx expression comment that break (#852) +- Inline last arg function arguments (#847) +- Keep parenthesis on export default function (#844) +- Inline short expressions for boolean operators too (#826) +- Introduce -l option (#854) +- Add parenthesis around assignments (#862) +- Do not put \n after label (#860) +- Fix comment for `call( // comment` (#858) +- Do not break long it calls (#842) +- Fix flow union comments (#853) # 0.20.0 [link](https://github.com/prettier/prettier/compare/0.19.0...0.20.0) -* Fix extra parens for update expressions (#796) -* Fix empty options (#803) -* Eagerly evaluate `ifBreak` when processing template literals (fixes #795 -* Fix function declaration params comments (#802) -* Update flow to 0.40 (#808) -* Correct link for travis -* Fix function call args (#809) -* Properly support `do` (#811) -* Do not put parenthesis around not named default export (#819) -* Adds another preset to related projects (#820) -* Fix trailing commas in docs (#825) -* Put short body of arrow functions on the same line (#829) -* Preserve new lines for comments after `=` (#830) -* Fix indentation of a merged group (#828) -* Migrate class comments to the beginning (#831) -* Update list of related projects (#833) -* Allow breaking for logical expressions in member chains (#827) +- Fix extra parens for update expressions (#796) +- Fix empty options (#803) +- Eagerly evaluate `ifBreak` when processing template literals (fixes #795 +- Fix function declaration params comments (#802) +- Update flow to 0.40 (#808) +- Correct link for travis +- Fix function call args (#809) +- Properly support `do` (#811) +- Do not put parenthesis around not named default export (#819) +- Adds another preset to related projects (#820) +- Fix trailing commas in docs (#825) +- Put short body of arrow functions on the same line (#829) +- Preserve new lines for comments after `=` (#830) +- Fix indentation of a merged group (#828) +- Migrate class comments to the beginning (#831) +- Update list of related projects (#833) +- Allow breaking for logical expressions in member chains (#827) # 0.19.0 [link](https://github.com/prettier/prettier/compare/0.18.0...0.19.0) -* docs(README): use yarn add for consistency (#734) -* Make trailing-comma option support 2 different modes (#641) -* Update README with valid trailingComma options -* Fix await ternary parenthesis (#740) -* Fix missing dangling comment in exports (#741) -* Fix missing dangling comments in arrays (#744) -* Remove extra parenthesis around await inside of unary expression (#745) -* Fix missing dangling comments in for loop (#742) -* Add note about trailingComma option in versions 0.18.0 and below -* Add missing explanatory comment in ForStatement case (#748) -* Fix leading & operators in flow types (#738) -* Fix missing comments in assignment pattern (#704) -* Correctly place trailing comments in conditionals (#754) -* Use double quotes in script wildcards to support windows `cmd.exe`. (#761) -* Upgrade to Jest 19 (#762) -* Upgrade to Jest 19.0.1 (#779) -* Remove extra parens around ternary arguments of a new call (#776) -* Do not attach comments to EmptyStatements in try/catch (#763) -* Bump babylon & add test for async func decl (#790) -* Add `this` for Member factory whitelist and remove softline (#782) -* Do not expand empty catch (#783) -* Group [0] at the end of the previous chain instead of beginning of next one (#784) -* Do not format template literals (#749) -* Revert babylon bump (#792) -* Do not put trailing commas for function declaration in es5 mode (#791) -* [WIP] Fix comments in template literals (#643) -* Introduce line-suffix-boundary (#750) -* [RFC] Add parenthesis around && inside of || (#780) -* Fix tests on node 4 +- docs(README): use yarn add for consistency (#734) +- Make trailing-comma option support 2 different modes (#641) +- Update README with valid trailingComma options +- Fix await ternary parenthesis (#740) +- Fix missing dangling comment in exports (#741) +- Fix missing dangling comments in arrays (#744) +- Remove extra parenthesis around await inside of unary expression (#745) +- Fix missing dangling comments in for loop (#742) +- Add note about trailingComma option in versions 0.18.0 and below +- Add missing explanatory comment in ForStatement case (#748) +- Fix leading & operators in flow types (#738) +- Fix missing comments in assignment pattern (#704) +- Correctly place trailing comments in conditionals (#754) +- Use double quotes in script wildcards to support windows `cmd.exe`. (#761) +- Upgrade to Jest 19 (#762) +- Upgrade to Jest 19.0.1 (#779) +- Remove extra parens around ternary arguments of a new call (#776) +- Do not attach comments to EmptyStatements in try/catch (#763) +- Bump babylon & add test for async func decl (#790) +- Add `this` for Member factory whitelist and remove softline (#782) +- Do not expand empty catch (#783) +- Group [0] at the end of the previous chain instead of beginning of next one (#784) +- Do not format template literals (#749) +- Revert babylon bump (#792) +- Do not put trailing commas for function declaration in es5 mode (#791) +- [WIP] Fix comments in template literals (#643) +- Introduce line-suffix-boundary (#750) +- [RFC] Add parenthesis around && inside of || (#780) +- Fix tests on node 4 # 0.18.0 [link](https://github.com/prettier/prettier/compare/0.17.0...0.18.0) -* fix --debug-check -* [JSX] Don't add newline following newline (#690) -* [Docs] Use replaceState API when demo code changes (#710) -* Do not inline new as last argument (#705) -* Inline objects & arrays as right part of a boolean expression (#692) -* [RFC] Remove parenthesis object special case (#689) -* Ensure importKind is printed (#718) -* [Docs]: update Readme to reference VS extension (#720) -* docs: Add pre-commit hook with 🚫💩 lint-staged section to the README (#714) -* [RFC] Preserve new lines between array elements (#707) -* Do not put \n inside of empty object method bodies (#706) -* Align boolean inside of arrow functions (#691) -* Fix trailing new lines preservation (#724) -* Unified Split +- fix --debug-check +- [JSX] Don't add newline following newline (#690) +- [Docs] Use replaceState API when demo code changes (#710) +- Do not inline new as last argument (#705) +- Inline objects & arrays as right part of a boolean expression (#692) +- [RFC] Remove parenthesis object special case (#689) +- Ensure importKind is printed (#718) +- [Docs]: update Readme to reference VS extension (#720) +- docs: Add pre-commit hook with 🚫💩 lint-staged section to the README (#714) +- [RFC] Preserve new lines between array elements (#707) +- Do not put \n inside of empty object method bodies (#706) +- Align boolean inside of arrow functions (#691) +- Fix trailing new lines preservation (#724) +- Unified Split # 0.17.1 -* Use `readline` api to manipulate `process.stdout` output. (#687) +- Use `readline` api to manipulate `process.stdout` output. (#687) # 0.17.0 [link](https://github.com/prettier/prettier/compare/0.16.0...0.17.0) -* [JSX] Fix spurious newline (fixes #614) (#628) -* Add --debug-check cli option (#627) -* Remove last trailing line for directives-only files (#609) -* Expand vim instructions -* Fix formatting in readme -* Update snapshots -* Preserve empty line before last comment (#594) -* test on current release of node.js (#595) -* [JSX] jsx-whitespace breaks with parent (fixes #622) (#626) -* Log filename with [update] or [ignore] flags during `--write` process. (#584) -* Do not indent binary expressions inside of if (#604) -* Put short elements at right of single binary expression on same line (#605) -* Run prettier 0.16.0 on the codebase (#631) -* Preserve blank lines inside of objects (#606) -* fix typo in JetBrains External Tool config readme (#679) -* Fix dangling comments for arrays (#665) -* Print line-suffix in --debug-print-doc (#676) -* Avoid unneeded parenthesis for colon with comments (#673) -* Stabilize comments inside of if/then/else before { (#672) -* Soft break the first member of a chain (#667) -* Stabilize comments inside of ternaries (#666) -* Fix trailing commas with a trailing comment (#664) -* Fix Flow union type annotations indentation (#650) -* Ensure that all comments are printed (#571) -* Properly support member chains comments (#668) -* [WIP] Fix Flow DeclareTypeAlias (#669) -* Add option for putting > on the last line in jsx (#661) -* Always put a hardline before dangling comment (#675) -* Fix comments in return statement argument (#657) -* [RFC] Introduce prettier-ignore-next (#671) +- [JSX] Fix spurious newline (fixes #614) (#628) +- Add --debug-check cli option (#627) +- Remove last trailing line for directives-only files (#609) +- Expand vim instructions +- Fix formatting in readme +- Update snapshots +- Preserve empty line before last comment (#594) +- test on current release of node.js (#595) +- [JSX] jsx-whitespace breaks with parent (fixes #622) (#626) +- Log filename with [update] or [ignore] flags during `--write` process. (#584) +- Do not indent binary expressions inside of if (#604) +- Put short elements at right of single binary expression on same line (#605) +- Run prettier 0.16.0 on the codebase (#631) +- Preserve blank lines inside of objects (#606) +- fix typo in JetBrains External Tool config readme (#679) +- Fix dangling comments for arrays (#665) +- Print line-suffix in --debug-print-doc (#676) +- Avoid unneeded parenthesis for colon with comments (#673) +- Stabilize comments inside of if/then/else before { (#672) +- Soft break the first member of a chain (#667) +- Stabilize comments inside of ternaries (#666) +- Fix trailing commas with a trailing comment (#664) +- Fix Flow union type annotations indentation (#650) +- Ensure that all comments are printed (#571) +- Properly support member chains comments (#668) +- [WIP] Fix Flow DeclareTypeAlias (#669) +- Add option for putting > on the last line in jsx (#661) +- Always put a hardline before dangling comment (#675) +- Fix comments in return statement argument (#657) +- [RFC] Introduce prettier-ignore-next (#671) # 0.16.0 [link](https://github.com/prettier/prettier/compare/0.15.0...0.16.0) -* Revert "Print \x and \u escapes in strings and regexes lowercase (#522) -* Fix ternary indent bug (#577) -* jsx parentheses fix (#580) -* Run prettier on 0.15.0 (#558) -* Add parenthesis around single argument arrow if comments (#573) -* Use breakParent inside of last arrow expansion (#559) -* Support dangling comments in ClassBody (#570) -* Make all the member expressions but the last one part of the first group (#589) -* Break long imports (#590) -* Remove the concept of globalPrecedingNode (#561) -* Remove test.js and put it back in the gitignore -* Fix use strict as expression statement (#602) -* Use arrow function when inputted that way for flow objects (#608) -* Better support try/catch comments (#607) -* Print CallExpression comments inside of memberChain (#600) -* Do not attach comments to EmptyStatement (#599) -* Fix files with only comments on the flow parser (#598) -* Remove first line special case (#597) -* Fix single indented JSX comment (#596) -* Print dangling on ast on all the paths +- Revert "Print \x and \u escapes in strings and regexes lowercase (#522) +- Fix ternary indent bug (#577) +- jsx parentheses fix (#580) +- Run prettier on 0.15.0 (#558) +- Add parenthesis around single argument arrow if comments (#573) +- Use breakParent inside of last arrow expansion (#559) +- Support dangling comments in ClassBody (#570) +- Make all the member expressions but the last one part of the first group (#589) +- Break long imports (#590) +- Remove the concept of globalPrecedingNode (#561) +- Remove test.js and put it back in the gitignore +- Fix use strict as expression statement (#602) +- Use arrow function when inputted that way for flow objects (#608) +- Better support try/catch comments (#607) +- Print CallExpression comments inside of memberChain (#600) +- Do not attach comments to EmptyStatement (#599) +- Fix files with only comments on the flow parser (#598) +- Remove first line special case (#597) +- Fix single indented JSX comment (#596) +- Print dangling on ast on all the paths # 0.15.0 [link](https://github.com/prettier/prettier/compare/0.14.1...0.15.0) -* Fix syntax error in empty object with dangling comment (#533) -* Fix closing call expression commented out (#530) -* Update `bracketSpacing` comment to say it's about {} (#529) -* Add 0.14.1 to CHANGELOG (#525) -* Print \x and \u escapes in strings and regexes lowercase (#522) -* Fix Jetbrains example screenshot url. (#534) -* Preserve next line with trailing comment (#535) -* Break nested calls (#517) -* Update snapshot tests from conflicting PRs -* Reimplement MemberExpression printing (#469) -* Remove spurious test.js -* Fix small typo on Jetbrains section (#552) -* [JSX] Handle non-breaking space (#557) -* Make comments between if & else to look good (#544) -* Whitelist UnaryExpression for parentless objects (#545) -* Make comments inside of MemberExpression look good (#556) +- Fix syntax error in empty object with dangling comment (#533) +- Fix closing call expression commented out (#530) +- Update `bracketSpacing` comment to say it's about {} (#529) +- Add 0.14.1 to CHANGELOG (#525) +- Print \x and \u escapes in strings and regexes lowercase (#522) +- Fix Jetbrains example screenshot url. (#534) +- Preserve next line with trailing comment (#535) +- Break nested calls (#517) +- Update snapshot tests from conflicting PRs +- Reimplement MemberExpression printing (#469) +- Remove spurious test.js +- Fix small typo on Jetbrains section (#552) +- [JSX] Handle non-breaking space (#557) +- Make comments between if & else to look good (#544) +- Whitelist UnaryExpression for parentless objects (#545) +- Make comments inside of MemberExpression look good (#556) # 0.14.1 [link](https://github.com/prettier/prettier/compare/0.14.0...0.14.1) -* Fix range for object newline detection (#520) - * a bugfix for "Keep expanded objects expanded" (#495) +- Fix range for object newline detection (#520) + - a bugfix for "Keep expanded objects expanded" (#495) # 0.14.0 [link](https://github.com/prettier/prettier/compare/0.13.0...0.14.0) -* Only write to files if the change (#511) -* Remove extra group when printing object values (#502) -* Add documentation for JetBrains products. (#509) -* Don't print trailing commas for object destructuring and rest (#512) -* Mention eslint-config-prettier (#516) -* [RFC] Keep expanded objects expanded (#495) -* Do not always put an empty lines after directives (#505) -* Print numbers in a uniform way (#498) +- Only write to files if the change (#511) +- Remove extra group when printing object values (#502) +- Add documentation for JetBrains products. (#509) +- Don't print trailing commas for object destructuring and rest (#512) +- Mention eslint-config-prettier (#516) +- [RFC] Keep expanded objects expanded (#495) +- Do not always put an empty lines after directives (#505) +- Print numbers in a uniform way (#498) # 0.13.0 [link](https://github.com/prettier/prettier/compare/0.12.0...0.13.0) -* Simplify arrow functions that use blocks (#496) -* Properly print comments for BinaryExpression (#494) -* Preserve empty line after comment (#493) -* [JSX] Handle each line of text separately (#455) -* Proper support for dangling comments (#492) +- Simplify arrow functions that use blocks (#496) +- Properly print comments for BinaryExpression (#494) +- Preserve empty line after comment (#493) +- [JSX] Handle each line of text separately (#455) +- Proper support for dangling comments (#492) # 0.12.0 [link](https://github.com/prettier/prettier/compare/0.11.0...0.12.0) -* [WIP] Add rationale document (#372) -* Proper parenthesis for yield and await in conditional (#436) -* Don't print double newlines at EOF to stdout (#437) -* Explain the `--color` option in a comment (#434) -* Validate user-provided config with jest-validate (#301) -* Propagate breaks upwards automatically, introduce `breakParent` (#440) -* Fix typo in variable name (#441) -* Refactor traversal (#442) -* Do not put a newline on empty `{}` for functions (#447) -* Better error message for assertDoc (#449) -* Remove `multilineGroup` (#450) -* Ability to break on `:` for objects (#314) -* Update snapshots -* [RFC] Do not put spacing inside of arrays with bracketSpacing (#446) -* Fix integer CLI arguments (#452) -* Move tests around (#454) -* Update package.json, use ast-types 0.9.4 (#453) -* Update lockfile -* Support printing import("a") (#458) -* Explain that you can pass options to the spec runner (#460) -* Fix spurious whitespace (#463) -* Preserve new lines after directives (#464) -* Put decorators on the same line (#459) -* docs: add related projects (#456) -* Add break points for class declaration (#466) -* Added parens around in operator in for loops 🚀. (#468) -* CLI improvements (#478) -* [RFC] Hug Conditionals in JSX (#473) -* Refactor comment algorithm and improve newline/spaces detection (#482) -* Indent ternaries (#484) -* Indent computed member (#471) -* Maintain windows line ending (#472) -* Don't break up JSXOpeningElement if it only has a single text (#488) -* Add CallExpression to the last argument expansion whitelist (#470) -* Mention eslint-plugin-prettier in Related Projects (#490) -* Stop using conditionalGroup inside of UnionTypeAnnotation (#491) +- [WIP] Add rationale document (#372) +- Proper parenthesis for yield and await in conditional (#436) +- Don't print double newlines at EOF to stdout (#437) +- Explain the `--color` option in a comment (#434) +- Validate user-provided config with jest-validate (#301) +- Propagate breaks upwards automatically, introduce `breakParent` (#440) +- Fix typo in variable name (#441) +- Refactor traversal (#442) +- Do not put a newline on empty `{}` for functions (#447) +- Better error message for assertDoc (#449) +- Remove `multilineGroup` (#450) +- Ability to break on `:` for objects (#314) +- Update snapshots +- [RFC] Do not put spacing inside of arrays with bracketSpacing (#446) +- Fix integer CLI arguments (#452) +- Move tests around (#454) +- Update package.json, use ast-types 0.9.4 (#453) +- Update lockfile +- Support printing import("a") (#458) +- Explain that you can pass options to the spec runner (#460) +- Fix spurious whitespace (#463) +- Preserve new lines after directives (#464) +- Put decorators on the same line (#459) +- docs: add related projects (#456) +- Add break points for class declaration (#466) +- Added parens around in operator in for loops 🚀. (#468) +- CLI improvements (#478) +- [RFC] Hug Conditionals in JSX (#473) +- Refactor comment algorithm and improve newline/spaces detection (#482) +- Indent ternaries (#484) +- Indent computed member (#471) +- Maintain windows line ending (#472) +- Don't break up JSXOpeningElement if it only has a single text (#488) +- Add CallExpression to the last argument expansion whitelist (#470) +- Mention eslint-plugin-prettier in Related Projects (#490) +- Stop using conditionalGroup inside of UnionTypeAnnotation (#491) # 0.11.0 @@ -665,198 +665,198 @@ Lots of small fixes, mainly for TypeScript. Now using minor versions instead of patch versions for the releases. -* Swap quotes (#355) -* Drop jsesc (#357) -* Use a Symbol instead of the private dep (#359) -* Add parens for default export FunctionExpressions (#345) -* Fix export extension output (#361) -* Exit with an error if an unknown CLI option is passed (#365) -* Warn if using deprecated CLI options (#364) -* s/jscodefmt/prettier/ (#370) -* Fix CLI options (#369) -* Fix some parens cases for UpdateExpressions (#381) -* Output strings with the minimum amount of escaped quotes (#390) -* Ignore EmptyStatement inside of switch case (#391) -* Support multiple standalones in import (#389) -* Fix missing semi-colon in for loop and var body (#388) -* Fix empty labels (#383) -* Fix forced trailing comma (#382) -* Empty switch should not have an empty line (#384) -* add formatAST() for formatting ASTs directly (#393) -* Fix class extends parenthesis (#396) -* Fix class inside of binary expression missing parenthesis (#397) -* Fix parenthesis in object as left-hand-side of template (#398) -* Remove unneeded parens for FunctionExpression inside LogicalExpression (#399) -* Remove trailing comma for array destructuring with rest (#400) -* Fix +++x (#401) -* Also do the class extend parenthesis for class expressions (#403) -* Fix various parenthesis issues on the left side of template (#404) -* Fix in inside of the first group of a for (#406) -* Add parenthesis for arrow function inside of ternary (#408) -* Add parenthesis around class expression when left side of call expression (#409) -* Ensure computed method names don't lose quotes (#419) -* Add parenthesis for yield inside of a conditional (#418) -* Add parenthesis around assignment for arrow function body (#422) -* Add parenthesis around export default assignments (#423) -* Add parenthesis for class expression on left of member expression (#421) -* Fix missing parens around object in MemberExpression (#424) -* Re-run snapshot tests -* Workaround flow bug around trailing comma (#427) -* Add parenthesis when class expressions are left of a ternary (#428) -* Revert "Workaround flow bug around trailing comma" (#429) -* Update commands.md (#430) -* Improve vim integration section (#416) -* Add glob support to the CLI (#363) -* Use babel-code-frame for syntax errors (#367) -* Update yarn.lock +- Swap quotes (#355) +- Drop jsesc (#357) +- Use a Symbol instead of the private dep (#359) +- Add parens for default export FunctionExpressions (#345) +- Fix export extension output (#361) +- Exit with an error if an unknown CLI option is passed (#365) +- Warn if using deprecated CLI options (#364) +- s/jscodefmt/prettier/ (#370) +- Fix CLI options (#369) +- Fix some parens cases for UpdateExpressions (#381) +- Output strings with the minimum amount of escaped quotes (#390) +- Ignore EmptyStatement inside of switch case (#391) +- Support multiple standalones in import (#389) +- Fix missing semi-colon in for loop and var body (#388) +- Fix empty labels (#383) +- Fix forced trailing comma (#382) +- Empty switch should not have an empty line (#384) +- add formatAST() for formatting ASTs directly (#393) +- Fix class extends parenthesis (#396) +- Fix class inside of binary expression missing parenthesis (#397) +- Fix parenthesis in object as left-hand-side of template (#398) +- Remove unneeded parens for FunctionExpression inside LogicalExpression (#399) +- Remove trailing comma for array destructuring with rest (#400) +- Fix +++x (#401) +- Also do the class extend parenthesis for class expressions (#403) +- Fix various parenthesis issues on the left side of template (#404) +- Fix in inside of the first group of a for (#406) +- Add parenthesis for arrow function inside of ternary (#408) +- Add parenthesis around class expression when left side of call expression (#409) +- Ensure computed method names don't lose quotes (#419) +- Add parenthesis for yield inside of a conditional (#418) +- Add parenthesis around assignment for arrow function body (#422) +- Add parenthesis around export default assignments (#423) +- Add parenthesis for class expression on left of member expression (#421) +- Fix missing parens around object in MemberExpression (#424) +- Re-run snapshot tests +- Workaround flow bug around trailing comma (#427) +- Add parenthesis when class expressions are left of a ternary (#428) +- Revert "Workaround flow bug around trailing comma" (#429) +- Update commands.md (#430) +- Improve vim integration section (#416) +- Add glob support to the CLI (#363) +- Use babel-code-frame for syntax errors (#367) +- Update yarn.lock # 0.0.10 [link](https://github.com/prettier/prettier/compare/0.0.9...0.0.10) -* Add description to package.json (#320) -* Fix crash for single rest on class declaration (#315) -* Add canonical link to Prettier SublimeText package. (#318) -* Properly escape JSXText (#329) -* Hug objects and arrays inside of JSXExpressionContainer (#213) -* Add quotes around unicode keys in flow parser (#328) -* Add tests for comments (#330) -* Print dangling comments in blocks (#331) -* Remove Printer module in favor of single function (#333) -* Split pp.js into doc-{printer,builders,utils}.js (#334) -* Fix node 4 (#336) -* Remove unused functions from recast (#337) -* Kill fromString (#335) -* Extract parser.js (#338) -* Normalize exports (#339) -* Refactor index.js (#340) -* Add semicolon to more default exports (#343) -* Introduce --parser/parser option and deprecate --flow-parser/useFlowParser (#342) -* Remove parens around AwaitExpression in ternary (#346) -* Indent while test the same way as if test (#352) -* Add debugging support for doc IR (#347) +- Add description to package.json (#320) +- Fix crash for single rest on class declaration (#315) +- Add canonical link to Prettier SublimeText package. (#318) +- Properly escape JSXText (#329) +- Hug objects and arrays inside of JSXExpressionContainer (#213) +- Add quotes around unicode keys in flow parser (#328) +- Add tests for comments (#330) +- Print dangling comments in blocks (#331) +- Remove Printer module in favor of single function (#333) +- Split pp.js into doc-{printer,builders,utils}.js (#334) +- Fix node 4 (#336) +- Remove unused functions from recast (#337) +- Kill fromString (#335) +- Extract parser.js (#338) +- Normalize exports (#339) +- Refactor index.js (#340) +- Add semicolon to more default exports (#343) +- Introduce --parser/parser option and deprecate --flow-parser/useFlowParser (#342) +- Remove parens around AwaitExpression in ternary (#346) +- Indent while test the same way as if test (#352) +- Add debugging support for doc IR (#347) # 0.0.9 [link](https://github.com/prettier/prettier/compare/0.0.8...0.0.9) -* Workaround flow bug parsing astral unicode characters (#277) -* Allow specifying the major mode that `defun-before-save` will use. (#276 -* Fix space missing before `,` on export with bracket spacing off (#278) -* Fix space missing before `,` on import with bracket spacing off (#279) -* Add newline after shebang if necessary. (#215) -* Remove +1 from newline detection (#261) -* Fix path when printing member chains so parens work properly (fixes #243 -* Ensure parens on NewExpression with function callee (#282) -* Fix missing semi when default exporting CallExpression (#287) -* Workaround flow parser bug with spread in arrays (#285) -* Update flow-parser to 0.38 (#290) -* Allow customizing args sent to prettier-command (#289) -* Do not output trailing commas with rest arguments (#283) -* Use exact versions in package.json (#291) -* Use js native String.repeat() (#293) -* Handle additional export default parens cases (#298) -* Fix parens around anonymous functions (#297) -* Introduce second argument to ifBreak (#302) -* Fix bracketSpacing typo in tests (#299) -* Remove unused variable (#304) -* Fix trailing whitespace (#300) -* add version flag (#294) -* Add --run-in-band to travis (#306) -* [JSX] Split elements on newlines and preserve whitespace (w/@yamafaktory) (#234) -* Print binary and logical expressions in a nicer format (#262) +- Workaround flow bug parsing astral unicode characters (#277) +- Allow specifying the major mode that `defun-before-save` will use. (#276 +- Fix space missing before `,` on export with bracket spacing off (#278) +- Fix space missing before `,` on import with bracket spacing off (#279) +- Add newline after shebang if necessary. (#215) +- Remove +1 from newline detection (#261) +- Fix path when printing member chains so parens work properly (fixes #243 +- Ensure parens on NewExpression with function callee (#282) +- Fix missing semi when default exporting CallExpression (#287) +- Workaround flow parser bug with spread in arrays (#285) +- Update flow-parser to 0.38 (#290) +- Allow customizing args sent to prettier-command (#289) +- Do not output trailing commas with rest arguments (#283) +- Use exact versions in package.json (#291) +- Use js native String.repeat() (#293) +- Handle additional export default parens cases (#298) +- Fix parens around anonymous functions (#297) +- Introduce second argument to ifBreak (#302) +- Fix bracketSpacing typo in tests (#299) +- Remove unused variable (#304) +- Fix trailing whitespace (#300) +- add version flag (#294) +- Add --run-in-band to travis (#306) +- [JSX] Split elements on newlines and preserve whitespace (w/@yamafaktory) (#234) +- Print binary and logical expressions in a nicer format (#262) # 0.0.8 [link](https://github.com/prettier/prettier/compare/e447971...0192d58) -* Fix await parenthesis (#185) -* Add note about Sublime Test github issue in readme -* Remove legacy Recast code and simplify API. (#191) -* Don't break to new line if logical/loop statements are without brackets. (#194) -* Fix parenthesis for UpdateExpression (#198) -* Fix directives printing for empty functions (#199) -* Fix key quotes omission for flow parser (#203) -* Fix comma when an arrow function with no arguments breaks (#210) -* Last argument expansion works for arrow functions that return JSX (#211) -* Remove faulty location check on template literals that throws in Nuclide (#218) -* Add flow parser experimental options (#221) -* Fix empty exports (#225) -* Fix cases of missing parens with NewExpression (#230) -* Fix issue with ArrowFunctionExpression parens (#236) -* Add npm version badge (#240) -* Consolidate badges in readme -* Fix parens issue with nested UrnaryExpressions (#237) -* Escape strings using jsesc (#229) -* Add newline for empty blocks {} (#205) -* Fix empty export with from clause (#248) -* Fix missing parenthesis for typeof and arrow functions (#249) -* Fix FunctionExpression parens issues (#250) -* Fix last element of an array being null (#232) -* Make sure empty for loops generate valid code (#224) -* Fix parens for functions inside TaggedTemplateExpression (#259) -* Preserve the way numbers were written (#257) +- Fix await parenthesis (#185) +- Add note about Sublime Test github issue in readme +- Remove legacy Recast code and simplify API. (#191) +- Don't break to new line if logical/loop statements are without brackets. (#194) +- Fix parenthesis for UpdateExpression (#198) +- Fix directives printing for empty functions (#199) +- Fix key quotes omission for flow parser (#203) +- Fix comma when an arrow function with no arguments breaks (#210) +- Last argument expansion works for arrow functions that return JSX (#211) +- Remove faulty location check on template literals that throws in Nuclide (#218) +- Add flow parser experimental options (#221) +- Fix empty exports (#225) +- Fix cases of missing parens with NewExpression (#230) +- Fix issue with ArrowFunctionExpression parens (#236) +- Add npm version badge (#240) +- Consolidate badges in readme +- Fix parens issue with nested UrnaryExpressions (#237) +- Escape strings using jsesc (#229) +- Add newline for empty blocks {} (#205) +- Fix empty export with from clause (#248) +- Fix missing parenthesis for typeof and arrow functions (#249) +- Fix FunctionExpression parens issues (#250) +- Fix last element of an array being null (#232) +- Make sure empty for loops generate valid code (#224) +- Fix parens for functions inside TaggedTemplateExpression (#259) +- Preserve the way numbers were written (#257) # 0.0.7 [link](https://github.com/prettier/prettier/compare/7e31610...6f5df0e2b6b7db252e28ce80ebc54814fdc61497) -* Update live editor to 0.0.6 -* Adds various prettier-browser changes (#175) -* Fix `[(0)]` (#179) -* Do not advance for forward skipSpaces (#176) -* Fix windows line-endings (#177) -* add license to package.json (#178) -* Fix exponent in babylon (#181) -* Make `declare type` consistent between babylon and flow (#183) -* Fix DeclareInterface (#182) -* Change test to workaround babylon bug (#184) +- Update live editor to 0.0.6 +- Adds various prettier-browser changes (#175) +- Fix `[(0)]` (#179) +- Do not advance for forward skipSpaces (#176) +- Fix windows line-endings (#177) +- add license to package.json (#178) +- Fix exponent in babylon (#181) +- Make `declare type` consistent between babylon and flow (#183) +- Fix DeclareInterface (#182) +- Change test to workaround babylon bug (#184) # 0.0.6 [link](https://github.com/prettier/prettier/compare/faed09ceea32fcdd58b525aa09b880afb9fa55b7...3af7da5748d64efaed781104ec198924c8c369f9) -* Format property names consistently -* remove node 0.10 from travis config, add travis badge to readme -* Update snapshots -* chore: link prettier package to its github project -* add gitter badge to readme -* add instructions for Visual Studio plugin -* Do not unquote string properties -* Add prettier-browser -* v0.0.5 -- Accidentally didn't push this commit out before others landed; 0.0.5 is actually based on commit faed09ceea32fcdd58b525aa09b880afb9fa55b7 -* update yarn.lock -* remove recast (not used) -* Always use double quotes for JSX and properly escape -* remove unused recast ref -* Fix typo in README. -* Support type annotation for rest argument on babylon parser -* Use `setq` instead of `infc` and `decf` -* Add title and encoding to the REPL -* Fix old name reference in tests_config -* Minimize string escapes -* Support method generics on babylon parser -* Break long `exports` into multiple lines. -* Use group instead of conditionalGroup -* Fix misprinting of computed properties in method chains. (#157) -* treat shebang outside of parsing (#137) -* Break multiline imports (#167) -* Do not put spaces on empty for loop (#169) -* Add trailing comma support for multiline exports (#168) -* Update run_spec to support options -* Add tests for bracketSpacing option -* Add tests for quotes option -* Add tests for tabWiths option -* Add tests for trailingComma option -* Fix for Node 4 -* Add test for shebang and move to index.js (#170) -* Numeric literal callees should keep parens (#141) -* Remove leftover `arrowParensAlways` option (#171) -* Wrap Stateless JSX Arrow Functions and Assignment in Parens (fixes part of #73) -* Break JSXOpeningElement between attributes (fixes #15) -* JSX maintains spaces that matter (fixes #30 and thus part of #73) -* Multiline JSX opening tag breaks children out too (for #73) -* Add regression tests for long JSX Expression contents -* include index.js in format:all script (#132) -* Wrap ForStatement in a block for const decls (#172) -* Reprint all the files! +- Format property names consistently +- remove node 0.10 from travis config, add travis badge to readme +- Update snapshots +- chore: link prettier package to its github project +- add gitter badge to readme +- add instructions for Visual Studio plugin +- Do not unquote string properties +- Add prettier-browser +- v0.0.5 -- Accidentally didn't push this commit out before others landed; 0.0.5 is actually based on commit faed09ceea32fcdd58b525aa09b880afb9fa55b7 +- update yarn.lock +- remove recast (not used) +- Always use double quotes for JSX and properly escape +- remove unused recast ref +- Fix typo in README. +- Support type annotation for rest argument on babylon parser +- Use `setq` instead of `infc` and `decf` +- Add title and encoding to the REPL +- Fix old name reference in tests_config +- Minimize string escapes +- Support method generics on babylon parser +- Break long `exports` into multiple lines. +- Use group instead of conditionalGroup +- Fix misprinting of computed properties in method chains. (#157) +- treat shebang outside of parsing (#137) +- Break multiline imports (#167) +- Do not put spaces on empty for loop (#169) +- Add trailing comma support for multiline exports (#168) +- Update run_spec to support options +- Add tests for bracketSpacing option +- Add tests for quotes option +- Add tests for tabWiths option +- Add tests for trailingComma option +- Fix for Node 4 +- Add test for shebang and move to index.js (#170) +- Numeric literal callees should keep parens (#141) +- Remove leftover `arrowParensAlways` option (#171) +- Wrap Stateless JSX Arrow Functions and Assignment in Parens (fixes part of #73) +- Break JSXOpeningElement between attributes (fixes #15) +- JSX maintains spaces that matter (fixes #30 and thus part of #73) +- Multiline JSX opening tag breaks children out too (for #73) +- Add regression tests for long JSX Expression contents +- include index.js in format:all script (#132) +- Wrap ForStatement in a block for const decls (#172) +- Reprint all the files! diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2476889f6..25cbe0385 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,12 +10,12 @@ yarn test Here's what you need to know about the tests: -* The tests use [Jest snapshots](https://facebook.github.io/jest/docs/en/snapshot-testing.html). -* You can make changes and run `jest -u` (or `yarn test -u`) to update the snapshots. Then run `git diff` to take a look at what changed. Always update the snapshots when opening a PR. -* You can run `AST_COMPARE=1 jest` for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent. -* Each test folder has a `jsfmt.spec.js` that runs the tests. For JavaScript files, generally you can just put `run_spec(__dirname, ["babylon", "flow", "typescript"]);` there. This will verify that the output using each parser is the same. You can also pass options as the third argument, like this: `run_spec(__dirname, ["babylon"], { trailingComma: "es5" });` -* `tests/flow/` contains the Flow test suite, and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.js ../flow/tests/`. -* If you would like to debug prettier locally, you can either debug it in node or the browser. The easiest way to debug it in the browser is to run the interactive `docs` REPL locally. The easiest way to debug it in node, is to create a local test file and run it in an editor like VS Code. +- The tests use [Jest snapshots](https://facebook.github.io/jest/docs/en/snapshot-testing.html). +- You can make changes and run `jest -u` (or `yarn test -u`) to update the snapshots. Then run `git diff` to take a look at what changed. Always update the snapshots when opening a PR. +- You can run `AST_COMPARE=1 jest` for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent. +- Each test folder has a `jsfmt.spec.js` that runs the tests. For JavaScript files, generally you can just put `run_spec(__dirname, ["babylon", "flow", "typescript"]);` there. This will verify that the output using each parser is the same. You can also pass options as the third argument, like this: `run_spec(__dirname, ["babylon"], { trailingComma: "es5" });` +- `tests/flow/` contains the Flow test suite, and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.js ../flow/tests/`. +- If you would like to debug prettier locally, you can either debug it in node or the browser. The easiest way to debug it in the browser is to run the interactive `docs` REPL locally. The easiest way to debug it in node, is to create a local test file and run it in an editor like VS Code. Run `yarn lint --fix` to automatically format files. diff --git a/commands.md b/commands.md index c3149dc7d..6020150c8 100644 --- a/commands.md +++ b/commands.md @@ -213,13 +213,13 @@ If it's using in a whitespace-sensitive language, e.g. markdown, you should use For example: -* `useTabs` - * `tabWidth: 2` - * `` -> `<2 space>` - * `` -> `<2 space>` - * `tabWidth: 4` - * `` -> `<2 space>` - * `` -> `<2 space>` +- `useTabs` + - `tabWidth: 2` + - `` -> `<2 space>` + - `` -> `<2 space>` + - `tabWidth: 4` + - `` -> `<2 space>` + - `` -> `<2 space>` ### markAsRoot diff --git a/docs/api.md b/docs/api.md index b8bafe555..082237b06 100644 --- a/docs/api.md +++ b/docs/api.md @@ -35,8 +35,8 @@ prettier.formatWithCursor(" 1", { cursorOffset: 2 }); `resolveConfig` can be used to resolve configuration for a given source file, passing its path as the first argument. The config search will start at the file path and continue to search up the directory (you can use `process.cwd()` to start searching from the current directory). Or you can pass directly the path of the config file as `options.config` if you don't wish to search for it. A promise is returned which will resolve to: -* An options object, providing a [config file](configuration.md) was found. -* `null`, if no file was found. +- An options object, providing a [config file](configuration.md) was found. +- `null`, if no file was found. The promise will be rejected if there was an error parsing the configuration file. @@ -51,9 +51,9 @@ prettier.resolveConfig(filePath).then(options => { If `options.editorconfig` is `true` and an [`.editorconfig` file](http://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding prettier configuration. This configuration will be overridden by `.prettierrc`, etc. Currently, the following EditorConfig properties are supported: -* `indent_style` -* `indent_size`/`tab_width` -* `max_line_length` +- `indent_style` +- `indent_size`/`tab_width` +- `max_line_length` Use `prettier.resolveConfig.sync(filePath [, options])` if you'd like to use sync version. @@ -61,8 +61,8 @@ Use `prettier.resolveConfig.sync(filePath [, options])` if you'd like to use syn `resolveConfigFile` can be used to find the path of the Prettier's configuration file will be used when resolving the config (i.e. when calling `resolveConfig`). A promise is returned which will resolve to: -* The path of the configuration file. -* `null`, if no file was found. +- The path of the configuration file. +- `null`, if no file was found. The promise will be rejected if there was an error parsing the configuration file. diff --git a/docs/cli.md b/docs/cli.md index a6cef70cd..d2438a3ea 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -110,8 +110,8 @@ This rewrites all processed files in place. This is comparable to the `eslint -- Change the level of logging for the CLI. Valid options are: -* `error` -* `warn` -* `log` (default) -* `debug` -* `silent` +- `error` +- `warn` +- `log` (default) +- `debug` +- `silent` diff --git a/docs/configuration.md b/docs/configuration.md index 3944240a2..05703ae3d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -5,9 +5,9 @@ title: Configuration File Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure prettier via: -* A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. -* A `prettier.config.js` file that exports an object. -* A `"prettier"` key in your `package.json` file. +- A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. +- A `prettier.config.js` file that exports an object. +- A `"prettier"` key in your `package.json` file. The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found. diff --git a/docs/editors.md b/docs/editors.md index 4ebf0e85a..628c432c4 100644 --- a/docs/editors.md +++ b/docs/editors.md @@ -9,8 +9,8 @@ Atom users can simply install the [prettier-atom] package and use `Ctrl+Alt+F` t Alternatively, you can use one the packages below, which behave similarly to [prettier-atom] but have a focus on minimalism. -* [mprettier](https://github.com/t9md/atom-mprettier) -* [miniprettier](https://github.com/duailibe/atom-miniprettier) +- [mprettier](https://github.com/t9md/atom-mprettier) +- [miniprettier](https://github.com/duailibe/atom-miniprettier) ## Emacs diff --git a/docs/index.md b/docs/index.md index cdf019b4f..29e313bab 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,14 +5,14 @@ title: What is Prettier? Prettier is an opinionated code formatter with support for: -* JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) -* [JSX](https://facebook.github.io/jsx/) -* [Flow](https://flow.org/) -* [TypeScript](https://www.typescriptlang.org/) -* CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) -* [JSON](http://json.org/) -* [GraphQL](http://graphql.org/) -* [Markdown](http://commonmark.org/), including [GFM](https://github.github.com/gfm/) +- JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) +- [JSX](https://facebook.github.io/jsx/) +- [Flow](https://flow.org/) +- [TypeScript](https://www.typescriptlang.org/) +- CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) +- [JSON](http://json.org/) +- [GraphQL](http://graphql.org/) +- [Markdown](http://commonmark.org/), including [GFM](https://github.github.com/gfm/) It removes all original styling[\*](#footnotes) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter)) diff --git a/docs/option-philosophy.md b/docs/option-philosophy.md index 6fbd89f1d..9364a78e9 100644 --- a/docs/option-philosophy.md +++ b/docs/option-philosophy.md @@ -17,10 +17,10 @@ Well, had Prettier been created around the same time as JavaScript itself was bo Then there's a bunch of interesting cases. -* `--trailing-comma es5` was added to make it easier to use trailing commas in most environments without having to transpile (trailing function commas were added in ES2017). -* `--prose-wrap` is important to support all quirky markdown renderers in the wild. -* `--arrow-parens` was added after [huge demand](https://github.com/prettier/prettier/issues/812). Prettier has to strike a balance between ideal goals and listening to the community. -* `--jsx-bracket-same-line` was needed for a big company with a huge code base (Facebook), which backed the project when it got started, to be able to [adopt Prettier at all](https://github.com/prettier/prettier/pull/661#issuecomment-295770645). +- `--trailing-comma es5` was added to make it easier to use trailing commas in most environments without having to transpile (trailing function commas were added in ES2017). +- `--prose-wrap` is important to support all quirky markdown renderers in the wild. +- `--arrow-parens` was added after [huge demand](https://github.com/prettier/prettier/issues/812). Prettier has to strike a balance between ideal goals and listening to the community. +- `--jsx-bracket-same-line` was needed for a big company with a huge code base (Facebook), which backed the project when it got started, to be able to [adopt Prettier at all](https://github.com/prettier/prettier/pull/661#issuecomment-295770645). Finally, perhaps the most interesting of them all is `--bracket-spacing`. The truth is that not even [Prettier's creator knows exactly why it exists](https://github.com/prettier/prettier/issues/715#issuecomment-281096495). It was added super early on without much thought. It now serves as an example of the types of options we should avoid. diff --git a/docs/options.md b/docs/options.md index e6aacad31..cf26d1d3f 100644 --- a/docs/options.md +++ b/docs/options.md @@ -43,8 +43,8 @@ Print semicolons at the ends of statements. Valid options: -* `true` - Add a semicolon at the end of every statement. -* `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. +- `true` - Add a semicolon at the end of every statement. +- `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. | Default | CLI Override | API Override | | ------- | ------------ | -------------- | @@ -56,8 +56,8 @@ Use single quotes instead of double quotes. Notes: -* Quotes in JSX will always be double and ignore this setting. -* If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. +- Quotes in JSX will always be double and ignore this setting. +- If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. | Default | CLI Override | API Override | | ------- | ---------------- | --------------------- | @@ -69,9 +69,9 @@ Print trailing commas wherever possible when multi-line. (A single-line array, f Valid options: -* `"none"` - No trailing commas. -* `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) -* `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). +- `"none"` - No trailing commas. +- `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) +- `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). | Default | CLI Override | API Override | | -------- | ------------------------------------------------------ | ------------------------------------------------------ | @@ -83,8 +83,8 @@ Print spaces between brackets in object literals. Valid options: -* `true` - Example: `{ foo: bar }`. -* `false` - Example: `{foo: bar}`. +- `true` - Example: `{ foo: bar }`. +- `false` - Example: `{foo: bar}`. | Default | CLI Override | API Override | | ------- | ---------------------- | ------------------------ | @@ -96,7 +96,7 @@ Put the `>` of a multi-line JSX element at the end of the last line instead of b Valid options: -* `true` - Example: +- `true` - Example: ``` @@ -108,7 +108,7 @@ Valid options: ``` -* `false` - Example: +- `false` - Example: ``` @@ -133,8 +133,8 @@ Include parentheses around a sole arrow function parameter. Valid options: -* `"avoid"` - Omit parens when possible. Example: `x => x` -* `"always"` - Always include parens. Example: `(x) => x` +- `"avoid"` - Omit parens when possible. Example: `x => x` +- `"always"` - Always include parens. Example: `(x) => x` | Default | CLI Override | API Override | | --------- | ----------------------------------------------- | ----------------------------------------------- | @@ -146,8 +146,8 @@ Format only a segment of a file. These two options can be used to format code starting and ending at a given character offset (inclusive and exclusive, respectively). The range will extend: -* Backwards to the start of the first line containing the selected statement. -* Forwards to the end of the selected statement. +- Backwards to the start of the first line containing the selected statement. +- Forwards to the end of the selected statement. These options cannot be used with `cursorOffset`. @@ -164,13 +164,13 @@ Both the `babylon` and `flow` parsers support the same set of JavaScript feature Built-in parsers: -* [`babylon`](https://github.com/babel/babel/tree/master/packages/babylon) -* [`flow`](https://github.com/facebook/flow/tree/master/src/parser) -* [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ -* [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ -* [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ -* [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ -* [`markdown`](https://github.com/wooorm/remark/tree/master/packages/remark-parse) _Since v1.8.0_ +- [`babylon`](https://github.com/babel/babel/tree/master/packages/babylon) +- [`flow`](https://github.com/facebook/flow/tree/master/src/parser) +- [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ +- [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ +- [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ +- [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ +- [`markdown`](https://github.com/wooorm/remark/tree/master/packages/remark-parse) _Since v1.8.0_ [Custom parsers](api.md#custom-parser-api) are also supported. _Since v1.5.0_ @@ -238,9 +238,9 @@ By default, Prettier will wrap markdown text as-is since some services use a lin Valid options: -* `"always"` - Wrap prose if it exceeds the print width. -* `"never"` - Do not wrap prose. -* `"preserve"` - Wrap prose as-is. _available in v1.9.0+_ +- `"always"` - Wrap prose if it exceeds the print width. +- `"never"` - Do not wrap prose. +- `"preserve"` - Wrap prose as-is. _available in v1.9.0+_ | Default | CLI Override | API Override | | ------------ | ----------------------------------------------------------- | ----------------------------------------------------------- | diff --git a/docs/plugins.md b/docs/plugins.md index 591f4376c..a6a0c567b 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,7 +15,7 @@ Plugins are automatically loaded if you have them installed in the same `node_mo When plugins cannot be found automatically, you can load them with: -* The [CLI](./cli.md), via the `--plugin` and `--plugin-search-dir`: +- The [CLI](./cli.md), via the `--plugin` and `--plugin-search-dir`: ```bash prettier --write main.foo --plugin-search-dir=./dir-with-plugins --plugin=./foo-plugin @@ -23,7 +23,7 @@ When plugins cannot be found automatically, you can load them with: > Tip: You can set `--plugin` or `--plugin-search-dir` options multiple times. -* Or the [API](./api.md), via the `plugins` and `pluginSearchDirs` options: +- Or the [API](./api.md), via the `plugins` and `pluginSearchDirs` options: ```js prettier.format("code", { @@ -39,26 +39,26 @@ Providing at least one path to `--plugin-search-dir`/`pluginSearchDirs` turns of ## Official Plugins -* [`@prettier/plugin-python`](https://github.com/prettier/plugin-python) -* [`@prettier/plugin-php`](https://github.com/prettier/plugin-php) -* [`@prettier/plugin-swift`](https://github.com/prettier/plugin-swift) +- [`@prettier/plugin-python`](https://github.com/prettier/plugin-python) +- [`@prettier/plugin-php`](https://github.com/prettier/plugin-php) +- [`@prettier/plugin-swift`](https://github.com/prettier/plugin-swift) ## Community Plugins -* [`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre) -* [`prettier-plugin-java`](https://github.com/thorbenvh8/prettier-java) by [**@thorbenvh8**](https://github.com/thorbenvh8) -* [`prettier-plugin-pg`](https://github.com/benjie/prettier-plugin-pg) by [**@benjie**](https://github.com/benjie) -* [`prettier-plugin-ruby`](https://github.com/iamsolankiamit/prettier-ruby) by [**@iamsolankiamit**](https://github.com/iamsolankiamit) +- [`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre) +- [`prettier-plugin-java`](https://github.com/thorbenvh8/prettier-java) by [**@thorbenvh8**](https://github.com/thorbenvh8) +- [`prettier-plugin-pg`](https://github.com/benjie/prettier-plugin-pg) by [**@benjie**](https://github.com/benjie) +- [`prettier-plugin-ruby`](https://github.com/iamsolankiamit/prettier-ruby) by [**@iamsolankiamit**](https://github.com/iamsolankiamit) ## Developing Plugins Prettier plugins are regular JavaScript modules with five exports: -* `languages` -* `parsers` -* `printers` -* `options` -* `defaultOptions` +- `languages` +- `parsers` +- `printers` +- `options` +- `defaultOptions` ### `languages` diff --git a/docs/rationale.md b/docs/rationale.md index 8953de4d0..68f087ec2 100644 --- a/docs/rationale.md +++ b/docs/rationale.md @@ -23,8 +23,8 @@ Prettier maintains the way your string is escaped. For example, `"🙂"` won't b It turns out that empty lines are very hard to automatically generate. The approach that Prettier takes is to preserve empty lines the way they were in the original source code. There are two additional rules: -* Prettier collapses multiple blank lines into a single blank line. -* Empty lines at the start and end of blocks (and whole files) are removed. (Files always end with a single newline, though.) +- Prettier collapses multiple blank lines into a single blank line. +- Empty lines at the start and end of blocks (and whole files) are removed. (Files always end with a single newline, though.) ### Multi-line objects @@ -142,7 +142,7 @@ Prettier only _prints_ code. It does not transform it. This is to limit the scop Here are a few examples of things that are out of scope for Prettier: -* Turning single- or double-quoted strings into template literals or vice versa. -* Adding/removing `{}` and `return` where they are optional. -* Turning `?:` into `if`-`else` statements. -* Sorting and hoisting `import`s. (Sorting is unsafe because of side effects, which would violate the [correctness](#correctness) goal.) +- Turning single- or double-quoted strings into template literals or vice versa. +- Adding/removing `{}` and `return` where they are optional. +- Turning `?:` into `if`-`else` statements. +- Sorting and hoisting `import`s. (Sorting is unsafe because of side effects, which would violate the [correctness](#correctness) goal.) diff --git a/docs/related-projects.md b/docs/related-projects.md index 38d0977f2..f4bb4f53a 100644 --- a/docs/related-projects.md +++ b/docs/related-projects.md @@ -5,33 +5,33 @@ title: Related Projects ## ESLint Integrations -* [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) plugs Prettier into your ESLint workflow -* [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) turns off all ESLint rules that are unnecessary or might conflict with Prettier -* [`prettier-eslint`](https://github.com/prettier/prettier-eslint) passes `prettier` output to `eslint --fix` -* [`prettier-standard`](https://github.com/sheerun/prettier-standard) uses `prettier` and `prettier-eslint` to format code with standard rules -* [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) passes `prettier` output to `standard --fix` +- [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) plugs Prettier into your ESLint workflow +- [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) turns off all ESLint rules that are unnecessary or might conflict with Prettier +- [`prettier-eslint`](https://github.com/prettier/prettier-eslint) passes `prettier` output to `eslint --fix` +- [`prettier-standard`](https://github.com/sheerun/prettier-standard) uses `prettier` and `prettier-eslint` to format code with standard rules +- [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) passes `prettier` output to `standard --fix` ## TSLint Integrations -* [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues -* [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict -* [`prettier-tslint`](https://github.com/azz/prettier-tslint) passes `prettier` output to `tslint --fix` +- [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues +- [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict +- [`prettier-tslint`](https://github.com/azz/prettier-tslint) passes `prettier` output to `tslint --fix` ## stylelint Integrations -* [`prettier-stylelint`](https://github.com/hugomrdias/prettier-stylelint) passes `prettier` output to `stylelint --fix` -* [`stylelint-config-prettier`](https://github.com/shannonmoeller/stylelint-config-prettier) turns off all rules that are unnecessary or might conflict with Prettier. +- [`prettier-stylelint`](https://github.com/hugomrdias/prettier-stylelint) passes `prettier` output to `stylelint --fix` +- [`stylelint-config-prettier`](https://github.com/shannonmoeller/stylelint-config-prettier) turns off all rules that are unnecessary or might conflict with Prettier. ## Forks -* [`prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) `prettier` with a few minor extra options +- [`prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) `prettier` with a few minor extra options ## Misc -* [`neutrino-preset-prettier`](https://github.com/SpencerCDixon/neutrino-preset-prettier) allows you to use Prettier as a Neutrino preset -* [`prettier_d`](https://github.com/josephfrazier/prettier_d.js) runs Prettier as a server to avoid Node.js startup delay. It also supports configuration via `.prettierrc`, `package.json`, and `.editorconfig`. -* [`Prettier Bookmarklet`](https://prettier.glitch.me/) provides a bookmarklet and exposes a REST API for Prettier that allows to format CodeMirror editor in your browser -* [`prettier-github`](https://github.com/jgierer12/prettier-github) formats code in GitHub comments -* [`rollup-plugin-prettier`](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup -* [`markdown-magic-prettier`](https://github.com/camacho/markdown-magic-prettier) allows you to use Prettier to format JS [codeblocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) in Markdown files via [Markdown Magic](https://github.com/DavidWells/markdown-magic) -* [`pretty-quick`](https://github.com/azz/pretty-quick) formats your changed files with Prettier +- [`neutrino-preset-prettier`](https://github.com/SpencerCDixon/neutrino-preset-prettier) allows you to use Prettier as a Neutrino preset +- [`prettier_d`](https://github.com/josephfrazier/prettier_d.js) runs Prettier as a server to avoid Node.js startup delay. It also supports configuration via `.prettierrc`, `package.json`, and `.editorconfig`. +- [`Prettier Bookmarklet`](https://prettier.glitch.me/) provides a bookmarklet and exposes a REST API for Prettier that allows to format CodeMirror editor in your browser +- [`prettier-github`](https://github.com/jgierer12/prettier-github) formats code in GitHub comments +- [`rollup-plugin-prettier`](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup +- [`markdown-magic-prettier`](https://github.com/camacho/markdown-magic-prettier) allows you to use Prettier to format JS [codeblocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) in Markdown files via [Markdown Magic](https://github.com/DavidWells/markdown-magic) +- [`pretty-quick`](https://github.com/azz/pretty-quick) formats your changed files with Prettier diff --git a/docs/vim.md b/docs/vim.md index 861f4cf95..02c5e5412 100644 --- a/docs/vim.md +++ b/docs/vim.md @@ -29,8 +29,8 @@ autocmd BufWritePre *.js Neoformat You can also make Vim format your code more frequently, by setting an `autocmd` for other events. Here are a couple of useful ones: -* `TextChanged`: after a change was made to the text in Normal mode -* `InsertLeave`: when leaving Insert mode +- `TextChanged`: after a change was made to the text in Normal mode +- `InsertLeave`: when leaving Insert mode For example, you can format on both of the above events together with `BufWritePre` like this: diff --git a/docs/webstorm.md b/docs/webstorm.md index 24a524a0a..a7ced23d7 100644 --- a/docs/webstorm.md +++ b/docs/webstorm.md @@ -19,13 +19,13 @@ To automatically format your files using `prettier` on save, you can use a file Go to _Preferences | Tools | File Watchers_ and click **+** to add a new watcher. Let’s name it **Prettier**. -* **File Type**: _JavaScript_ (or _Any_ if you want to run `prettier` on all files) -* **Scope**: _Project Files_ -* **Program**: full path to `.bin/prettier` or `.bin\prettier.cmd` in the project's `node_module` folder. Or, if Prettier is installed globally, select `prettier` on macOS and Linux or `C:\Users\user_name\AppData\Roaming\npm\prettier.cmd` on Windows (or whatever `npm prefix -g` returns). -* **Arguments**: `--write [other options] $FilePathRelativeToProjectRoot$` -* **Output paths to refresh**: `$FilePathRelativeToProjectRoot$` -* **Working directory**: `$ProjectFileDir$` -* **Auto-save edited files to trigger the watcher**: Uncheck to reformat on Save only. +- **File Type**: _JavaScript_ (or _Any_ if you want to run `prettier` on all files) +- **Scope**: _Project Files_ +- **Program**: full path to `.bin/prettier` or `.bin\prettier.cmd` in the project's `node_module` folder. Or, if Prettier is installed globally, select `prettier` on macOS and Linux or `C:\Users\user_name\AppData\Roaming\npm\prettier.cmd` on Windows (or whatever `npm prefix -g` returns). +- **Arguments**: `--write [other options] $FilePathRelativeToProjectRoot$` +- **Output paths to refresh**: `$FilePathRelativeToProjectRoot$` +- **Working directory**: `$ProjectFileDir$` +- **Auto-save edited files to trigger the watcher**: Uncheck to reformat on Save only. ![Example](/docs/assets/webstorm/file-watcher-prettier.png) @@ -41,9 +41,9 @@ Make sure that the ESLint integration is enabled in _Preferences | Languages & F Go to _Preferences | Tools | External Tools_ and click **+** to add a new tool. Let’s name it **Prettier**. -* **Program**: `prettier` on macOS and Linux or `C:\Users\user_name\AppData\Roaming\npm\prettier.cmd` on Windows (or whatever `npm prefix -g` returns), if Prettier is installed globally -* **Parameters**: `--write [other options] $FilePathRelativeToProjectRoot$` -* **Working directory**: `$ProjectFileDir$` +- **Program**: `prettier` on macOS and Linux or `C:\Users\user_name\AppData\Roaming\npm\prettier.cmd` on Windows (or whatever `npm prefix -g` returns), if Prettier is installed globally +- **Parameters**: `--write [other options] $FilePathRelativeToProjectRoot$` +- **Working directory**: `$ProjectFileDir$` > If Prettier is installed locally in your project, replace the path in **Program** with `$ProjectFileDir$/node_modules/.bin/prettier` on macOS and Linux or `$ProjectFileDir$\node_modules\.bin\prettier.cmd` on Windows. diff --git a/docs/why-prettier.md b/docs/why-prettier.md index c420055b6..3838ffdcc 100644 --- a/docs/why-prettier.md +++ b/docs/why-prettier.md @@ -9,53 +9,53 @@ By far the biggest reason for adopting Prettier is to stop all the on-going deba So why choose the "Prettier style guide" over any other random style guide? Because Prettier is the only "style guide" that is fully automatic. Even if Prettier does not format all code 100% the way you'd like, it's worth the "sacrifice" given the unique benefits of Prettier, don't you think? -* “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” -* “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” -* “Getting tired telling people how to style their product code.” -* “Our top reason was to stop wasting our time debating style nits.” -* “Having a githook set up has reduced the amount of style issues in PRs that result in broken builds due to ESLint rules or things I have to nit-pick or clean up later.” -* “I don't want anybody to nitpick any other person ever again.” -* “It reminds me of how Steve Jobs used to wear the same clothes every day because he has a million decisions to make and he didn't want to be bothered to make trivial ones like picking out clothes. I think Prettier is like that.” +- “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” +- “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” +- “Getting tired telling people how to style their product code.” +- “Our top reason was to stop wasting our time debating style nits.” +- “Having a githook set up has reduced the amount of style issues in PRs that result in broken builds due to ESLint rules or things I have to nit-pick or clean up later.” +- “I don't want anybody to nitpick any other person ever again.” +- “It reminds me of how Steve Jobs used to wear the same clothes every day because he has a million decisions to make and he didn't want to be bothered to make trivial ones like picking out clothes. I think Prettier is like that.” ## Helping Newcomers Prettier is usually introduced by people with experience in the current codebase and JavaScript but the people that disproportionally benefit from it are newcomers to the codebase. One may think that it's only useful for people with very limited programming experience, but we've seen it quicken the ramp up time from experienced engineers joining the company, as they likely used a different coding style before, and developers coming from a different programming language. -* “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” -* “I always put spaces in the wrong place, now I don't have to worry about it anymore.” -* “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” -* “As a teacher, I will also tell to my students to install Prettier to help them to learn the JS syntax and have readable files.” +- “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” +- “I always put spaces in the wrong place, now I don't have to worry about it anymore.” +- “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” +- “As a teacher, I will also tell to my students to install Prettier to help them to learn the JS syntax and have readable files.” ## Writing code What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted. This is an eye opening experience if anything else. -* “I want to write code. Not spend cycles on formatting.” -* “It removed 5% that sucks in our daily life - aka formatting” -* “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ +- “I want to write code. Not spend cycles on formatting.” +- “It removed 5% that sucks in our daily life - aka formatting” +- “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ ## Easy to adopt We've worked very hard to use the least controversial coding styles, went through many rounds of fixing all the edge cases and polished the getting started experience. When you're ready to push Prettier into your codebase, not only should it be painless for you to do it technically but the newly formatted codebase should not generate major controversy and be accepted painlessly by your co-workers. -* “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” -* “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” -* “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” -* “It's fast, against one of our larger JS codebases we were able to run Prettier in under 13 seconds.” -* “The biggest benefit for Prettier for us was being able to format the entire code base at once.” +- “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” +- “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” +- “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” +- “It's fast, against one of our larger JS codebases we were able to run Prettier in under 13 seconds.” +- “The biggest benefit for Prettier for us was being able to format the entire code base at once.” ## Clean up an existing codebase Since coming up with a coding style and enforcing it is a big undertaking, it often slips through the cracks and you are left working on inconsistent codebases. Running Prettier in this case is a quick win, the codebase is now uniform and easier to read without spending hardly any time. -* “Take a look at the code :) I just need to restore sanity.” -* “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” +- “Take a look at the code :) I just need to restore sanity.” +- “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” ## Ride the hype train Purely technical aspects of the projects aren't the only thing people look into when choosing to adopt Prettier. Who built and uses it and how quickly it spreads through the community has a non-trivial impact. -* “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” -* “Was built by the same people as React & React Native.” -* “I like to be part of the hot new things.” -* “Because soon enough people are gonna ask for it.” +- “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” +- “Was built by the same people as React & React Native.” +- “I like to be part of the hot new things.” +- “Because soon enough people are gonna ask for it.” diff --git a/scripts/build-docs.js b/scripts/build-docs.js index 128ca3cc0..f8a99dae3 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -6,7 +6,6 @@ const path = require("path"); const shell = require("shelljs"); const rootDir = path.join(__dirname, ".."); -const staticDir = path.join(rootDir, "website/static"); const docs = path.join(rootDir, "website/static/lib"); function pipe(string) { diff --git a/website/blog/2017-04-13-1.0.0.md b/website/blog/2017-04-13-1.0.0.md index 9421e2bd1..a1644e7f3 100644 --- a/website/blog/2017-04-13-1.0.0.md +++ b/website/blog/2017-04-13-1.0.0.md @@ -604,11 +604,11 @@ same behavior as the original source. You shouldn't be afraid of running prettier on your entire codebase. In order to ensure this, we are doing a lot of things: -* Have an automated way to ensure that prettier is outputting valid code. -* Use it against large codebases such as Facebook, all of CDNjs and the many +- Have an automated way to ensure that prettier is outputting valid code. +- Use it against large codebases such as Facebook, all of CDNjs and the many people in the community using it. -* Run extensive fuzzing using [eslump](https://github.com/lydell/eslump). -* Making every report of such issue as high-pri and fixed right away. +- Run extensive fuzzing using [eslump](https://github.com/lydell/eslump). +- Making every report of such issue as high-pri and fixed right away. If you are unlucky enough to see one, please report it so that we can fix it and you can use `// prettier-ignore` to get you unblocked. diff --git a/website/blog/2017-05-03-1.3.0.md b/website/blog/2017-05-03-1.3.0.md index 23ec4f558..bfad69c5a 100644 --- a/website/blog/2017-05-03-1.3.0.md +++ b/website/blog/2017-05-03-1.3.0.md @@ -22,17 +22,17 @@ Now, the entire Facebook codebase is way bigger than this and it's not feasible Running prettier on a piece of code is a pretty expensive operation, it makes your pull request look bad because of a lot of unrelated changes and it causes merge conflicts for all the outstanding pull requests. So **once a file has been formatted, you should do everything to make sure it remains formatted**. -* When pretty-printing a file, add `@format` to the first block comment like `@flow`. -* Have a lint rule with autofix that checks if the file is correctly pretty printed when `@format` is present. - * When running Nuclide, it's going to show as an inline warning and have a fix button. - * When sending a pull request, it's going to show the lint failing with a [Yn] prompt that you can just press enter. -* Update the default code templates to add `@format` to the header. -* When you run code formatting via cmd-shift-c inside of Nuclide, automatically insert the `@format` header. -* Disable all the stylistic rules like max-len when `@format` is in the header. -* Have script to run prettier through an entire folder with everything configured as a one line operation. -* Have a good guide to help people that want to convert their codebase over with instructions and best practices. -* When pushing a new release of prettier, also run it through all the files with `@format` in order to avoid getting warnings afterwards. -* Add tracking for the number of files with `@format` over time. +- When pretty-printing a file, add `@format` to the first block comment like `@flow`. +- Have a lint rule with autofix that checks if the file is correctly pretty printed when `@format` is present. + - When running Nuclide, it's going to show as an inline warning and have a fix button. + - When sending a pull request, it's going to show the lint failing with a [Yn] prompt that you can just press enter. +- Update the default code templates to add `@format` to the header. +- When you run code formatting via cmd-shift-c inside of Nuclide, automatically insert the `@format` header. +- Disable all the stylistic rules like max-len when `@format` is in the header. +- Have script to run prettier through an entire folder with everything configured as a one line operation. +- Have a good guide to help people that want to convert their codebase over with instructions and best practices. +- When pushing a new release of prettier, also run it through all the files with `@format` in order to avoid getting warnings afterwards. +- Add tracking for the number of files with `@format` over time. We finally got all those things wired up 1.5 weeks ago and the reception has been insane. Many people from various teams converted their codebase to prettier on their own. As of today, 15% of Facebook codebase has been converted over! diff --git a/website/blog/2017-08-29-1.6.0.md b/website/blog/2017-08-29-1.6.0.md index 463658dee..2b70969a4 100644 --- a/website/blog/2017-08-29-1.6.0.md +++ b/website/blog/2017-08-29-1.6.0.md @@ -47,7 +47,7 @@ package.json The last big friction point from people trying to adopt prettier was around how JSX was being printed. We went through all the issues that were raised and made a bunch of changes: -* Arrow Function Expressions returning JSX will now add parens when the JSX breaks +- Arrow Function Expressions returning JSX will now add parens when the JSX breaks ```jsx @@ -65,7 +65,7 @@ const Component = props => ( ); ``` -* Conditional expressions within (or containing) JSX are formatted in a different way using parenthesis +- Conditional expressions within (or containing) JSX are formatted in a different way using parenthesis ```jsx @@ -92,7 +92,7 @@ const Component = props => ( ``` -* JSX in logical expressions (|| or &&) is always wrapped in parens when the JSX breaks +- JSX in logical expressions (|| or &&) is always wrapped in parens when the JSX breaks ```jsx diff --git a/website/blog/2017-09-15-1.7.0.md b/website/blog/2017-09-15-1.7.0.md index e01312cf8..9a0f0ef29 100644 --- a/website/blog/2017-09-15-1.7.0.md +++ b/website/blog/2017-09-15-1.7.0.md @@ -154,65 +154,65 @@ Previously, there was no way via the API to resolve configuration for a source f ### PRs merged in this release -* [**Update README.md**](https://github.com/prettier/prettier/pull/2690) by [@ikatyang](https://github.com/ikatyang) -* [**Fix config file finding when using stdin**](https://github.com/prettier/prettier/pull/2692) by [@lydell](https://github.com/lydell) -* [**docs(readme): add and sort cli options**](https://github.com/prettier/prettier/pull/2700) by [@levithomason](https://github.com/levithomason) -* [**Add Transloadit as a user**](https://github.com/prettier/prettier/pull/2706) by [@kvz](https://github.com/kvz) -* [**Ensure parens around LogicalExpression inside ExperimentalSpreadProperty**](https://github.com/prettier/prettier/pull/2710) by [@existentialism](https://github.com/existentialism) -* [**Fix printing declare modifier for TS enum**](https://github.com/prettier/prettier/pull/2711) by [@existentialism](https://github.com/existentialism) -* [**Handle +/- before numbers in CSS**](https://github.com/prettier/prettier/pull/2713) by [@xtian](https://github.com/xtian) -* [**Add Tradeshift as a user**](https://github.com/prettier/prettier/pull/2719) by [@sampi](https://github.com/sampi) -* [**feat(resolve-config): add `.sync()` method**](https://github.com/prettier/prettier/pull/2722) by [@ikatyang](https://github.com/ikatyang) -* [**refactor(bin): use `resolveConfigFile.sync()`**](https://github.com/prettier/prettier/pull/2728) by [@ikatyang](https://github.com/ikatyang) -* [**refactor(cli): separate files and make it pure as possible**](https://github.com/prettier/prettier/pull/2730) by [@ikatyang](https://github.com/ikatyang) -* [**Fix cosmiconfig dependency branch**](https://github.com/prettier/prettier/pull/2731) by [@josephfrazier](https://github.com/josephfrazier) -* [**Upgrade chalk to v2.1.0**](https://github.com/prettier/prettier/pull/2732) by [@josephfrazier](https://github.com/josephfrazier) -* [**Add CLI option '--config-precedence'**](https://github.com/prettier/prettier/pull/2733) by [@mitermayer](https://github.com/mitermayer) -* [**Normalize CSS case**](https://github.com/prettier/prettier/pull/2736) by [@lydell](https://github.com/lydell) -* [**Make run-external-typescript-tests.js cross-platform**](https://github.com/prettier/prettier/pull/2737) by [@lydell](https://github.com/lydell) -* [**test(integration): add more tests**](https://github.com/prettier/prettier/pull/2738) by [@ikatyang](https://github.com/ikatyang) -* [**chore(deps): remove devDependency `cross-spawn`**](https://github.com/prettier/prettier/pull/2739) by [@ikatyang](https://github.com/ikatyang) -* [**Ignore some things in coverage**](https://github.com/prettier/prettier/pull/2741) by [@lydell](https://github.com/lydell) -* [**Generalize run-external-typescript-tests.js**](https://github.com/prettier/prettier/pull/2742) by [@lydell](https://github.com/lydell) -* [**Improve lint-staged setup example by adding more filetypes**](https://github.com/prettier/prettier/pull/2746) by [@MoOx](https://github.com/MoOx) -* [**fixes dynamic imports**](https://github.com/prettier/prettier/pull/2748) by [@rkurbatov](https://github.com/rkurbatov) -* [**Refactor error handling**](https://github.com/prettier/prettier/pull/2750) by [@azz](https://github.com/azz) -* [**chore(github): add issue template**](https://github.com/prettier/prettier/pull/2755) by [@ikatyang](https://github.com/ikatyang) -* [**Fix: TypeScript never keyword (fixes [#2718](https://github.com/prettier/prettier/pull/2718))**](https://github.com/prettier/prettier/pull/2756) by [@JamesHenry](https://github.com/JamesHenry) -* [**Group last argument if it's an empty object with a comment**](https://github.com/prettier/prettier/pull/2758) by [@duailibe](https://github.com/duailibe) -* [**Use `files:` over `types:` in pre-commit configuration**](https://github.com/prettier/prettier/pull/2759) by [@asottile](https://github.com/asottile) -* [**refactor(runPrettier): reduce duplicate code**](https://github.com/prettier/prettier/pull/2764) by [@ikatyang](https://github.com/ikatyang) -* [**Change when to print ternaries in JSX mode**](https://github.com/prettier/prettier/pull/2768) by [@duailibe](https://github.com/duailibe) -* [**Fix chained logical expressions with objects/array/etc inlined**](https://github.com/prettier/prettier/pull/2770) by [@duailibe](https://github.com/duailibe) -* [**Add option to require @prettier or @format pragma**](https://github.com/prettier/prettier/pull/2772) by [@wbinnssmith](https://github.com/wbinnssmith) -* [**chore(build): update ISSUE_TEMPLATE.md before publish**](https://github.com/prettier/prettier/pull/2776) by [@ikatyang](https://github.com/ikatyang) -* [**Fix break on conditional expressions inside return**](https://github.com/prettier/prettier/pull/2779) by [@duailibe](https://github.com/duailibe) -* [**Support graphql(schema, `query`)**](https://github.com/prettier/prettier/pull/2781) by [@azz](https://github.com/azz) -* [**fix(prettierignore): support absolute filename**](https://github.com/prettier/prettier/pull/2783) by [@ambar](https://github.com/ambar) -* [**Keep conditional expressions in one line on method chains**](https://github.com/prettier/prettier/pull/2784) by [@duailibe](https://github.com/duailibe) -* [**fix(build): update ISSUE_TEMPLATE using regex `?:` instead of `?!`**](https://github.com/prettier/prettier/pull/2785) by [@ikatyang](https://github.com/ikatyang) -* [**Break closing paren of ConditionalExpression in member chains**](https://github.com/prettier/prettier/pull/2786) by [@duailibe](https://github.com/duailibe) -* [**fix webstorm integration guide**](https://github.com/prettier/prettier/pull/2796) by [@xsburg](https://github.com/xsburg) +- [**Update README.md**](https://github.com/prettier/prettier/pull/2690) by [@ikatyang](https://github.com/ikatyang) +- [**Fix config file finding when using stdin**](https://github.com/prettier/prettier/pull/2692) by [@lydell](https://github.com/lydell) +- [**docs(readme): add and sort cli options**](https://github.com/prettier/prettier/pull/2700) by [@levithomason](https://github.com/levithomason) +- [**Add Transloadit as a user**](https://github.com/prettier/prettier/pull/2706) by [@kvz](https://github.com/kvz) +- [**Ensure parens around LogicalExpression inside ExperimentalSpreadProperty**](https://github.com/prettier/prettier/pull/2710) by [@existentialism](https://github.com/existentialism) +- [**Fix printing declare modifier for TS enum**](https://github.com/prettier/prettier/pull/2711) by [@existentialism](https://github.com/existentialism) +- [**Handle +/- before numbers in CSS**](https://github.com/prettier/prettier/pull/2713) by [@xtian](https://github.com/xtian) +- [**Add Tradeshift as a user**](https://github.com/prettier/prettier/pull/2719) by [@sampi](https://github.com/sampi) +- [**feat(resolve-config): add `.sync()` method**](https://github.com/prettier/prettier/pull/2722) by [@ikatyang](https://github.com/ikatyang) +- [**refactor(bin): use `resolveConfigFile.sync()`**](https://github.com/prettier/prettier/pull/2728) by [@ikatyang](https://github.com/ikatyang) +- [**refactor(cli): separate files and make it pure as possible**](https://github.com/prettier/prettier/pull/2730) by [@ikatyang](https://github.com/ikatyang) +- [**Fix cosmiconfig dependency branch**](https://github.com/prettier/prettier/pull/2731) by [@josephfrazier](https://github.com/josephfrazier) +- [**Upgrade chalk to v2.1.0**](https://github.com/prettier/prettier/pull/2732) by [@josephfrazier](https://github.com/josephfrazier) +- [**Add CLI option '--config-precedence'**](https://github.com/prettier/prettier/pull/2733) by [@mitermayer](https://github.com/mitermayer) +- [**Normalize CSS case**](https://github.com/prettier/prettier/pull/2736) by [@lydell](https://github.com/lydell) +- [**Make run-external-typescript-tests.js cross-platform**](https://github.com/prettier/prettier/pull/2737) by [@lydell](https://github.com/lydell) +- [**test(integration): add more tests**](https://github.com/prettier/prettier/pull/2738) by [@ikatyang](https://github.com/ikatyang) +- [**chore(deps): remove devDependency `cross-spawn`**](https://github.com/prettier/prettier/pull/2739) by [@ikatyang](https://github.com/ikatyang) +- [**Ignore some things in coverage**](https://github.com/prettier/prettier/pull/2741) by [@lydell](https://github.com/lydell) +- [**Generalize run-external-typescript-tests.js**](https://github.com/prettier/prettier/pull/2742) by [@lydell](https://github.com/lydell) +- [**Improve lint-staged setup example by adding more filetypes**](https://github.com/prettier/prettier/pull/2746) by [@MoOx](https://github.com/MoOx) +- [**fixes dynamic imports**](https://github.com/prettier/prettier/pull/2748) by [@rkurbatov](https://github.com/rkurbatov) +- [**Refactor error handling**](https://github.com/prettier/prettier/pull/2750) by [@azz](https://github.com/azz) +- [**chore(github): add issue template**](https://github.com/prettier/prettier/pull/2755) by [@ikatyang](https://github.com/ikatyang) +- [**Fix: TypeScript never keyword (fixes [#2718](https://github.com/prettier/prettier/pull/2718))**](https://github.com/prettier/prettier/pull/2756) by [@JamesHenry](https://github.com/JamesHenry) +- [**Group last argument if it's an empty object with a comment**](https://github.com/prettier/prettier/pull/2758) by [@duailibe](https://github.com/duailibe) +- [**Use `files:` over `types:` in pre-commit configuration**](https://github.com/prettier/prettier/pull/2759) by [@asottile](https://github.com/asottile) +- [**refactor(runPrettier): reduce duplicate code**](https://github.com/prettier/prettier/pull/2764) by [@ikatyang](https://github.com/ikatyang) +- [**Change when to print ternaries in JSX mode**](https://github.com/prettier/prettier/pull/2768) by [@duailibe](https://github.com/duailibe) +- [**Fix chained logical expressions with objects/array/etc inlined**](https://github.com/prettier/prettier/pull/2770) by [@duailibe](https://github.com/duailibe) +- [**Add option to require @prettier or @format pragma**](https://github.com/prettier/prettier/pull/2772) by [@wbinnssmith](https://github.com/wbinnssmith) +- [**chore(build): update ISSUE_TEMPLATE.md before publish**](https://github.com/prettier/prettier/pull/2776) by [@ikatyang](https://github.com/ikatyang) +- [**Fix break on conditional expressions inside return**](https://github.com/prettier/prettier/pull/2779) by [@duailibe](https://github.com/duailibe) +- [**Support graphql(schema, `query`)**](https://github.com/prettier/prettier/pull/2781) by [@azz](https://github.com/azz) +- [**fix(prettierignore): support absolute filename**](https://github.com/prettier/prettier/pull/2783) by [@ambar](https://github.com/ambar) +- [**Keep conditional expressions in one line on method chains**](https://github.com/prettier/prettier/pull/2784) by [@duailibe](https://github.com/duailibe) +- [**fix(build): update ISSUE_TEMPLATE using regex `?:` instead of `?!`**](https://github.com/prettier/prettier/pull/2785) by [@ikatyang](https://github.com/ikatyang) +- [**Break closing paren of ConditionalExpression in member chains**](https://github.com/prettier/prettier/pull/2786) by [@duailibe](https://github.com/duailibe) +- [**fix webstorm integration guide**](https://github.com/prettier/prettier/pull/2796) by [@xsburg](https://github.com/xsburg) ### Issues resolved in this release -* [**Document missing CLI options**](https://github.com/prettier/prettier/issues/2698) reported by [@levithomason](https://github.com/levithomason) -* [**Formatting of Spread Properties differs between Babylon and TypeScript**](https://github.com/prettier/prettier/issues/2708) reported by [@mariusschulz](https://github.com/mariusschulz) -* [**Removal of the `declare` modifier from `enum`**](https://github.com/prettier/prettier/issues/2709) reported by [@mariusschulz](https://github.com/mariusschulz) -* [**Decimal formatting doesn't get all decimals in a rule.**](https://github.com/prettier/prettier/issues/2712) reported by [@itsgreggreg](https://github.com/itsgreggreg) -* [**Use resolveConfigFile.sync in the CLI**](https://github.com/prettier/prettier/issues/2726) reported by [@azz](https://github.com/azz) -* [**CSS: Normalize case (lower vs upper) on stuff**](https://github.com/prettier/prettier/issues/2653) reported by [@lydell](https://github.com/lydell) -* [**Dynamic import with webpackChunkName comment fails**](https://github.com/prettier/prettier/issues/1489) reported by [@pbomb](https://github.com/pbomb) -* [**TypeScript: never as type parameter causes error: unknown type: undefined**](https://github.com/prettier/prettier/issues/2718) reported by [@hccampos](https://github.com/hccampos) -* [**commented object values**](https://github.com/prettier/prettier/issues/2617) reported by [@sylvainbaronnet](https://github.com/sylvainbaronnet) -* [**Configuring pre-commit for jsx, TypeScript, tsx**](https://github.com/prettier/prettier/issues/2745) reported by [@reywright](https://github.com/reywright) -* [**JSX ternaries include parens**](https://github.com/prettier/prettier/issues/2729) reported by [@jasonLaster](https://github.com/jasonLaster) -* [**Chained Short Circuit Conditionals in JSX**](https://github.com/prettier/prettier/issues/2714) reported by [@brycehill](https://github.com/brycehill) -* [**Support @prettier pragma comment**](https://github.com/prettier/prettier/issues/2397) reported by [@ajhyndman](https://github.com/ajhyndman) -* [**No indentation after breaking return statement**](https://github.com/prettier/prettier/issues/2777) reported by [@jwbay](https://github.com/jwbay) -* [**Support graphql() fn and so make 2nd arg prettier**](https://github.com/prettier/prettier/issues/2780) reported by [@brikou](https://github.com/brikou) -* [**prettierignore: cannot use absolute filename**](https://github.com/prettier/prettier/issues/2782) reported by [@ambar](https://github.com/ambar) -* [**Weird JavaScript format**](https://github.com/prettier/prettier/issues/2775) reported by [@maxime1992](https://github.com/maxime1992) +- [**Document missing CLI options**](https://github.com/prettier/prettier/issues/2698) reported by [@levithomason](https://github.com/levithomason) +- [**Formatting of Spread Properties differs between Babylon and TypeScript**](https://github.com/prettier/prettier/issues/2708) reported by [@mariusschulz](https://github.com/mariusschulz) +- [**Removal of the `declare` modifier from `enum`**](https://github.com/prettier/prettier/issues/2709) reported by [@mariusschulz](https://github.com/mariusschulz) +- [**Decimal formatting doesn't get all decimals in a rule.**](https://github.com/prettier/prettier/issues/2712) reported by [@itsgreggreg](https://github.com/itsgreggreg) +- [**Use resolveConfigFile.sync in the CLI**](https://github.com/prettier/prettier/issues/2726) reported by [@azz](https://github.com/azz) +- [**CSS: Normalize case (lower vs upper) on stuff**](https://github.com/prettier/prettier/issues/2653) reported by [@lydell](https://github.com/lydell) +- [**Dynamic import with webpackChunkName comment fails**](https://github.com/prettier/prettier/issues/1489) reported by [@pbomb](https://github.com/pbomb) +- [**TypeScript: never as type parameter causes error: unknown type: undefined**](https://github.com/prettier/prettier/issues/2718) reported by [@hccampos](https://github.com/hccampos) +- [**commented object values**](https://github.com/prettier/prettier/issues/2617) reported by [@sylvainbaronnet](https://github.com/sylvainbaronnet) +- [**Configuring pre-commit for jsx, TypeScript, tsx**](https://github.com/prettier/prettier/issues/2745) reported by [@reywright](https://github.com/reywright) +- [**JSX ternaries include parens**](https://github.com/prettier/prettier/issues/2729) reported by [@jasonLaster](https://github.com/jasonLaster) +- [**Chained Short Circuit Conditionals in JSX**](https://github.com/prettier/prettier/issues/2714) reported by [@brycehill](https://github.com/brycehill) +- [**Support @prettier pragma comment**](https://github.com/prettier/prettier/issues/2397) reported by [@ajhyndman](https://github.com/ajhyndman) +- [**No indentation after breaking return statement**](https://github.com/prettier/prettier/issues/2777) reported by [@jwbay](https://github.com/jwbay) +- [**Support graphql() fn and so make 2nd arg prettier**](https://github.com/prettier/prettier/issues/2780) reported by [@brikou](https://github.com/brikou) +- [**prettierignore: cannot use absolute filename**](https://github.com/prettier/prettier/issues/2782) reported by [@ambar](https://github.com/ambar) +- [**Weird JavaScript format**](https://github.com/prettier/prettier/issues/2775) reported by [@maxime1992](https://github.com/maxime1992) --- diff --git a/website/blog/2017-12-05-1.9.0.md b/website/blog/2017-12-05-1.9.0.md index ab6068ec9..87b0922fd 100644 --- a/website/blog/2017-12-05-1.9.0.md +++ b/website/blog/2017-12-05-1.9.0.md @@ -33,8 +33,8 @@ foo => {}; This lead to the [most commented thread](https://github.com/prettier/prettier/issues/812) in our issue tracker. Prettier now has the `--arrow-parens` option (`arrowParens` in the config) that can assume two values today: -* `"avoid"` - (default) preserve the behavior that omits parens when possible -* `"always"` - always includes parens +- `"avoid"` - (default) preserve the behavior that omits parens when possible +- `"always"` - always includes parens #### JSX fragment syntax ([#3237](https://github.com/prettier/prettier/pull/3237)) by [@duailibe](https://github.com/duailibe) @@ -117,9 +117,9 @@ CSS is mostly case insensitive, so Prettier has been lowercasing stuff for a whi It's taken a while, but Prettier will finally respect your `.editorconfig` file. This includes: -* `indent_style` -* `indent_size`/`tab_width` -* `max_line_length` +- `indent_style` +- `indent_size`/`tab_width` +- `max_line_length` The `prettier` CLI respects `.editorconfig` by default, but you can opt out with `--no-editorconfig`. However, the API _doesn't_ respect `.editorconfig` by default, in order to avoid potential editor integration issues (see [here](https://github.com/prettier/prettier/pull/3255#discussion_r152259674) for details). To opt in, add `editorconfig: true` to the `prettier.resolveConfig` options. diff --git a/website/blog/2018-01-10-1.10.0.md b/website/blog/2018-01-10-1.10.0.md index 4e76f965f..fcfc07bfd 100644 --- a/website/blog/2018-01-10-1.10.0.md +++ b/website/blog/2018-01-10-1.10.0.md @@ -78,9 +78,9 @@ Using plugins is as simple as installing them via `npm`/`yarn`, and running Pret There are three official plugins under development: -* [`@prettier/plugin-python`](https://github.com/prettier/prettier-python) -* [`@prettier/plugin-php`](https://github.com/prettier/prettier-php) -* [`@prettier/plugin-swift`](https://github.com/prettier/prettier-swift) +- [`@prettier/plugin-python`](https://github.com/prettier/prettier-python) +- [`@prettier/plugin-php`](https://github.com/prettier/prettier-php) +- [`@prettier/plugin-swift`](https://github.com/prettier/prettier-swift) All three of these plugins are still under active development and aren't ready to throw production code at, but keep an eye on them as they're progressing! @@ -410,8 +410,8 @@ $ prettier --loglevel silent --write test.js We've fixed up the behavior of the CLI when it comes to ignored files. Previously when a file was ignored by `.prettierignore`, the CLI would ouput nothing. This affected editor integrations. The behaviour is now: -* With `--write`, don't read or write to the ignored file. -* Without `--write`, read the ignored file and output as-is. +- With `--write`, don't read or write to the ignored file. +- Without `--write`, read the ignored file and output as-is. ### Editor Integrations diff --git a/website/blog/2018-04-09-plugin-php-0.1.md b/website/blog/2018-04-09-plugin-php-0.1.md index 4b8491cd8..c13fd937a 100644 --- a/website/blog/2018-04-09-plugin-php-0.1.md +++ b/website/blog/2018-04-09-plugin-php-0.1.md @@ -12,9 +12,9 @@ After more than 200 merged pull requests since mid December 2017, we're happy to Adding support for a new language to Prettier requires two things: -* A parser, which turns your source code into an abstract syntax tree (AST). Since Prettier is written in JavaScript, we're using [php-parser](https://github.com/glayzzle/php-parser), which is a PHP parser written in JS. +- A parser, which turns your source code into an abstract syntax tree (AST). Since Prettier is written in JavaScript, we're using [php-parser](https://github.com/glayzzle/php-parser), which is a PHP parser written in JS. -* A printer, that turns the AST into a special format called `doc` that Prettier requires to do its magic. It is basically your source code plus some information about where linebreaks can be added, how it should be indented, and so on. +- A printer, that turns the AST into a special format called `doc` that Prettier requires to do its magic. It is basically your source code plus some information about where linebreaks can be added, how it should be indented, and so on. While we could benefit from existing work on the parsing side, the printer had to be developed from scratch to support all of PHP's various AST node types. Our first alpha release today means that we are confident that the printer can re-print your code without breaking it. @@ -44,7 +44,7 @@ For our first stable release, the following milestones still have to be reached: Are you excited about Prettier for PHP? Then we'd love you to help us reach our first stable release by -* Trying it on your code base -* [Reporting any issues](https://github.com/prettier/plugin-php/issues) you find with it -* Contributing ([how to get started](https://github.com/prettier/plugin-php/blob/master/CONTRIBUTING.md)) -* Spreading the word 😉 +- Trying it on your code base +- [Reporting any issues](https://github.com/prettier/plugin-php/issues) you find with it +- Contributing ([how to get started](https://github.com/prettier/plugin-php/blob/master/CONTRIBUTING.md)) +- Spreading the word 😉 diff --git a/website/blog/2018-05-23-1.13.0.md b/website/blog/2018-05-23-1.13.0.md index e27638e6f..a972f6887 100644 --- a/website/blog/2018-05-23-1.13.0.md +++ b/website/blog/2018-05-23-1.13.0.md @@ -39,8 +39,8 @@ Read more about it in the [docs](https://prettier.io/docs/en/browser.html). In Prettier 1.12 and earlier, when running Prettier on a file without a file extension, Prettier would assume the file contained JavaScript. This lead to a couple of confusing bugs, namely: -* If you ran prettier on your `.git` directory, it would reformat files and break your git repo. -* If you tried to run prettier on html files, it would sometimes throw an error, but other times parse the HTML as JSX, and format it as if it was JSX (which was often unsafe). +- If you ran prettier on your `.git` directory, it would reformat files and break your git repo. +- If you tried to run prettier on html files, it would sometimes throw an error, but other times parse the HTML as JSX, and format it as if it was JSX (which was often unsafe). In Prettier 1.13, we are changing this behavior. If Prettier cannot determine what language a file is from its extension, and the user has not manually specified a parser to use, Prettier will skip the file. @@ -294,21 +294,21 @@ These JS features were already supported when using the default Babylon parser, New features added to Flow are now supported by Prettier: -* inline interfaces +- inline interfaces ```ts type A = interface { p: string}; ``` -* explicit type arguments +- explicit type arguments ```ts fnCall("name"); ``` -* proto modifier syntax +- proto modifier syntax ```ts @@ -323,11 +323,11 @@ A new feature added in TypeScript 2.9 for describing the shapes of a module impo ```ts // Input -export const x:import( "./foo" )={x:0,y:0}; +export const x: import("./foo") = { x: 0, y: 0 }; -export let y:import("./foo2" ).Bar.I={a:"",b:0}; +export let y: import("./foo2").Bar.I = { a: "", b: 0 }; -export let shim:typeof import( "./foo2")={Bar: Bar2}; +export let shim: typeof import("./foo2") = { Bar: Bar2 }; // Output with Prettier 1.13 export const x: import("./foo") = { x: 0, y: 0 };