Georgii Dolzhykov
effe30a3b8
Playground: show preprocessed AST ( #13606 )
2022-10-10 14:26:55 +03:00
Lipis and fisker Cheung
4ed2d3c4bc
style: Add new ESLint rule no-lonely-if and unicorn/no-lonely-if ( #10176 )
...
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-09-29 10:25:54 +08:00
fisker Cheung
9bacc75772
Use .at() and Object.hasOwn() ( #13482 )
2022-09-18 17:50:14 +08:00
fisker Cheung
31cdcd0487
Sort plugin default values when create usage ( #13230 )
2022-08-06 22:03:37 +08:00
fisker Cheung
81709487cd
Use private fields ( #13156 )
2022-08-06 11:13:37 +08:00
Sosuke Suzuki
b12396d69a
Change --loglevel to --log-level ( #13204 )
...
* Change `--loglevel` to `--log-level`
* Update tests
* Update docs
* Add changelog
2022-08-02 09:39:41 +09:00
fisker Cheung
298347c9fb
Merge branch 'main' into next
...
# Conflicts:
# netlify.toml
# src/cli/find-cache-file.js
# src/cli/utils.js
# src/main/parser.js
# website/playground/PrettierFormat.js
# website/static/worker.js
2022-08-01 11:27:34 +08:00
Sosuke Suzuki and Holger Jeromin
955553bb39
Add --cache-location option ( #13019 )
...
* Implement searching cache file from `--cache-location` option
* Add tests
* Add docs
* Fix
* Fix doc
* Add changelog
* Update snapshots
* Update docs
* Update docs/cli.md
Co-authored-by: Holger Jeromin <mailgithub@katur.de >
* Fix changelog
* Remove directory support
* Update docs
* Update tests
* Update docs
* Add validation for dir
* Fix comment
* Update option description
* Validate JSON
* Use `path.resolve`
Co-authored-by: Holger Jeromin <mailgithub@katur.de >
2022-07-31 22:58:05 +09:00
fisker Cheung
4d4947c284
Merge branch 'main' into next
...
# Conflicts:
# src/cli/logger.js
# src/language-js/print/binaryish.js
# website/package.json
# website/yarn.lock
2022-07-19 14:13:01 +08:00
Sosuke Suzuki
6c722c7990
[next]Enforce fs/promises ( #13119 )
...
* Add new ESLint rule `prefer-fs-promises`
* Apply rule
* Renaming
2022-07-17 16:02:22 +09:00
Diomidis Spinellis
e5beb5aea4
Use appropriate chalk instance for stderr output ( #13098 )
...
Chalk auto-detects whether the output channel supports colors,
but does that for stderr. Consequently, colors appear inconsistently
(and wrongly) depending on whether stdout or stderr have been redirected.
Issue: #13097
2022-07-13 23:14:40 +09:00
fisker Cheung
29f6bc2c6d
Migrate third-party.js to ES Module ( #13092 )
2022-07-12 10:20:11 +08:00
renovate[bot] and fisker Cheung
97add4a23e
Update dependency camelcase to v7 ( #13005 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-07-11 15:24:13 +08:00
fisker
21f2ea0f1e
Fix
2022-06-19 11:28:28 +08:00
fisker
0e0f879c1a
Merge branch 'main' into next
...
# Conflicts:
# docs/browser.md
# package.json
# scripts/release/yarn.lock
# scripts/vendors/vendor-meta.json
# scripts/vendors/vendors.mjs
# src/cli/expand-patterns.js
# src/cli/format.js
# src/cli/utils.js
# src/language-js/index.js
# src/language-js/parse/postprocess/index.js
# src/language-js/parse/postprocess/typescript.js
# tests/format/misc/errors/invalid/jsfmt.spec.js
# tests/integration/__tests__/__snapshots__/support-info.js.snap
# website/playground/sidebar/SidebarOptions.js
# yarn.lock
2022-06-19 11:12:22 +08:00
Sosuke Suzuki and Simon Lydell
fdccc0f48e
Add --cache CLI option ( #12800 )
...
* Install `file-entry-cache` and types
* Implement `FormatResultsCache`
* Add `--cache` and `--cache-location` option
* Implement `--cache` and `--cache-location`
* Add tests for `--cache`
* Add tests for `--cache-location`
* Avoid spellcheck error
* Update snapshots for new options
* Add `groupBy` for website
* Use `fs.promises` instead of `fs/promises`
* Use `rimraf` instead of `fs.rm`
* Fix properties order of `options`
* Install `find-cache-dir` and types
* Change default cache file location to `node_modules/.cache/prettier`
* Fix tests following to change default cache file location
* Update snapshots for changing default cache file location
* Set `os.tmpdir()` as a fallback for default cache dir
* Add docs for `--cache` and `--cache-location`
* Use `sdbm` instead of `node:crypto`
* Add changelog
* Fix `getHashOfOptions`
* Remove `cache-location`
* `prettiercache` -> `prettier-cache`
* Remove cache file when run Prettier without `--cache` option
* Implement `--cache-strategy`
* Add tests for invalid cache strategy
* Fix lint problems
* Tweaks tests
* Add tests for timestamp
* Add tests for `--cache-strategy`
* Add docs for cache-strategy
* Address review
* Fix `findCacheFile`
* Use Set.prototype.has
* Throw error with --stdin-filepath
* Update snapshots
* Fix error for cache and stdin
* Use string constructor instead of toString
* Update changelog
* Use flag validation
* Fix `cache-strategy` definition
* Update docs
* Mark highlihgt
* Throw error for `--cache-strategy` without `--cache`
* Update docs
* Fix typo
* Updates snapshots
* Update docs/cli.md
Co-authored-by: Simon Lydell <simon.lydell@gmail.com >
* Fix error message
* Remove `:::` syntax
* Defaults `content`
* Update docs
* Fix by Prettier
Co-authored-by: Simon Lydell <simon.lydell@gmail.com >
2022-06-11 23:32:32 +09:00
fisker Cheung
1ae86fa5f3
CLI: Sort language alphabetically by name when print support info ( #12947 )
2022-06-06 22:46:29 +08:00
fisker Cheung
9569ab12aa
Merge branch 'main' into next
...
# Conflicts:
# .github/renovate.json5
# .github/workflows/lint.yml
# package.json
# src/cli/format.js
# src/language-js/print/type-annotation.js
# src/language-js/print/typescript.js
# src/language-js/utils/index.js
# tests/format/typescript/enum/jsfmt.spec.js
# tests/format/vue/with-plugins/jsfmt.spec.js
# website/yarn.lock
# yarn.lock
2022-05-28 11:19:03 +08:00
fisker Cheung
206134fb60
Skip plugin loading when parsing loglevel, plugins, pluginSearchDirs ( #12804 )
2022-05-28 10:50:43 +08:00
fisker Cheung
11720f1280
Simplify getContextOptions ( #12805 )
2022-05-10 13:48:48 +08:00
fisker Cheung
354555215c
Simplify createMinimistOptions ( #12808 )
2022-05-08 16:28:38 +08:00
Sosuke Suzuki
9fd05e8de5
Sort options ( #12801 )
2022-05-07 15:18:52 +09:00
fisker Cheung
193365eb71
Load plugins asynchronously ( #12790 )
2022-05-06 09:27:54 +08:00
fisker Cheung
c1f6d021e5
Use named export instead of default export ( #12740 )
2022-05-05 15:03:08 +08:00
fisker Cheung
e14411c278
Support async parser ( #12748 )
2022-05-04 11:15:48 +08:00
fisker Cheung
4c42129d96
Simplify pref test scripts ( #12699 )
2022-05-01 22:29:45 +08:00
fisker
b4c74de822
Merge branch 'main' into next
...
# Conflicts:
# src/cli/format.js
# src/language-css/utils/has-string-or-function.js
# src/language-css/utils/is-scss-variable.js
2022-05-01 21:41:20 +08:00
fisker Cheung
c6d6b25833
prettier.{format,formatWithCursor,check}() are now async (#12574 )
2022-04-29 14:22:24 +08:00
fisker Cheung
88c036a869
Update prettier-internal.js exports for easier use ( #12737 )
2022-04-29 13:51:34 +08:00
fisker Cheung
fc74af1d94
Set loglevel to debug automatically when performance flags found ( #12698 )
2022-04-28 11:24:59 +08:00
fisker Cheung
ed6b2ddb94
Typo
2022-04-25 14:58:28 +08:00
fisker Cheung
76d0002265
Fix by ESLint
2022-04-25 14:48:07 +08:00
fisker Cheung
a85f38f096
Merge branch 'main' into next
...
# Conflicts:
# .github/workflows/dev-test.yml
# jest.config.mjs
# package.json
# scripts/vendors/vendor-meta.json
# scripts/vendors/vendors.mjs
# src/cli/format.js
# src/cli/options/create-minimist-options.js
# src/cli/options/parse-cli-arguments.js
# src/cli/usage.js
# src/cli/utils.js
# src/common/create-ignorer.js
# src/common/load-plugins.js
# src/config/resolve-config.js
# src/index.js
# src/language-css/utils/css-units.evaluate.js
# src/language-html/ast.js
# src/language-html/print-preprocess.js
# src/language-html/utils/index.js
# src/main/multiparser.js
# tests/format/markdown/auto-link/jsfmt.spec.js
# tests/integration/__tests__/__snapshots__/config-resolution.js.snap
# tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap
# tests/integration/__tests__/file-info.js
# yarn.lock
2022-04-25 14:28:27 +08:00
fisker Cheung
85e6e4f73f
CLI: Skip print code or write file when performance flags found ( #12682 )
2022-04-25 08:44:22 +08:00
Sosuke Suzuki and fisker Cheung
fa3b95c2e1
Remove lodash ( #12628 )
...
* Replace `groupBy`
* Replace `partition`
* Replace `pick`
* Move `partition`
* Replace `uniqBy`
* Replace `fromPairs`
* Remove usage from website
* Reuse `partition`
* Remove from package.json
* Fix
* Use `ignore.default`
* Add `resolveConfig` to `FileInfoOptions`
* Explicit tuple types
* Make `cache` optional
* Fix cosmiconfig type
* Use `@ts-expect-error` for private property access
* Add type annotation for validate
* Fix type errors for `OptionInfo`
* Add `@ts-expect-error`
* Fix type of `normalizeOptions`
* Fix `OptionInfo` type
* Add `@ts-expect-error` for `option-normalizer`
* Avoid type error
* Fix typo
* Add types for lodash fns
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-04-10 15:26:07 +09:00
Harry Hopkinson and fisker Cheung
f98c197b66
Print the number of files that need formatting. ( #12561 )
...
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-04-07 09:47:13 +08:00
fisker Cheung
92e753b142
Fix import
2022-04-06 15:49:23 +08:00
fisker Cheung
4513fbfac2
Fix by linters
2022-04-06 15:46:28 +08:00
fisker Cheung
6016404f59
Merge branch 'main' into next
...
# Conflicts:
# .eslintrc.cjs
# .github/workflows/prod-test.yml
# .github/workflows/validate-vendors.yml
# scripts/build/bundler.mjs
# scripts/vendors/bundle-vendors.mjs
# scripts/vendors/utils.mjs
# scripts/vendors/vendor-meta.json
# scripts/vendors/vendors.mjs
# src/cli/logger.js
# src/cli/options/get-options-for-file.js
# src/cli/options/parse-cli-arguments.js
# src/common/util.js
# src/language-html/utils/html-tag-names.js
# tests/integration/__tests__/bundle.js
# tests/integration/__tests__/loglevel.js
# tests/integration/run-prettier.js
# vendors/string-width.js
2022-04-06 15:41:50 +08:00
fisker Cheung
86b64183f1
Enable unicorn/no-unreadable-iife and unicorn/prefer-native-coercion-functions rule ( #12594 )
2022-04-06 10:08:49 +08:00
dependabot[bot]
c23e24ee11
Build(deps): Bump leven from 3.1.0 to 4.0.0 ( #11349 )
2022-04-02 11:47:46 +00:00
dependabot[bot]
f4d4dc1177
Build(deps): Bump strip-ansi from 6.0.0 to 7.0.0 ( #10731 )
2022-04-02 11:24:18 +00:00
fisker Cheung
4d1b9e9716
Refactor: Add a wrapped normalizeCliOptions version for CLI usage ( #12573 )
2022-04-02 19:01:07 +08:00
fisker Cheung
42f6a4a690
Fix
2022-03-24 15:07:08 +08:00
fisker Cheung
a21dfbfa21
Merge branch 'main' into next-rebase
...
# Conflicts:
# .eslintrc.cjs
# package.json
# scripts/build/bundler.mjs
# scripts/build/config.mjs
# scripts/build/esbuild-plugins/replace-module.mjs
# src/cli/file-info.js
# src/cli/find-config-path.js
# src/cli/index.js
2022-03-24 15:02:29 +08:00
fisker Cheung
5ef82125a9
CLI: Don't use logger to print information ( #12477 )
2022-03-21 10:38:48 +08:00
fisker Cheung
9b2dc0e4e6
Build: Fix build script for next branch ( #12483 )
2022-03-17 21:22:52 +08:00
fisker Cheung
c95c899b6f
Merge branch 'main' into next
...
# Conflicts:
# package.json
# scripts/build/bundler.mjs
# scripts/build/config.mjs
# scripts/vendors/vendor-meta.json
# scripts/vendors/vendors.mjs
# src/cli/format.js
# src/cli/logger.js
# src/cli/options/get-options-for-file.js
# src/cli/options/parse-cli-arguments.js
# src/main/core.js
# tests/config/install-prettier.js
# vendors/execa.js
# vendors/mem.js
# vendors/string-width.js
# vendors/tempy.js
# yarn.lock
2022-03-17 09:44:08 +08:00
fisker Cheung and Sosuke Suzuki
cae195187f
Fix diff package import ( #12462 )
...
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com >
2022-03-15 12:36:13 +08:00
fisker Cheung
4b7a39c936
Update chalk to v5 ( #12446 )
2022-03-15 09:40:25 +08:00