Commit Graph
59 Commits
Author SHA1 Message Date
fisker Cheung 8a4d9a242b Switch json-stable-stringify to fast-json-stable-stringify (#8590) 2020-06-18 18:15:06 +03:00
fisker Cheung 76b4970c2e Update ESLint related dependencies (#8299) 2020-05-14 10:51:11 +08:00
fisker Cheung 207d5245c5 Build: exclude index.js from bin-prettier (#8119) 2020-05-06 18:43:04 +08:00
fisker Cheung d2f51d7494 Fix ignore bug on windows (#8098)
* Fix file ignore bug on windows

* Use `ignore.ignores`

* Fix -stdin-filepath

* Add changelog
2020-04-21 14:33:20 +03:00
Georgii Dolzhykov 9dad95b35f Bump Prettier dependency to 2.0.0 2020-03-21 22:09:54 +02:00
Georgii Dolzhykov 3f1c46373a Expand directories in CLI (2020) (#7660) 2020-03-17 01:34:32 +02:00
Georgii Dolzhykov d469140322 exclude another debug path from coverage 2020-02-26 21:08:27 +02:00
Georgii Dolzhykov 78784871e8 exclude a debug path from coverage 2020-02-25 02:09:47 +02:00
Georgii Dolzhykov cf3d9f0b80 api: remove the version parameter of getSupportInfo (#7620)
* api: remove the version parameter of getSupportInfo

* add changelog entry

* remove mapDeprecated

* Update pr-7620.md

* remove the first parameter completely

* Update api.md

* add default value for opts just to be on the safe side
2020-02-23 02:47:17 +02:00
fisker Cheung 647c041b57 Check pattern existence before glob (#7587) 2020-02-19 12:57:39 +02:00
fisker CheungandChristopher J. Brody 3cef19c73e Update globby to v11 (#6776)
* globby@10 update (with fast-glob implementation)

with some minor test snapshot updates in tests_integration since
fast-glob does not always keep the same file order as node-glob

* with no `nodir: true` option

use of no `nodir: true` option was introduced in 639c52388
but it does not seem to be needed with some newer
versions of globby

* with workaround for fast-glob on Windows

ref: https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>

* Revert "with no `nodir: true` option"

This reverts commit f7297cbceebc3d939bca0d90a904a1d3fea45345.

* revert updates to snapshots in tests_integration

* sort the file paths from globby

and update some snapshots in tests_integration

* Update build scripts

* replace `util.promisify` with `pify`

* style

* typo

* add pify to dict

* check index.js

* debug

* exclude `transform-async-to-generator`

* fix `bin-prettier.js`

* restore disabled script

* try depth:1

* remove depth add `./`

* sort dir

* disable expandDirectories

ref: https://github.com/sindresorhus/globby/blob/master/index.js#L95

* use absolute path

* remove sort()

* sort dir

* use `alphasorti` compare

* remove './'

* fix `findPluginsInNodeModules`

* fix `findPluginsInNodeModules`

* restore snap

* fix `findPluginsInNodeModules`

* return early

* code style

* sort

* update snap

* try mem

* mem `loadPlugins` function

* fix

* glob directories instead of package.json

* use deep

* remove mem

* improve speed

* support dot pattern

* expand directories test

* restore import order

* remove snap

* update test

* restore `findPluginsInNodeModules`

* Update `globby`

* `fast-glob` beta

* Restore logic

* Add tests for `globby` update

* Fix tests

* Remove option with default value

* Try new beta version of `fast-glob`

* Restore error info

* Add `path.sep` check
2020-02-18 17:36:22 +02:00
Corinne Hoener 50e0ea91ee Respect prettierignore when executed in subdirectories (#7588)
* Respect prettierignore when executed in subdirectories

* Add ignore-in-subdirectories tests

* Add changelog entry
2020-02-18 00:40:26 +02:00
fisker Cheung 0aec777e68 Use "lodash/groupBy" (#7438) 2020-02-01 18:26:59 +02:00
fisker Cheung 0370f47cb3 Refactor some Object.assign (#7437) 2020-01-31 09:13:37 +09:00
fisker Cheung f11a94befd Simplify createUsage (#7439)
* Simplify `createUsage`

* restore some change
2020-01-28 18:56:36 +02:00
fisker Cheung 9fccf61a0d Fix prefer-object-spread in /src/cli (#7356) 2020-01-19 01:06:33 +02:00
fisker Cheung 7ff6347398 Style: enable prefer-spread (#7270) 2020-01-14 14:05:28 +02:00
fisker Cheung c238bb68ec Style: enable dot-notation (#7323) 2020-01-14 13:20:07 +02:00
fisker Cheung ac82262abc Optimize some usage of Array#filter (#6996) 2019-12-19 13:06:45 +03:00
fisker Cheung 57f0dd56dd Replace indexOf with includes (#6967)
* Replace `indexOf` with `includes`

* Add `unicorn/prefer-includes`
2019-11-17 11:06:14 +01:00
fisker Cheung 91c5235a3f Show invalid config filename in error message (#6865) 2019-11-08 15:51:51 +03:00
Anders KaseorgandSimon Lydell 0acc3120ef cli: Handle errors when reading stdin (#6708)
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
2019-11-02 13:53:13 +01:00
Georgii Dolzhykov f8a4a61a62 fix typos (#6642) 2019-10-13 21:51:58 +02:00
Evilebot Tnawi 6d4d6a7599 revert: --only-changed argument (#6594) 2019-10-03 11:21:05 -03:00
Gabriel Harel 48697e9237 Handle missing cache directory for changedCache (#6327)
* handle missing cache directory for changedCache

* fallback to temp dir when cache dir not found
2019-07-26 13:03:26 -03:00
Gabriel Harel 6fae09b67e Add --only-changed flag to CLI (#5910) 2019-07-22 11:17:24 -03:00
James Reggio 353b2ca064 Config should not be evaluated for ignored files (#6233)
Prior to this change, the CLI would resolve the config for a file before
checking it against the ignored list. If the config was invalid, the CLI
would report a failure.

This change relocates the config-resolution phase until after the file
is confirmed to not be ignored.
2019-06-18 17:20:47 -03:00
Lucas Duailibe 3805034bdf Improve Rollup setup 2019-06-07 18:20:40 -03:00
fisker Cheung 99d4b86c18 Rollup update (#6200) 2019-06-07 16:58:05 -03:00
Julien Marchand ed1db90c68 Honor stdin-filepath when outputting error messages. (#5878) 2019-02-20 08:39:25 -05:00
Alexander Kachkaev 36aeb4ce4f Fix CI detection to avoid unwanted TTY behavior (#5804) 2019-01-30 14:08:03 +08:00
Alexander Kachkaev 711c6d78a8 Add --check option (#5629) 2018-12-19 22:03:30 +08:00
evelyn masso e12cd17be2 ensure --list-different + --write reports status code 0 (#5512)
* change exit code for list different and write

* update existing tests
2018-11-23 10:42:29 -05:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Ika 4ff0f26d3e refactor: move cli leven suggestion to options-normalizer (#5057)
Option-related processing should be done in `options-normalizer`.

- unknown flag suggestions are colored
  ![image](https://user-images.githubusercontent.com/8341033/45103027-866c7900-b161-11e8-8ee3-6467a9ca0090.png)
- unknown flags with no suggestion are now errors:
  ```
  $ bin/prettier.js --help noseminosemi
  [error] Invalid `--help` value. Expected `a flag`, but received `"noseminosemi"`.
  ```
2018-09-08 07:40:09 +08:00
Ika 49e2f77bff refactor: extract options-normalizer/validator (#5020)
- Uses [`vnopts`](https://github.com/ikatyang/vnopts#readme)
- This way it should be easier to support language-specific options (https://github.com/prettier/prettier/pull/4798#issuecomment-407258477) and map the common options to language-specific options using [`forward`](https://github.com/ikatyang/vnopts#forward), e.g. `singleQuote: true` -> `"javascript/singleQuote": "js"`, `singleQuote: false` -> `"javascript/singleQuote": "none"`.
2018-08-31 11:26:07 +08:00
Ika 1915cc3c46 chore: enable glimmer parser on preview playground (#4915) 2018-08-01 15:44:37 +08:00
Lucas Azzola a938076ae5 Ignore .git, .svn and .hg directories (#4906)
Fixes #4895
2018-07-30 00:08:51 +10:00
Lucas Duailibe 6a6e8cada0 Fix benchmark require (#4792) 2018-07-02 13:17:08 -03:00
Ika e9f489cea1 refactor(debug-repeat): use built-in int type (#4791) 2018-07-02 16:01:05 +08:00
Ivan Babak b9fb113b3b feat(benchmark): add options to measure performance (#4776) (#4789)
- `--debug-benchmark` uses `benchmark` module to produce statistically significant time measurements.
- `--debug-repeat` uses a naive loop and measures just the average run time, but useful for profiling to highlight hot functions.
2018-07-01 19:49:16 -07:00
Ika fb74dc54c3 feat(api): make getFileInfo() really async (#4640) 2018-06-07 00:34:02 +08:00
Ika 75e86b9e6b fix(cli): no regression for --debug-check + --list-different (#4600) 2018-05-31 00:42:26 +08:00
Lucas Duailibe 1350edc5a6 Revert no parser error for API (#4587)
* Revert no parser error for API

* use warn
2018-05-28 23:43:44 -06:00
Lucas Duailibe 5c6e0802af Don't default parser to babylon (#4528)
* Don't default parser to babylon

* Different default values according to version

* Fix error logging

* Add tests specifically for parser inference

* Add another test case

* Add API test
2018-05-23 16:55:06 -03:00
Alexander Kachkaev cc734753fc Implement prettier.getFileInfo() method and --file-info CLI option (#4341)
* Implement prettier.getFileInfo() method and --file-info CLI option

* Add empty line between functions in index.js

* Support --plugin-search-dirs / pluginSearchDirs() in --file-info / getFileInfo()

* Address review comments by @ikatyang
2018-05-10 00:53:44 +08:00
Alexander Kachkaev 7345a38e64 Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir (#4192)
* Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir

* Use find-parent-dir instead of find-up and test autoloading (with mocked fn)

* Add two test cases where --plugin-search-dir is not .

* Do not mutate pluginSearchDirs argument in load-plugins.js

* Do not test automatic plugin resolution as mocking of "find-parent-dir" does not work due to rollup

* Document --plugin-search-dir / pluginSearchDirs and improve spacing

* Address @ikatyang's review comments

* Fix require path for third-party

* Undo alphabetic sorting of third-party scripts
2018-05-09 19:17:12 +08:00
Lucas Duailibe 67f1c4877e Refactoring: better boundaries for different parts of the project (#4364) 2018-04-25 13:29:35 -03:00
Lucas Duailibe 240f09794b Fix printing ignored files with --debug-check (#4066) 2018-03-01 13:03:54 -03:00
Christian Zosel d05a29da05 Allow plugins to override default options (#3991)
* refactor(cli): defer default value applying

* Allow plugins to override default options

* Move "defaultOptions" to top level of plugin

* Simplify implementation

* Attach plugin name

* Add pluginOptions to cli help

* Update snapshots

* Code review (immutable style)

* Add test for help output

* Use snapshot test, fix Object.assign

* Refactor to immutable style

* Add test case for automatic plugin resolution

* Add tests for applying and overriding default opts

* Remove "since" option

* Only set defaults for CLI args when no pluginDefaults are present

* Revert workaround, rebase to #4045

* Add basic documentation for `options` and `defaultOptions`
2018-02-28 00:20:02 +11:00