Commit Graph

1494 Commits (df5482008ef97ce9172557e1ea200997aaeb3f39)

Author SHA1 Message Date
长天之云 df5482008e fix(prettierignore): support absolute filename (#2783) 2017-09-10 18:21:56 +02:00
Ika 8b02f702d5 fix(build): update ISSUE_TEMPLATE version regex to work as intended (#2785) 2017-09-10 17:37:07 +02:00
Lucas Duailibe 955a2c1472 Keep conditional expressions in one line on method chains (#2784)
Fixes #2775.

This commit will make conditional expressions to match the behavior of
logical expression in method chains:

```js
(a ? b : c).map()

// if the conditional fits in oneline
(a ? b : c)
  .map()

// if the conditional doesn't fit
(a
  ? b
  : c)
  .map()
```
2017-09-10 08:34:55 -07:00
Lucas Duailibe bba7dcf498 Fix break on conditional expressions inside return
Fixes #2777

Since we can't break after `return` and don't add `()` around
ConditionalExpressions' tests, we end up with some weird indentation when
breaking.
2017-09-10 04:13:47 -06:00
Ika 3db840258b chore(build): update ISSUE_TEMPLATE.md before publish (#2776) 2017-09-09 23:39:11 +10:00
jackyho112 302de60bdc Fix comment style when placed after if statement test (#2675)
* Fix comment style when placed after the test of an if statement

* Add tests

* Do a bit of refactoring

* Fix lint errors

* Handle skipping comments

* Account for multiple-line comments

* Add more tests

* Change function name

* Add more tests

* Refactor

* Add some comments

* Do away with getPreviousNonSpaceNonCommentCharacter

* Improve comment and code on handling if statement comments

* Refactor

* Fix a bug
2017-09-08 10:12:10 -07:00
Lucas Duailibe 85f1351366 Fix unused var 2017-09-07 21:57:07 -06:00
Lucas Duailibe 3cfee9c976 Clarification of code 2017-09-07 21:57:07 -06:00
Lucas Duailibe 2c37697f82 Fix chained logical expressions with objects/array/etc inlined 2017-09-07 21:57:07 -06:00
Lucas Duailibe f964be5f8a Remove unnecessary tests 2017-09-07 21:29:53 -06:00
Lucas Duailibe 541e929b43 Change how JSX mode is activated in ternaries 2017-09-07 21:29:53 -06:00
Ika aaac83d126 refactor(runPrettier): reduce duplicate code (#2764) 2017-09-07 07:16:45 +02:00
Lucas Azzola 87503e5ef7 Refactor error handling (#2750) 2017-09-06 09:52:59 +10:00
Lucas Duailibe 15989df6e1 Group last argument if it's an empty object with a comment (#2758) 2017-09-05 12:22:25 -07:00
Anthony Sottile 4d68faf195 Use `files:` over `types:` in pre-commit configuration (#2759)
See https://github.com/prettier/prettier/issues/2745
2017-09-05 12:17:02 -07:00
James Henry 9c4ec68afd Fix: TypeScript never keyword (fixes #2718) (#2756) 2017-09-05 11:37:22 -07:00
Ika 2d6c4f70e9 chore(github): add issue template (#2755) 2017-09-05 09:41:11 -07:00
Roman Kurbatov 01387bc9d1 fixes dynamic imports (#2748) 2017-09-05 11:57:36 +10:00
Mitermayer Reis c59a82cbae Add CLI option '--config-precedence' (#2733)
Add CLI option '--config-precedence'
2017-09-05 08:56:23 +10:00
Maxime Thirouin 7eaf5c7cb7 Improve lint-staged setup example by adding more filetypes (#2746) 2017-09-04 17:42:26 +10:00
Simon Lydell a29b407dda Generalize run-external-typescript-tests.js (#2742)
... so it can run external Flow tests as well (or any external tests for
that matter).
2017-09-03 13:41:07 -07:00
Simon Lydell 133303f47a Ignore some things in coverage (#2741)
- If statements for old deprecated stuff.
- "This should never happen" (and never happens in the tests) code paths.
2017-09-03 13:40:44 -07:00
Simon Lydell 368522cf33 Normalize CSS case (#2736)
Fixes #2653.
2017-09-03 21:22:28 +02:00
Simon Lydell 58350cbe59 Fix failing test on Travis CI
Chalk disables colors in CI environments, making the test pass locally
but not on Travis CI.

This also makes the snapshot more readable.
2017-09-03 17:02:12 +02:00
Simon Lydell fd025a855e Merge pull request #2738 from ikatyang/test/more-cli-tests
test(integration): add more tests
2017-09-03 16:24:44 +02:00
Ika c1707cf40c chore(deps): remove `cross-spawn` (#2739) 2017-09-03 16:10:58 +02:00
ikatyang ca7be87f9e test: remove unnecessary `eslint-disable` 2017-09-03 22:06:55 +08:00
Simon Lydell f903ae45ed Make run-external-typescript-tests.js cross-platform (#2737)
The old version had quite a bit of code related to grouping errors,
showing the number of errors per group and saving the groups of errors
to different files. However, now there are only 12 bad tests so I didn't
bother porting that logic to the new version. Instead, the errors a
simply printed to stdout.
2017-09-03 15:59:19 +02:00
ikatyang 3cc9083f1d chore(eslint): ignore `/tests_integration/cli/` 2017-09-03 21:50:19 +08:00
ikatyang 8f423c1071 fix: globby.sync should be in `try..catch` block 2017-09-03 21:32:12 +08:00
ikatyang ac9fa43114 test(integration): add more tests 2017-09-03 21:31:33 +08:00
Ika c4e5463514 refactor(cli): separate files and make it pure as possible (#2730)
* refactor(bin): resolveConfig

* refactor(bin): getOptionsForFile

* refactor(bin): remove `mapSeries`

* refactor: move content from bin to src/cli

* refactor: wrap content with function

* refactor: move constants to another file

* refactor: move utils to another file

* refactor: move functions

* refactor: extract functions

* refactor: remove unnecessary variable

* refactor: move `src/cli` to `src` with prefix `cli`

* refactor: use template literal

* refactor: remove unnecessary variable

* refactor: extract `listDifferent`

* refactor: extract `format`

* refactor: change error message `Invalid configuration:`

* refactor: bind args with argv

* refactor: extract `getOptionsForFile`

* refactor: extract `formatStdin`

* refactor: extract `eachFilename`

* refactor: extract `formatFiles`

* refactor: remove unnecessary export

* refactor: use `globby.sync()`

* refactor: add `runPrettier.sync()` helper

* refactor: fix linting

* refactor: mock `process.argv`

* chore: use `--forceExit` to avoid process hanging

* refactor: mock `get-stream`

* refactor: remove unnecessary stuff

* refactor: fix linting

* refactor: wrap `run` with `try..catch.finally`

* refactor: restore `process.exitCode` after testing
2017-09-03 19:21:06 +10:00
Joseph Frazier a9520d31b1 Upgrade chalk to v2.1.0 (#2732)
This fixes a warning when installing prettier from github:

    warning prettier > chalk@2.0.1: Please upgrade to Chalk 2.1.0 - template literals in this version (2.0.1) are quite buggy.
2017-09-03 14:18:27 +10:00
Joseph Frazier b50946f59b Fix cosmiconfig dependency branch (#2731)
The `3.0` branch was [merged] and [deleted],
so we should use the default branch now.

[merged]: https://github.com/davidtheclark/cosmiconfig/pull/78#event-1232367869
[deleted]: https://github.com/davidtheclark/cosmiconfig/pull/78#event-1232367884
2017-09-03 10:47:28 +10:00
Ika 8a6b56be41 refactor(bin): use `resolveConfigFile.sync()` (#2728)
* refactor(bin): resolveConfig

* refactor(bin): getOptionsForFile

* refactor(bin): remove `mapSeries`
2017-09-02 22:17:23 +10:00
Ika 088aa71b07 feat(resolve-config): add `.sync()` method (#2722)
* feat(resolve-config): add `sync` option

* docs(readme): add `sync` option

* fix(clearCache):  always clear both

* chore(deps): switch to 3.0 branch

* feat: replace `sync` option with `.sync()`

* docs(readme): update `.sync()`
2017-09-01 20:17:07 +10:00
Daniel Spitzer 2fd77e7718 Add Tradeshift as a user (#2719) 2017-09-01 09:03:17 +10:00
Christian Wesselhoeft 87401de0a5 Handle +/- before numbers in CSS (#2713)
* src/util: Fix negative number handling

* src/util: Handle decimal numbers with leading plus sign

* src/util: Handle sign symbols before numbers in scientific notation
2017-08-30 20:26:11 +02:00
Brian Ng 9533c17827 Fix printing declare modifier for TS enum (#2711) 2017-08-30 08:14:26 -07:00
Brian Ng 123bc5d5ff Ensure parens around LogicalExpression inside ExperimentalSpreadProperty (#2710) 2017-08-30 08:10:36 -07:00
Lucas Azzola 2686b15b91 Update URL to prettier-vscode 2017-08-30 22:53:53 +10:00
Kevin van Zonneveld b18db09a54 Add Transloadit as a user (#2706) 2017-08-30 22:35:27 +10:00
Levi Thomason 828a7b8f0d docs(readme): add and sort cli options (#2700)
* chore(build): auto generate toc

* docs(readme): add and sort cli options

* refactor(build): move toc to seperate task
2017-08-29 13:39:49 -07:00
Christopher Chedeau c3506198c0 1.6.1
Small regression fixes
2017-08-29 09:00:14 -07:00
Simon Lydell 63835d1ccb Fix config file finding when using stdin (#2692)
Fixes #2689
2017-08-29 08:58:08 +02:00
Simon Lydell 7c9e589323 Fix CLI option parsing (#2684)
Fixes #2683
2017-08-29 08:16:04 +02:00
Ika a44ef1fe8b Update README.md (#2690)
* docs(readme): fix option typo

* docs(readme): fix parameter representation
2017-08-29 16:05:59 +10:00
James Henry 987b931215 Fix: Union type with type params regression (#2688) 2017-08-28 18:37:12 -07:00
Brian Ng 8bb8eaf941 Bump babylon to 7.0.0-beta.22 (#2687) 2017-08-29 09:11:32 +10:00
Joseph Frazier 82ad911ddc Upgrade prettier dependency to v1.6.0, fix lint (#2681) 2017-08-28 12:22:51 -07:00