Commit Graph

2849 Commits (b878a54e6addbc6ea745ea089549d241edb048e7)

Author SHA1 Message Date
Ika 0878a6a3e7
fix(less): remove CRs from inline comments (#5334)
The issue here is that less parser somehow included CRs in `comment.raws.content`, but it was hidden by the wrong trailing space elimination previously, which was fixed by #5165.

We already have such tests but it's not reproducible in AppVeyor since they use LF ([`core.autocrlf=input`](https://stackoverflow.com/a/20653073)).
2018-11-04 11:36:14 +08:00
Simon Lydell 275b0543c8
Never put spaces to the right of stars in indentable block comments (#5330)
Fixes #5323. Previously we added space after `/*` _on the first line
only,_ but the intent is to only fix the indentation of comments, not
changing their "contents". Besides, this was inconsistent with the
handling of every following line. Finally, it broke `/*!` comments which
some minifiers look for to know which (license) comments to keep.

People can use https://eslint.org/docs/rules/spaced-comment to enforce
when to start comments with spaces.
2018-11-03 20:53:24 +01:00
Onur Temizkan f6d8be881c fix(css-in-js) Keep newlines in CSS-in-JS Templates (Fixes: #5147) (#5240)
* fix(css-in-js) Keep newlines in CSS-in-JS Templates (Fixes: #5147)

* Add more tests

* Do not add semicolon when CSS prop is a template variable

* Fix deletion of original semicolon

* Prettify long line
2018-11-01 21:58:16 +02:00
Jaiden Gerig 0799280429 Fixed unstable comment between function declaration and block statement (#5250) 2018-11-01 21:55:33 +02:00
Calum Lind b8ebcd910c Add YAML file extensions to pre-commit hooks config (#5182)
- Prettier support YAML but pre-commit hook was not checking those
  files so added file extensions to hooks config.
- Used double-quoted flow scalar style to make the list of file
  extensions easier to read. Backslash for regex needed escaping and
  backslash each line to prevent YAML including spaces.
- Added alternative markdown file extensions.
2018-11-02 00:21:51 +08:00
Nathan Totten cce4a2683a Added Apex plugin (#5318) 2018-10-31 17:08:56 +02:00
Beau Smith a34b9701e5 Website and Playground Setup and Run Instructions (#5312)
Update readme with steps to setup and run locally. 

Removed note about the need to run two separate processes because `yarn start` was [updated to concurrently runs both processes](ef932741ad (diff-07f3a4647460e74f9514d8def137963a)).
2018-10-31 09:07:20 +08:00
Andrey Okonetchnikov 7238ceffab docs: Remove the warning about partially staged files (#5310)
Since partially staged files are now officially supported, this isn't up to date anymore.
2018-10-29 09:16:28 -03:00
Sibiraj 2402a2a07b build: update editorconfig to resolve a deprecated warning (#5307)
This resolves a deprecated warning when installing prettier.

[image](https://user-images.githubusercontent.com/20282546/47603753-0995a700-da0e-11e8-9c89-61e0ff3d13c9.png)
2018-10-28 15:01:53 +08:00
Ika 907c5cab72
chore(yarn): disable integrity migration
Yarn v1.10 adds `integrity`s but v1.9 removes them.
Add this option to prevent them from adding unnecessary diffs all the time.
This is the default value for Yarn v1.12+ (ref: yarnpkg/yarn#6465).
2018-10-27 21:01:26 +08:00
Jordan Brown b861448dbf Pretty print inexact (#5304) 2018-10-26 21:05:42 +03:00
Jordan Brown 5d47e02f64 Update flow parser to 0.84.0 (#5303) 2018-10-26 22:14:47 +08:00
Beau Smith 6e0de08122 User can copy JSON config from Playground. (#5295) 2018-10-25 17:41:08 -04:00
Aquib Master 1234ceb1d6 Fix flow extends not breaking out into new lines (#5244) 2018-10-25 10:49:53 -04:00
Jaiden Gerig 2cc32da5af Fixed unstable while comment (#5251)
* Fixed unstable while comment

* Aligned while loop formatting more closely with if statment formatting
2018-10-25 10:48:09 -04:00
Ashwin Bhat 253716dd49 Fix Flow generic comment positioning (#5290)
* add test for ensuring that calls with zero arguments look right
2018-10-25 08:44:16 -04:00
Jed Fox 6a174654a4 Fix indentation of block comments where every line starts with a star (#5206)
Previously this was done only for JSDoc comments. Now it's done in a few additional cases.
2018-10-23 21:04:24 +02:00
Ashwin Bhat 4d4fab39fe Add support for flow typecast comments (#5280)
* Add support for flow typecast comments

* Allow whitespace between comment start and colon

Also rename flow-comments.js to utils.js

* fix bug where type annotations could be accidentally created

* use better regex in detecting flow comment whitespace

* fix comment in utils.js

* simplify conditionals and improve comments

* fix lint error
2018-10-23 10:46:20 -04:00
Gilles Debunne 559831d08e Update husky integration code for husky v1.0.0 (#5266)
Latest husky (version 1.0.0) moved its hooks config from the `scripts` field to a new `husky` field in `package.json` ([ChangeLog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)).

The `scripts` syntax described here, although shorter, will be deprecated soon. This change replaces it with the new husky syntax.

The new syntax is already used in [precommit.md](https://github.com/prettier/prettier/blob/master/docs/precommit.md).
2018-10-21 23:28:19 +08:00
Lucas Azzola d1d1f17157
Update some plugin links (#5282)
Looks like they were overlooked.
2018-10-20 12:40:09 +11:00
Lucas Duailibe 62e4654e60
Respect original text decorator order (#5207) 2018-10-17 14:14:59 -03:00
Evilebot Tnawi 023a8b78df feat: more shared utils for plugins (#5254) 2018-10-17 07:53:38 -07:00
Chris Adams 4cc0363b40 Remove HTML from pre-commit hooks until available (#5274)
The pre-commit hook registers for HTML files but that will always fail until #5098 is completed. This means that anyone following [the instructions](https://prettier.io/docs/en/precommit.html#option-3-pre-commit-https-githubcom-pre-commit-pre-commit) will have the hook fail any time they attempt to commit an HTML file.
2018-10-17 08:40:04 +08:00
Raphael Boidol 59c075b311 [ImgBot] optimizes images (#5261)
*Total -- 1,155.42kb -> 742.94kb (35.7%)

/website/static/images/users/iress-200x100.png -- 78.46kb -> 4.68kb (94.03%)
/website/static/images/users/assertible-200x100.png -- 31.41kb -> 2.68kb (91.47%)
/website/static/images/users/sevenspan-200x100.png -- 19.97kb -> 5.77kb (71.09%)
/website/static/icon.png -- 4.47kb -> 1.72kb (61.45%)
/website/static/images/users/zipch-200x100.png -- 3.91kb -> 1.64kb (58.04%)
/website/static/images/users/discord-200x100.png -- 3.18kb -> 1.42kb (55.5%)
/website/static/images/users/nrwl-200x100.png -- 25.42kb -> 11.47kb (54.89%)
/website/static/images/users/loyaltylion-200x100.png -- 5.14kb -> 2.49kb (51.58%)
/website/static/images/users/drizly-200x100.png -- 7.02kb -> 3.44kb (50.94%)
/website/static/images/users/mathrioshka-200x100.png -- 37.09kb -> 19.25kb (48.1%)
/website/static/images/users/troops-200x100.png -- 6.75kb -> 3.54kb (47.61%)
/website/static/images/languages/markdown-128px.png -- 3.66kb -> 1.93kb (47.29%)
/website/static/images/users/eyesquare-200x100.png -- 10.26kb -> 5.49kb (46.53%)
/website/static/images/editors/webstorm-128px.png -- 6.64kb -> 3.77kb (43.18%)
/website/static/images/editors/atom-128px.png -- 8.66kb -> 5.07kb (41.45%)
/website/static/images/users/lifesum-200x100.png -- 12.70kb -> 7.45kb (41.33%)
/website/static/images/users/brigad-200x100.png -- 13.67kb -> 8.06kb (41.02%)
/website/static/images/users/holidaycheck-200x100.png -- 13.79kb -> 8.30kb (39.81%)
/website/static/images/users/outreach-200x100.png -- 8.52kb -> 5.36kb (37.13%)
/website/static/images/users/hudl-200x100.png -- 8.77kb -> 5.56kb (36.66%)
/website/static/images/editors/visualstudio-128px.png -- 3.13kb -> 1.98kb (36.62%)
/website/static/images/languages/js-128px.png -- 3.34kb -> 2.12kb (36.62%)
/website/blog/assets/github-diff-ternary-in-jsx.png -- 67.71kb -> 44.43kb (34.37%)
/website/static/images/users/getonboard-200x100.png -- 5.53kb -> 3.74kb (32.43%)
/website/static/images/users/hackclub-200x100.png -- 7.90kb -> 5.44kb (31.13%)
/website/static/prettier.png -- 16.74kb -> 11.61kb (30.62%)
/docs/assets/youtube-cover/a-prettier-printer-by-james-long-on-react-conf-2017.png -- 328.21kb -> 230.23kb (29.85%)
/website/static/images/users/transloadit-200x100.png -- 10.47kb -> 7.47kb (28.66%)
/website/static/images/users/paypal-200x100.png -- 12.50kb -> 8.94kb (28.5%)
/website/static/images/users/mongodb-200x100.png -- 9.72kb -> 6.99kb (28.08%)
/website/static/images/languages/graphql-128px.png -- 8.10kb -> 5.85kb (27.71%)
/docs/assets/youtube-cover/javascript-code-formatting-by-christopher-chedeau-on-react-london-2017.png -- 137.75kb -> 100.08kb (27.34%)
/website/static/images/users/codemix-200x100.png -- 3.82kb -> 2.87kb (24.92%)
/website/static/images/users/m6web-200x100.png -- 21.61kb -> 16.69kb (22.78%)
/website/static/images/users/yelp-200x100.png -- 10.59kb -> 8.23kb (22.35%)
/website/static/images/users/react-200x100.png -- 6.72kb -> 5.23kb (22.13%)
/website/static/images/users/babel-200x100.png -- 15.44kb -> 12.08kb (21.76%)
/website/static/images/users/freelancer-200x100.png -- 5.86kb -> 4.74kb (19.08%)
/website/static/images/users/ideati-200x100.png -- 4.05kb -> 3.29kb (18.62%)
/website/static/images/users/yarn-200x100.png -- 5.75kb -> 4.71kb (18.07%)
/website/static/images/users/talkable-200x100.png -- 3.07kb -> 2.56kb (16.63%)
/website/static/images/users/webpack-200x100.png -- 5.13kb -> 4.44kb (13.49%)
/website/static/images/users/escrow-200x100.png -- 7.47kb -> 6.48kb (13.25%)
/website/static/images/users/moonmail-200x100.png -- 5.69kb -> 4.96kb (12.87%)
/website/static/images/users/jest-200x100.png -- 3.26kb -> 2.84kb (12.86%)
/website/static/images/editors/vim-128px.png -- 13.85kb -> 12.16kb (12.19%)
/website/static/images/users/nhl-200x100.png -- 11.18kb -> 9.85kb (11.92%)
/website/static/images/editors/emacs-128px.png -- 21.24kb -> 18.90kb (11.03%)
/website/static/images/users/jane-200x100.png -- 4.14kb -> 3.70kb (10.71%)
/website/static/images/users/webflow-200x100.png -- 4.51kb -> 4.08kb (9.49%)
/website/static/images/users/storybook-200x100.png -- 6.04kb -> 5.49kb (9.11%)
/website/static/images/editors/vscode-128px.png -- 14.85kb -> 13.53kb (8.9%)
/website/static/images/editors/sublimetext-128px.png -- 6.83kb -> 6.39kb (6.55%)
/website/static/images/users/zeit-200x100.png -- 0.94kb -> 0.88kb (6.45%)
/website/static/images/users/smooth-code-200x100.png -- 9.16kb -> 8.66kb (5.49%)
/website/static/images/languages/css-128px.png -- 7.21kb -> 6.87kb (4.79%)
/website/static/images/users/rnfirebase-200x100.png -- 8.63kb -> 8.26kb (4.28%)
/website/static/images/editors/espresso-128px.png -- 22.42kb -> 21.78kb (2.84%)
/website/static/images/users/monei-200x100.png -- 5.35kb -> 5.31kb (0.75%)
2018-10-16 15:07:33 -03:00
Vojtech Novak caa7b425b7 Update eslint.md (#5276) 2018-10-16 14:11:14 -03:00
Lucas Duailibe 00004daf84
Break nested TSConditionalType (#5272) 2018-10-15 13:35:37 -03:00
Suchipi 0fa34b2c63 Print nested ternaries differently (#5039) 2018-10-14 12:45:37 -03:00
Jed Fox b61fec6091
Fix <Language showName /> prop type (#5265)
There isn‘t a `boolean` prop type, so this was throwing an error when Netlify built the site.
2018-10-14 08:03:35 -04:00
Lucas Duailibe c7093cb3e4
Add ASI protection for TSNonNullExpression (#5262) 2018-10-13 20:03:51 -03:00
Ika dd4687e7ef
feat(html): whitespace-sensitive formatting (#5168)
- whitespace-sensitive formatting 
  - respect css `display: block`/`white-space: pre` (data from [`html-styles`](https://github.com/marionebl/html-styles))
  - support magic comment (`<!-- display: block -->`)
  - add an option to specify whitespace sensitivity (`--html-whitespace-sensitivity <css|strict|ignore>`)
    - magic comments take precedence
    - (default) `css`: respect default css style (safe in the most cases)
    - `strict`: every node is considered whitespace sensitive (the safest)
    - `ignore`: every node is considered whitespace insensitive (dangerous, the original behavior)
  - inline inline-tags 
- support ie conditional comment (`<!--[if IE]><![endif]-->`)
- indent the script/style content
- no inconsistent output for 2+ attributes
- force break tag if there're multiline attributes
2018-10-13 13:55:38 +08:00
Aquib Master 3369be0ca2 Fix comment issue with try finally (#5252) 2018-10-12 12:48:49 -04:00
Jed Fox 65b2454dd8
Improved object-break heuristic (#5205) 2018-10-12 12:45:30 -04:00
Kevin Gibbons cbcd24a5b2 Correct parentheses for mixed exp/mod (#5243)
Fixes #5238.

cc @duailibe for the [original change](https://github.com/prettier/prettier/pull/4413). I basically undid that PR because it didn't look to me like `shouldFlatten` made sense as the place to introduce the behavior it was going for, but I might have misunderstood something.
2018-10-12 12:33:47 -04:00
Ika 3056c5a5c0
fix(yaml): escape quotes correctly (#5236) 2018-10-11 14:31:18 +08:00
Lucas Duailibe ed6a2d9055
Prevent JSX from breaking a logical expression chain (#5092) 2018-10-10 14:11:37 -03:00
Ika bb5a116b4f
fix(markdown): preserve inline math style (#5220) 2018-10-10 09:46:58 +08:00
Lucas Duailibe b5fd382fe8
Inline the arguments of an arrow function in the body is conditional expression (#5209) 2018-10-08 19:28:58 -03:00
Lucas Duailibe ce952fc8c1
Fix printing of catch clause with a comment (#5202) 2018-10-08 14:18:30 -03:00
Lucas Duailibe 303f344bff
Keep decorators inline if they were written inline (#5188) 2018-10-08 11:00:43 -03:00
Jeremy Kairis 8979b47630 Fix a typo in precommit.md Option 4. (#5196)
* Fix a typo in precommit.md Option 4.

* Remove the a
2018-10-07 07:42:41 -04:00
Ika d9ddbe215e docs: fix linting 2018-10-06 20:20:41 +08:00
Warren Seine 7920e6fdde Add a new `trim` command to trim whitespaces in the current line (#4772) 2018-10-06 20:18:52 +08:00
Mahir Shah 30ec30daa9 Escape Quotes in Glimmer String Literals (#5143) 2018-10-05 22:19:33 +02:00
Jed Fox e9cde7d8d4
Adjust badges on the README (#5189)
* Fix spacing around badges

* Switch the npm downloads badge to weekly

I switched to a weekly statistic since it feels more immediate and “9M/m” is somewhat confusing.
2018-10-05 14:06:53 -04:00
Qiming zhao 6b294affa4 Add coc-prettier (#5191) 2018-10-05 11:41:51 -06:00
Lucas Duailibe 31c92a7237
Fix comment in variable declarator (#5190) 2018-10-05 08:40:16 -03:00
Petter 1244729ad7 Infer via shebang (#5149)
If no file type can be inferred, this attempts to read the first line of a file and extract a shebang, which can be checked against a known list.
2018-10-05 08:47:23 +08:00
Ben Scott ea0954995d Update link to stylelint-prettier (#5186)
It belongs to the prettier organization now
2018-10-03 22:11:36 -04:00
Brian Ng 2283efb437
Fix parens around ternary inside OptionalMemberExpression (#5179) 2018-10-02 20:45:15 -05:00
Brian Ng 5315e6fe7a
Bump babel-related deps (#5180) 2018-10-02 20:44:54 -05:00