Commit Graph
208 Commits
Author SHA1 Message Date
fisker Cheung 5b962d6f14 Extract inferParserByLanguage to seperate file (#13483) 2022-09-18 19:25:21 +08:00
fisker Cheung 9bacc75772 Use .at() and Object.hasOwn() (#13482) 2022-09-18 17:50:14 +08:00
fisker Cheung 61d4cb0813 Simplify print pre-check with AstPath getters (#13474) 2022-09-13 19:50:21 +08:00
Georgii Dolzhykov 47350dba05 Avoid throwing in path getters (#13455) 2022-09-11 21:53:31 +03:00
Georgii Dolzhykovandfisker Cheung 299503f9be Add getters to path object (#13448)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-09-09 21:28:14 +08:00
fisker Cheung 30f8825cb0 Add cause to parse error (#13342) 2022-08-30 10:27:11 +08:00
fisker Cheung 5aadab6f28 Support ESM plugins (#13201) 2022-08-06 10:42:27 +08:00
fisker Cheung e096ea7552 Use try/finally in AstPath (#13216) 2022-08-05 21:58:54 +08:00
fisker Cheung cdb1494170 Revert "Switch print/embed to async (#13104)" (#13210) 2022-08-02 18:11:34 +08:00
fisker Cheung bb203e3fa5 Simplify plugin loading (#13138) 2022-08-01 10:48:37 +08:00
fisker Cheung 8dae4abf41 Switch print/embed to async (#13104) 2022-07-17 16:10:06 +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
fisker Cheung 29f6bc2c6d Migrate third-party.js to ES Module (#13092) 2022-07-12 10:20:11 +08:00
fisker Cheung 133a25091f Simplify getFileInfo() (#12802) 2022-05-08 17:10:47 +08:00
fisker Cheung 193365eb71 Load plugins asynchronously (#12790) 2022-05-06 09:27:54 +08:00
fisker Cheung 34fadbe67d Remove {resolveConfig,resolveConfigFile,getFileInfo}.sync (#12788) 2022-05-05 19:15:08 +08:00
fisker Cheung c1f6d021e5 Use named export instead of default export (#12740) 2022-05-05 15:03:08 +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
Sosuke Suzukiandfisker 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
dependabot[bot]andfisker Cheung 237e681936 Build(deps): Bump escape-string-regexp from 4.0.0 to 5.0.0 (#10725)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-04-02 18:34:21 +08:00
fisker Cheung 3bb69beabf Use node: protocol (#12373) 2022-03-02 13:44:00 +08:00
fisker Cheung 9dbda43a2d Replace lodash with lodash-es (#12376) 2022-02-28 19:48:27 +08:00
fisker Cheung af103ae766 Migrate src/{document,utils}/** to ES Modules (#12345) 2022-02-28 11:12:37 +08:00
fisker Cheung 05aa5e16d6 Migrate src/{main,common,config}/** to ES Modules (#12344) 2022-02-23 20:16:30 +08:00
fisker Cheung 52c9a20e2c Merge branch 'main' into next
# Conflicts:
#	package.json
#	src/cli/index.js
#	tests/config/install-prettier.js
#	tests/format/yaml/block-literal/jsfmt.spec.js
#	tests/integration/__tests__/file-info.js
#	yarn.lock
2022-02-21 16:12:59 +08:00
fisker CheungandAlexander Kachkaev 3ba48bb266 Add --no-plugin-search (#10274)
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
2022-02-18 16:36:53 +08:00
fisker Cheung 56791a2624 Migrate src/*.js to ES Module (#12278) 2022-02-17 09:47:35 +08:00
fisker Cheung 491825dd9b Migrate CLI to ES Module (#11903) 2022-02-11 09:56:58 +08:00
Jed Fox 98f560839c Include vendors/ when installing from GitHub (#12250) 2022-02-06 23:22:44 -05:00
Sosuke Suzuki 0abd1907bb Bundle Pure ESM Packages into /vendors/*.js as CommonJS (#12217)
* string-width

* Add bundle script

* Update package.json

* mem

* Add version validator

* Throw error

* Change filename

* Add documents

* Generate d.ts

* Fix lint problems

* globby

* Add workflow to validate vendor versions

* Fix eslintignore

* Fix

* Fix spell

* Address review

* process.exitCode = 1

* test validation

* Revert "test validation"

This reverts commit 5a86d5f71212e0e900709238a8cc109716678864.

* Remove exists files

* Fix conflicts

* Clean

* Remove globby
2022-02-06 17:31:50 +09:00
Bogdan Chadkin 76bb0226d5 Replace globby with fast-glob (#12223)
There is already fast-glob used in src/cli/expand-patterns.js
Here I migrate everywhere to it from globby which is a thin wrapper with
a couple of unused here features.

```
du -ck dist
```
17280 kB
17260 kB
2022-02-05 10:24:10 -03:00
Sosuke Suzuki 54df16cdf5 Extract text utils that is used by babel-parser.js (#12203) 2022-01-31 00:45:58 +09:00
Sosuke Suzuki bb130d2d6e Extract getStringWidth (#12173) 2022-01-27 19:24:11 +09:00
Sosuke Suzuki b0e87946e9 refactor: Use default export for some utils (#12168) 2022-01-27 17:23:35 +08:00
Sosuke Suzuki 23dea6c0bb Reduce JS parsers bundle size 2 (#12164)
* Move get-shebang

* Use `getLast` directly

* Move `isNonEmptyArray`
2022-01-27 15:44:53 +09:00
dependabot[bot]andfisker Cheung ae56136a66 Build(deps): Bump ignore from 4.0.6 to 5.2.0 (#11990)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-12-22 15:40:57 +08:00
Jere Kankaanrantaandfisker Cheung 82e6937d50 Added changelog and updated the "first available in" version for singleAttributePerLine (#11934)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-12-07 14:13:26 +08:00
fisker Cheung e2d07b35ec Enable unicorn/prefer-switch (#11935) 2021-12-07 14:13:12 +08:00
Jere Kankaanranta 0e42acb49b feat: added singleAttributePerLine option (#5501) (#6644) 2021-12-02 11:46:11 +03:00
Cyrille 2f9663b6fa Refactor and use getPreferredQuote in both jsx and handlebars printers (#11569)
* raw => rawContent

* Refactor getPreferredQuote

Exposing { quote, regex, escaped } from the getPreferredQuote return
value allows us to simplify a bit the code in the printer.

* Use the common/util function

And remove chooseEnclosingQuote

* Move favoriteQuote

* Fix lint

* Remove enclosing quotes _before_ unescape
2021-09-24 06:32:32 +09:00
4992d97203 Deprecate jsxBracketSameLine option in favour of multi-language bracketSameLine option (#11006)
* deprecate jsxBracketSameLine in favour of multi-language angleBracketSameLine option

* update docs and snapshots

* update tests to to make them more reviewable

* Rewrite angular tests

* Rewrite html tests

* Rewrite vue tests

* Restore unnecessary changes in jsx

* Fix file location

* Test both `true` and `false`

* Revert changes in markdown

* Run tests on all js parsers

* Improve html test

* fix changelog comment

* move bracketSameLine to common options

* mark jsxBracketSameLine as deprecated

* Update changelog_unreleased/html/11006.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>

* Update 11006.md

* fix tests by removing `jsxBracketSameLine` `default` property

* fix style

* Revert docs under website dir

* Add tests for deprecated options

* Fix lint problems

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2021-08-31 11:47:50 +09:00
Sosuke Suzuki 9dcfd16e6a Use ts-expect-error instead of ts-ignore (#11330) 2021-08-09 00:00:22 +09:00
fisker Cheung 894f841fbd Style: Enforce extensions (#11227) 2021-07-21 09:10:34 +08:00
fisker Cheung d3b777dd7d Update build script (#10946) 2021-05-27 08:54:42 +08:00
fisker Cheung 9b7ba8a42c Style: Use dotAll regexp (#10864) 2021-05-18 02:44:21 +08:00
fisker Cheung 085e38bffb Move replaceEndOfLineWith to docUtils (#10862) 2021-05-17 20:10:44 +03:00
Sosuke Suzuki cedf4800ae Add JSDoc type for isNonEmptyArray (#10902) 2021-05-17 20:51:47 +08:00
fisker Cheung 98abb990cc Use Object.fromEntries(), Array#flat() and Array#flatMap() (#10853) 2021-05-12 01:05:29 +08:00
Georgii Dolzhykovandfisker Cheung bc90973cad Avoid arg expansion that leads to broken code (#10712)
* Avoid arg expansion that leads to broken code

* Preserve new lines and only take comments into account if they break lines

* Add robustness against path state corruption due to throwing

* Refactor

* Remove redundant logic

It solved the same issue but only partially.

* Simplify further

* Refactor path.try, fix callParent issue

* Minor refactoring

* Add istanbul ignore comment

* Add return to AstPath#try

Co-authored-by: fisker Cheung <lionkay@gmail.com>

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-04-20 15:02:11 +03:00