Lucas Azzola
3474056b36
fix(typescript): handle ObjectPattern instead of ObjectExpression inside BinaryExpression, fixes #2237 ( #2238 )
2017-06-23 07:53:42 -07:00
Lucas Azzola
b2d5366897
Remove apostrophe from JetBrains
2017-06-23 23:01:12 +10:00
Chaim Lando
f519c5f030
Add table of contents ( #2230 )
...
* add toc
* Wrap table of contents in <details> tag
2017-06-23 20:52:46 +10:00
Karl O'Keeffe
0cc0ebc3bc
Allow JSX lines to be recombined ( #1831 )
...
* Allow JSX lines to be recombined
* Add test case for `<br />` breaking expression
* Fix issue where JSX whitespace could be dropped
* Newlines were incorrectly being preserved when JSX contained text
2017-06-22 09:19:44 -07:00
Christopher Chedeau
39954f7951
Handle conditions inside of a ternary ( #2228 )
...
Fixes #2122
2017-06-21 18:17:30 -07:00
Christopher Chedeau
ec1b672bbf
Don't indent + in object value ( #2227 )
...
This is a "regression" from when we started using the same heuristic for `=` and `:`
Fixes #2129
2017-06-21 15:58:12 -07:00
Christopher Chedeau
c36dd48339
First try scss when there's an @import with comma ( #2225 )
...
It's annoying that the less parser is so lenient that it drops things instead of throwing :(
Fixes #2125
2017-06-21 15:45:55 -07:00
Christopher Chedeau
aac0d1dda0
Support inline template for new calls ( #2222 )
...
I merged the implementation of new and call expressions in this PR.
Fixes #2215
2017-06-21 15:45:44 -07:00
Joseph Frazier
63c47c85e0
JSON: Print trailing newline ( #2226 )
...
* JSON: Append trailing newline
This partially addresses https://github.com/prettier/prettier/issues/2223
* Dedupe printing of JSON trailiing newline
* JSON: Add tests for newlines after boolean/null/number/string
* JSON: Fix tests for newlines after boolean/null/number/string, simplify code
This fixes https://github.com/prettier/prettier/issues/2223
2017-06-21 15:40:19 -07:00
Christopher Chedeau
08060e7c94
Use fill for CSS values ( #2224 )
...
This looks less weird to have them flow as they fit than breaking on every single line.
Fixes #2213
2017-06-21 15:13:51 -07:00
Karl O'Keeffe
04c41f6758
Fix up empty JSX element detection ( #2220 )
2017-06-21 13:48:02 -07:00
Lucas Azzola
e78e07e2ad
refactor(multiparser): move css expression doc printing to transformCssDoc ( #2214 )
2017-06-21 13:41:24 -07:00
Christopher Chedeau
767138ce6c
Remove node 6 from the test matrix
...
It has never caught any issue in practice and is making the whole test suite consume 1/3 more cpu as a result.
2017-06-21 13:39:45 -07:00
Joe Critchley
5c61036fab
Added definition of 'style' to README ( #2221 )
2017-06-21 13:34:34 -07:00
Christopher Chedeau
313519d8ae
Allow long media rules to break ( #2219 )
...
Fixes #2198
2017-06-21 13:02:16 -07:00
Simon Lydell
e8fb9bddf7
Fix type in README.md
2017-06-21 20:12:18 +02:00
Christopher Chedeau
810ed8857c
Update README.md
2017-06-21 10:44:53 -07:00
Simon Fridlund
0fbf23c1ee
Turn off trailing comma for json ( #2216 )
2017-06-21 09:04:39 -07:00
Joseph Frazier
785970a265
Use eslint-friendly-formatter to make errors clickable ( #2200 )
...
This changes the eslint error formatting from:
/Users/josephfrazier/workspace/prettier/src/printer-postcss.js
3:31 error Insert `;` prettier/prettier
to:
✘ prettier/prettier Insert `;`
src/printer-postcss.js:3:31
const util = require("./util")
^
which makes them clickable in terminals like iTerm2 and Guake. See
[eslint-friendly-formatter] for details.
[eslint-friendly-formatter]: https://github.com/royriojas/eslint-friendly-formatter
2017-06-20 18:38:33 -07:00
Simon Fridlund
b0a790017b
Turn allowImportExportEverywhere on ( #2207 )
...
This allows prettier to be used in environments which supports nested import statments, Meteor for example.
2017-06-20 14:42:58 -07:00
Brian Ng
7cef77433a
Bump babylon version ( #2205 )
2017-06-20 08:36:14 -07:00
Lucas Azzola
43521565e7
CSS: lowercase hex colors, closes #2139 ( #2203 )
2017-06-20 23:07:31 +10:00
suǝʞǝǝpʇ
16db5971f0
Fix css-modules composes breaking with long line width ( #2190 )
...
* fix(css): css-modules composes breaking
* refactor(css): to use removeLines in case of composes
2017-06-18 23:41:10 -10:00
Joseph Frazier
3769cbe5bb
Fix typos in ./editors/vim/README.md
2017-06-18 18:06:20 -04:00
Jon Wong
1511609c01
Support for printing GraphQL comments ( #2187 )
...
* save point
* prettier
* Reverting change to check SOF and EOF
* Removing console.log
* Fixing grouping
* Adding comment output
* Basic comments
* Printing comments
* Getting comments to work
* Adding in basic handling of graphql comments
* Removing parser normalization (i assume it'll be added with language support)
* Lint error
* Reverting special cases
* Dealing with off-by-one error
2017-06-18 07:37:52 -10:00
Lucas Azzola
eccb17495a
Website: speed up load time, enable service worker ( #2172 )
...
* feat(website): speed up website load 💥
* chore(package): fix bad merge
2017-06-18 20:25:27 +10:00
EddiG
4106a69b6d
Improvements in Vim Prettier manual ( #2188 )
...
* Fix incorrect command in Vim Prettier manual
* Make clarification in command description in Vim Prettier manual
2017-06-18 10:21:44 +02:00
Lucas Azzola
58413cde3e
docs(readme): use unordered lists in options section
2017-06-18 15:41:22 +10:00
Lucas Azzola
af90402aab
docs(readme): join API and CLI columns to prevent overflow
2017-06-18 15:25:24 +10:00
Lucas Azzola
21f913cb6e
CLI: ignore node_modules with ./**-style glob, fixes #2110 ( #2185 )
2017-06-18 14:35:42 +10:00
Lucas Azzola
82a0bb5c5e
fix(typescript): upgrade tsep, fixes #2143 ( #2183 )
2017-06-17 17:10:22 -10:00
Joseph Frazier
69808cebfb
Format JSON literals like object literals ( #2181 )
...
* Format JSON literals like object literals
Following up on commit a42db30
(https://github.com/prettier/prettier/issues/2173 ),
this change makes it so that literals in JSON files are formatted as
they would be in an object literal. This normalizes trailing zeroes,
exponential notation, unnecessarily escaped characters, etc.
It works by using babylon to parse literals as expressions, and putting
the result in the AST instead of a `json-literal` node. Since JSON
string literals have to be double-quoted, there's a new
`__prettier__isJson` flag on each node, which is used by the printer to
force double-quotes.
* json: Check options.parser when formatting StringLiteral
This is instead of having a custom AST property. See
https://github.com/prettier/prettier/pull/2181#discussion_r122578251
* multiparser: Use babylon.parseExpression
See https://github.com/prettier/prettier/pull/2181#discussion_r122578354
* json: Don't split result AST node into two
See https://github.com/prettier/prettier/pull/2181#discussion_r122578499
* json: Don't use babylon parser to build expression nodes
See https://github.com/prettier/prettier/pull/2181#discussion_r122579052
* Revert "multiparser: Use babylon.parseExpression"
This reverts commit 3d7a4362880d39fac0cea88b5d0186a29538cf6f.
* Remove unused parameter from babylon parser
* json: Remove unused constructorTypes
2017-06-17 20:49:22 -04:00
Joseph Frazier
532ac0d3f8
Build/test dist/ on Travis ( #2176 )
...
This helps us keep track of whether or not the dist/ build actually
works (see https://github.com/prettier/prettier/pull/2174 ). Note that
the dist/ jobs are allowed to fail, and do not affect overall build
time, so they shouldn't slow anything down (see
https://blog.travis-ci.com/2013-11-27-fast-finishing-builds/ ).
2017-06-17 13:37:51 -10:00
Joseph Frazier
33a1c713d5
Dedupe copy/pasted code in build.sh ( #2179 )
2017-06-17 11:39:30 -10:00
Joseph Frazier
d46b778dba
Add json parser to dist/ build ( #2178 )
...
This fixes the build, as shown by:
yarn build
yarn test --prod -- tests/json/
2017-06-17 17:09:48 -04:00
Joseph Frazier
a42db30946
Add JSON support ( #2173 )
...
* Add JSON support
This fixes https://github.com/prettier/prettier/issues/1973 by using
[json-to-ast] to parse JSON, then converting the AST into a
mostly-Babylon AST, so as to piggyback on the existing printer logic.
Identifiers and literals are currently printed verbatim from the input,
but this could be improved upon later (at least for literals, not sure
about identifiers).
[json-to-ast]: https://github.com/vtrushin/json-to-ast
* Rename `json-to-ast` parser to `json`
See https://github.com/prettier/prettier/pull/2173#discussion_r122574644
* json: Use createError to have a pretty error
See https://github.com/prettier/prettier/pull/2173#discussion_r122574748
* json: Transform AST without mutations
See https://github.com/prettier/prettier/pull/2173#discussion_r122574690
2017-06-17 10:36:42 -10:00
Joseph Frazier
59a294fcc9
Fix dist/ build by upgrading typescript to nightly ( #2174 )
...
Before, this error happened upon `yarn build`:
🚨 (commonjs plugin) Binding arguments in strict mode (49161:16) in /Users/josephfrazier/workspace/prettier/node_modules/typescript/lib/typescript.js
2017-06-17 09:00:21 -10:00
Joseph Frazier
fe8cc68e56
Fix dist/ build on machines that don't support `sed -i ''` ( #2175 )
...
Here's an example of the error that happens upon `yarn build`:
sed: can't read : No such file or directory
2017-06-17 08:59:45 -10:00
Iaroslav Voloshchuk
89971285e4
Move devDependencies to dependencies ( #2124 )
...
fixes https://github.com/prettier/prettier/issues/2121
* move runtime deps to npm deps
* Fix (dev)dependencies
See https://github.com/prettier/prettier/pull/2124#discussion_r121795774
* Remove dependencies from dist/package.json
See https://github.com/prettier/prettier/pull/2124#issuecomment-308259138
2017-06-17 10:36:50 -04:00
Lucas Azzola
bff28023b3
Comments: attach method name comments with estree parsers, fixes #2141 ( #2170 )
2017-06-17 22:22:39 +10:00
Lucas Azzola
c669a1db72
TypeScript: group function params in call/construct signatures, fixes #2163 ( #2169 )
2017-06-17 12:09:18 +10:00
Stephen Wan
a005211c96
Fix extra semicolon in ambient typescript declaration emit ( #2165 ) ( #2167 )
...
* fix(typescript): add failing ambient declaration test
* fix(typescript): fix failing test case for ambient function exports
2017-06-16 08:20:59 -10:00
Lucas Azzola
7e60d70f97
fix(typescript): always break interfaces onto multiple lines, fixes #2159 ( #2161 )
2017-06-15 14:34:54 -10:00
Joseph Frazier
aedc6d4269
Add integration test of invalid syntax ( #2160 )
2017-06-16 09:10:39 +10:00
James Henry
d8f29d2d5b
Update tsep ( #2153 )
...
* [WIP] Update tsep
* Fix TypeParameter union parens
2017-06-15 08:55:23 -10:00
James Henry
0410949984
Lock tsep to specific commit ( #2152 )
2017-06-15 22:45:38 +10:00
Lucas Azzola
9e7b02d50e
Print {} in import if it's in the source, fixes #2145 ( #2150 )
2017-06-15 20:19:01 +10:00
Joseph Frazier
cb44125a21
Let `prettier --stdin` work with keyboard input ( #2147 )
...
This uses [get-stream] instead of [get-stdin], since the latter just
gives an empty string if process.stdin is a TTY
(see https://github.com/sindresorhus/get-stdin/issues/21 )
[get-stream]: https://github.com/sindresorhus/get-stream
[get-stdin]: https://github.com/sindresorhus/get-stdin
2017-06-15 09:57:29 +10:00
Joseph Frazier
3bbfa97152
Check exit codes in integration tests ( #2148 )
2017-06-15 09:56:48 +10:00
Lucas Azzola
a2328edced
TypeScript: keep parens around with yield/await non-null assertion, fixes #2137 ( #2149 )
2017-06-15 09:34:12 +10:00