Commit Graph
65 Commits
Author SHA1 Message Date
e3d1f0dee0 CLI: Add --ignore-unknown (#8829)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2020-08-21 09:11:59 +08:00
fisker Cheung 25398a943f Minor refactor (#8935) 2020-08-10 21:57:02 +08:00
fisker Cheung 86b8395ed7 Fix cli --file-info bug (part 2) (#8830) 2020-07-24 23:31:59 +08:00
Anders Kaseorg bd679a7625 Bump loglevel of issues reported by --check to warn (#8703)
When prettier --check is run by a script that combines the output from
dozens of separate linters, any progress output like “Checking
formatting...” and “All matched files use Prettier code style!” is
just noise that makes it harder to see whether there are real
errors. Bump the loglevel of issues reported by --check from log to
warn so that the noise can be selectively silenced with
--loglevel=warn.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-07-14 22:13:51 +08:00
fisker Cheung 0c2b918078 ESLint: enable import/order (#8635) 2020-06-26 20:30:21 +08:00
fisker Cheung a4e5f2053d Fix cli --file-info bug (#8586)
* Fix cli `--file-info` bug

* Add changelog

* Update pr-8586.md
2020-06-18 18:18:19 +03:00
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