Commit Graph

13 Commits (dcccfed366823fc0afb703a2f4c64e7148cb1fb0)

Author SHA1 Message Date
Lucas Azzola dcccfed366 Implement cosmiconfig for workspace configuration (#2434)
* Implement cosmiconfig

* Add resolveOptions API and extname support

* Add --resolve-config and --config, rename resolveOptions to resolveConfig

* Move color to top-level CLI options

* Fix unknown param warning

* Change from {} to null when no config is found

* Change override API to emulate eslint

* Add test for eslint-style overrides

* Delete overrides from resolveConfig
2017-07-10 22:26:36 +10:00
Joseph Frazier 16bc297572 Fix --debug-print-doc (#2400)
* Add test of --debug-print-doc

See https://github.com/prettier/prettier/issues/2396

* Pass test of --debug-print-doc

See https://github.com/prettier/prettier/issues/2396
2017-07-05 18:25:51 +02:00
Joseph Frazier e82a774568 Make --list-different to work with --stdin (#2393)
* Add test for `prettier --stdin --list-different`

See https://github.com/prettier/prettier/issues/2389

* Pass test for `prettier --stdin --list-different`

This fixes https://github.com/prettier/prettier/issues/2389

* Deduplicate --list-different handling

* Exit-early to reduce nesting in listDifferent()

* Simplify condition in listDifferent()
2017-07-04 14:41:46 -04:00
Evilebot Tnawi a0cadad222 feat(cli): support multiple patterns with ignore pattern (#2356) 2017-07-04 17:55:06 +02:00
Lucas Azzola 21f913cb6e CLI: ignore node_modules with ./**-style glob, fixes #2110 (#2185) 2017-06-18 14:35:42 +10:00
Joseph Frazier aedc6d4269 Add integration test of invalid syntax (#2160) 2017-06-16 09:10:39 +10:00
Joseph Frazier 3bbfa97152 Check exit codes in integration tests (#2148) 2017-06-15 09:56:48 +10:00
Lucas Azzola 364c38de0d Implement custom parser API (#1783)
* feat(api): add custom parser API

* test(api): add integration test for parser resolution

* chore(api): fix build after resolving conflicts

* docs(api): document custom parser API

* docs(api): fix typo

* chore(build): add parse5 to build and support yarn test --prod
2017-06-12 16:51:12 +10:00
Joseph Frazier 552ceb30e8 Allow --debug-check to work with stdin (#2013)
* Allow --debug-check to work with stdin

This makes it easier to quickly test formatting code snippets with e.g.

    pbpaste | prettier --debug-check

Before, the following would happen:

    $ pbpaste | prettier --debug-check
    stdin: TypeError: Invalid data, chunk must be a string or buffer, not undefined
        at WriteStream.Socket.write (net.js:693:11)
        at writeOutput (/Users/josephfrazier/workspace/prettier/bin/prettier.js:375:18)
        at getStdin.then.input (/Users/josephfrazier/workspace/prettier/bin/prettier.js:275:7)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:169:7)
    $

Now, it looks like this:

    $ pbpaste | prettier --debug-check
    (stdin)
    $

* Test that --debug-check still prints filenames

See https://github.com/prettier/prettier/pull/2013#discussion_r120499306
2017-06-06 16:10:24 -07:00
Philipp Spieß d679f235ed Also infer parser when using `--list-different` (#1997)
* Also infer parser when using `--list-different`

* Add integration tests for parser inference
2017-06-06 08:24:56 -07:00
Joseph Frazier 451f4aaad5 Add regression test for --debug-check (#1917)
See https://github.com/prettier/prettier/pull/1916
2017-06-02 15:30:39 -07:00
Joseph Frazier f6dabc0d27 Add regression test for CLI shebang preservation (#1901)
Following up on https://github.com/prettier/prettier/pull/1899
2017-06-02 13:42:44 -07:00
Michał Pierzchała 7a0df958dc Ignore node_modules when running prettier from CLI (#1683)
* Ignore node_modules by default

* Add integration test suite for --with-node-modules CLI arg

* Refactor tests to snapshots

* Disable eslint for purposely faulty files

* Fix node 4

* Fix prettier

* Gitignore only top-level node_modules
2017-05-23 14:19:04 -07:00