Commit Graph

1204 Commits (0410949984a1a4c99d3b56b95123d70951b197c8)

Author SHA1 Message Date
Mitermayer Reis 8fdf398e27 Making cli infer parser based on filetype (#1837)
* Adding --stdin-filepath option in order to enable filetype inference from
stdin

* Making CLI auto infer parser based on filename passed
2017-05-31 14:42:04 -07:00
Christopher Chedeau d55640087e Fix building docs (#1838)
The hackiness continues! I'm now bundling an existing bundle again in order for it to get exported as a global variable :p There's likely a better solution, but it kind of works.

Because I have to regenerate the docs, I just tagged it as 1.4.0-beta and added typescript and postcss in there.
2017-05-31 13:37:35 -07:00
Mitermayer Reis 0d9b04bc94 Adding --stdin-filepath option in order to enable filetype inference … (#1835)
* Adding --stdin-filepath option in order to enable filetype inference from stdin to allow chosing css parser

* Adding readme information on the filepath option

* Also including support for typescript parser inference.

* Running linter
2017-05-31 12:26:22 -07:00
Christopher Chedeau f4296550db Introduce Webpack 2 to fix postcss bundling (#1836)
It turns out rollup doesn't use the same algorithm for bundling commonjs files when there are cycles as node, which breaks postcss: https://twitter.com/Rich_Harris/status/869021144191561729. Webpack works just fine with it.

This sucks to have this rollup/webpack frankenstein but I really want to be able to release and don't really want to spend yet another day or two trying to make it work well.
2017-05-31 11:59:33 -07:00
Karl O'Keeffe f4ef1c2c97 JSX whitespace on the same line as text (#1829)
This tweaks our JSX formatting to only put a JSX whitespace `{" "}` on a line by itself when it comes before or after a multiline element.

When preceding a text or single line element it appear on the same line as that element.
2017-05-31 10:16:50 -07:00
Karl O'Keeffe a680cd8534 Fix unstable JSX output by ensuring we follow `fill` rules. (#1827)
* Fix unstable JSX output by ensuring we follow `fill` rules.

This changes makes us more strict about ensuring our JSX children follow the alternating content/whitespace format expected by the `fill` primitive.

Previously there were some cases where could get out of sync which would throw out the formatting.

* Simplify whitespace wrangling

# Conflicts:
#	src/printer.js
2017-05-31 09:42:36 -07:00
Christopher Chedeau fa708d102a Remove trailing commas for generics in TypeScript (#1832)
Fixes #1820
2017-05-31 09:22:00 -07:00
Patrick Roumanoff 96b8119b4b added related projects Bookmarklet (#1824) 2017-05-30 21:50:51 -07:00
Christopher Chedeau 3097f9b2fe Do not indent nested ternaries (#1822)
This avoids making it seems like it is indented by 4 characters instead of two. The downside is that if the condition is multi-line it's not going to be properly aligned, but I feel it's a better trade-offs. If you are doing nested ternaries, you usually have small conditions.
2017-05-30 10:08:06 -07:00
Christopher Chedeau 73ff0ef9ea Add group around implements (#1821)
This shouldn't break if it fits in one line.

Fixes #1818
2017-05-30 09:45:07 -07:00
Joseph Frazier ea27846d1f Don't force line break in empty loop bodies (#1815)
This makes them consistent with empty function bodies.

Fixes https://github.com/prettier/prettier/issues/1356
2017-05-30 09:39:10 -07:00
Christopher Chedeau eeb8616e3c Add parenthesis for single arg types with generics (#1814)
Fixes #1813
2017-05-29 16:59:45 -07:00
Christopher Chedeau 2ab3d6d6ac Workaround bug with comment ending in */ (#1810)
Reported in the original repo: https://github.com/postcss/postcss-scss/issues/64
2017-05-29 13:05:20 -07:00
Christopher Chedeau 59e4e83355 Break before combinators and indent (#1809) 2017-05-29 12:55:14 -07:00
Christopher Chedeau f34492d7e5 Strip leading space for first combinators (#1807) 2017-05-29 12:49:25 -07:00
Christopher Chedeau 27df0f81f5 Preserve space before parens (#1806) 2017-05-29 12:41:04 -07:00
Roman Coedo 2e9ea8f223 Move emacs package to its own repository (#1804) 2017-05-29 11:55:58 -07:00
Christopher Chedeau dc287d32a5 Remove extra newline from empty @media (#1802) 2017-05-29 08:52:24 -07:00
Christopher Chedeau c4e32f4c78 Remove double spaces in @font-face (#1801) 2017-05-29 08:49:51 -07:00
Christopher Chedeau 873123223f Fix empty urls (#1800) 2017-05-29 08:43:19 -07:00
Christopher Chedeau 72ce134555 fix lint 2017-05-29 08:40:13 -07:00
Christopher Chedeau 6a9e053221 Workaround a bug where the comment location is off for scss (#1799)
Workarounds https://github.com/postcss/postcss-scss/issues/63
2017-05-29 08:39:41 -07:00
Roman Coedo 6cecb83cdf Fix some issues from melpa PR (#1798) 2017-05-29 08:34:33 -07:00
Christopher Chedeau bf5f9cc05d Add support for media-url (#1797) 2017-05-29 08:20:03 -07:00
Lucas Azzola c9159f7862 Break on Property with long value and Literal key (#1786)
* fix(object-expression): break on object literal with long value

* fix(object-expression): add isStringLiteral check
2017-05-29 07:31:24 -07:00
James Henry 920ceea77e Update tsep to latest master, reenable abstract interface test (#1795) 2017-05-29 23:26:53 +10:00
Christopher Chedeau 05b921efdd Build the dist/ with rollup (#1794) 2017-05-28 21:49:41 -07:00
Christopher Chedeau 453eb6c287 Split parser into different files (#1793)
This is the first step in order to be able to bundle all those parsers in their own file to get rid of all the dependencies that prettier has.
2017-05-28 21:06:09 -07:00
Christopher Chedeau 310fba57cc Add a test with all the less docs and fix issues (#1792)
The docs go over a bunch of edge cases, might as well have it as a test :)

http://lesscss.org/features/

I just had to remove

```css
.weird-element {
  content: ^//* some horrible but needed css hack;
}
```

but i'm not sure if it's real less.
2017-05-28 16:05:26 -07:00
Christopher Chedeau 5a828bedd1 Update eslint-typescript again (#1791)
Now fixes more issues ;)
2017-05-28 16:05:07 -07:00
Christopher Chedeau 63742bac56 fix lint 2017-05-28 15:09:52 -07:00
Christopher Chedeau 97775dc94c Add support for SCSS (#1790)
We use a heuristic to figure out if it's a SCSS or Less file. And if it doesn't work, we try again with the other one. We do the same for JSX and TypeScript.

Fixes #1784
2017-05-28 15:01:47 -07:00
Christopher Chedeau 3d6acd8648 Fix log issue 2017-05-28 13:54:54 -07:00
Christopher Chedeau 882b712c5f Update typescript-eslint (#1787)
It improves a few things.
2017-05-28 13:18:29 -07:00
Marcel Mokoš f0683b8e1a Update README.md version of prettier in pre-commit (#1788)
- a version of prettier to latest in README in pre-commit config yaml example
2017-05-28 12:24:50 -07:00
Lucas Azzola e270032d37 chore(typescript): upgrade typescript-eslint-parser to 992f1fa (fixes #1769) (#1785) 2017-05-28 08:05:33 -07:00
Lucas Azzola 2f840f940f test(typescript): disable failing tests (#1782) 2017-05-27 18:22:32 -07:00
Lucas Azzola 2a58e6bc06 test(typescript): enable typescript-verify on most tests (#1781) 2017-05-27 17:57:07 -07:00
Christopher Chedeau 383aaca0e4 Fix decorators location (#1779)
Babylon has a bug (I guess) with locations for classes where decorators are involved. Instead of the class starting at the first decorator, it starts at the beginning of the `class` keyword. By moving the location to the first comment, it solves --some-- of the issues with decorator comments.
2017-05-27 14:51:00 -07:00
Christopher Chedeau c0d6ce53b7 lint 2017-05-27 14:11:30 -07:00
Christopher Chedeau 0c977a785b fix tests 2017-05-27 14:11:02 -07:00
Christopher Chedeau 37eda1f17a Only inline urls with a single argument (#1778) 2017-05-27 14:09:40 -07:00
Christopher Chedeau 6f72e278e9 Do not break before `+` (#1777)
We really want to parse those as binary expressions but it's not going to be trivial. A quick fix that should help is to not break before those.
2017-05-27 13:41:19 -07:00
Christopher Chedeau 122bb65f16 fix lint 2017-05-27 13:32:53 -07:00
Christopher Chedeau 375540efac Remove many spaces from media query (#1776)
The issue is really that the media query parser fails to parse the inner queries and just gives a raw string for the expression, but it should be safe to remove extra spaces. I can't make it rmeove spaces inside () that way unfortunately :(
2017-05-27 13:32:27 -07:00
Christopher Chedeau 48d35503c4 Remove space around media `and` (#1775) 2017-05-27 13:24:08 -07:00
Christopher Chedeau adb26e20ad Add space around ~ combinator (#1774) 2017-05-27 13:20:32 -07:00
Christopher Chedeau 54497a0865 Skip extra `;` (#1773) 2017-05-27 13:20:19 -07:00
Christopher Chedeau bb0c184855 Fix broken tests
If you put a space, `{loose: true}` is going to parse them as word + paren instead of func. It doesn't impact correctness and i'm not really sure how to clean the ast, so let's just make the test pass. I haven't seen this anywhere in real code.
2017-05-27 13:16:11 -07:00
Christopher Chedeau 3c110b0230 Indent groups (#1772)
This way it looks less weird when they break
2017-05-27 13:01:38 -07:00