Commit Graph
5494 Commits
Author SHA1 Message Date
Georgii Dolzhykov 109492a497 Clarify prettier.format docs (#10499) 2021-03-10 02:54:50 +02:00
fisker Cheung 02f803ac8d JSON: Only allow +/- number in UnaryExpression (#10434) 2021-03-09 10:58:31 +08:00
046ffb11f9 Support better formatting for curried arrow functions (#9992)
* Support formatting for curried arrow functions

* Fix test file name

* Fix threshold

* Add changelog

* Fix operator for comparing

* Fix return pos

* Fix eslint

* level 2

* Refactor for level2

* Update tests

* Remove concat

* If it fits on one line, print on one line

* Indent second level arg

* Break before last return value

* Use isCallLikeExpression

* Improve printing

* Add tests

* Remove unnecesary condition

* Fix lint problems

* Update src/language-js/utils.js

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>

* Update changelog

* Add ImportExpression

* Add ImportExpression to isCallLikeExpression

* Resolve conflicts

* Address reviews

* Fix ESLint problem

* Fix changelog

* Add tests

* More tests

* Print simple arrow chains on one line

* Don't forcibly break chain when a segment has a return type but no params

* Prevent excessive wrapping in assignments

* Simplify

* Format object bodies like blocks

* Update changelog

* Fix last arg expansion

* Simplify

* Fix arrow chains in assignment chains

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-08 23:18:53 +02:00
fisker Cheung 94775e88ef Build: Fix rollup warning (#10487) 2021-03-08 17:08:47 +02:00
dependabot[bot] e0916e4979 Build(deps): Bump typescript from 4.2.2 to 4.2.3 (#10482) 2021-03-08 00:42:36 +00:00
dependabot[bot] 28179b8a50 Build(deps-dev): Bump webpack from 5.24.2 to 5.24.3 (#10484) 2021-03-07 22:29:50 +00:00
dependabot[bot] 65beebf14c Build(deps-dev): Bump eslint-plugin-jest from 24.1.5 to 24.1.8 (#10483) 2021-03-07 22:28:58 +00:00
dependabot[bot] 2558a0c4ab Build(deps-dev): Bump rollup-plugin-polyfill-node from 0.5.0 to 0.6.1 (#10471) 2021-03-07 21:13:07 +00:00
dependabot[bot] bb1be0d409 Build(deps): Bump @angular/compiler from 11.2.3 to 11.2.4 (#10476) 2021-03-07 21:11:50 +00:00
dependabot[bot] b6f53f93dc Build(deps-dev): Bump @babel/preset-env from 7.13.8 to 7.13.9 (#10474) 2021-03-07 21:11:15 +00:00
dependabot[bot] 689a8e55f0 Build(deps): Bump clipboard from 2.0.6 to 2.0.7 in /website (#10475) 2021-03-07 21:10:21 +00:00
dependabot[bot] c0bcfb40da Build(deps-dev): Bump webpack from 5.24.2 to 5.24.3 in /website (#10472) 2021-03-07 21:06:37 +00:00
dependabot[bot] 6561457fc1 Build(deps): Bump meriyah from 4.1.4 to 4.1.5 (#10477) 2021-03-07 21:05:54 +00:00
fisker Cheung c7f9b9d1e8 Fix a wrong condition (#10478)
* Add rule

* Fix
2021-03-07 12:19:38 +02:00
Sosuke Suzuki c9144daf47 Support TS 4.2 abstract construct types via ts-estree (#10466) 2021-03-06 19:16:51 +02:00
Georgii Dolzhykov ceb7ee62f8 typechecking: remove @typescript-eslint/types from devDependencies (#10470)
@typescript-eslint/typescript-estree reexports these types.
2021-03-06 17:10:50 +02:00
fisker Cheung 2f6580bebc Simplify babel parser (#10437) 2021-03-05 19:27:08 +08:00
Sosuke Suzukiandfisker Cheung f1b5720fc7 Remove unstable AST testing (#10462)
* Add unstable AST testing for json-stringify parser

* Deduplicate yarn.lock

* Ignore `tokens`

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-03-05 12:17:42 +02:00
Sosuke Suzuki eb5139b7a9 Remove unnecessary condition (#10032) 2021-03-05 09:24:46 +02:00
fisker CheungandGeorgii Dolzhykov 8a1ee9ad1b Support JSON6 (#10456)
* Add test

* Support JSON6

* Test

* Print `null` instead of holes

* More tests

* Update changelog

* Style

* Minor refactor

* Fix AST clean

* Fix `Identifier` clean

* Fix AST compare

* Style

* Reword changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-04 19:37:42 +02:00
Georgii Dolzhykov 37aa31e929 Remove hacks for single-element unions/intersections (#10457)
* Remove hacks for degenerate unions/intersection

* Add changelog
2021-03-04 01:21:03 +02:00
Georgii DolzhykovandSosuke Suzuki 5f8fee4d07 Prevent wrapping object properties with short keys (#10335)
* Prevent wrapping object properties with short keys

* Update src/language-js/print/assignment.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

* Use getStringWidth instead of .length

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-03-03 01:43:46 +02:00
fisker Cheung 2f384ab24a JSON: More JSON5 data tests (#10453) 2021-03-02 13:43:48 +08:00
fisker Cheung 2edfec5eda JSON: Better error message (#10452) 2021-03-02 13:42:49 +08:00
Georgii Dolzhykov 23b4822e66 Disable Jest's default transformer (Babel) (#10454)
* Disable Jest's default transform (Babel)

https://jestjs.io/docs/en/next/code-transformation#defaults

Otherwise, I sometimes get this error because Babel tries to resolve Browserslist:

----
  ● plugin search should not crash when prettier isn't inside a directory › encountered a declaration exception

    ENOENT: no such file or directory, stat '/mnt/d/dev/prettier/tests_integration/mnt/d/dev/prettier/tests_integration/runPrettier.js'

      52 |   jest.spyOn(fs, "statSync").mockImplementation((filename) => {
      53 |     if (path.basename(filename) === "virtualDirectory") {
    > 54 |       return origStatSync(path.join(__dirname, __filename));
         |              ^
      55 |     }
      56 |     return origStatSync(filename);
      57 |   });

      at Object.<anonymous> (tests_integration/runPrettier.js:54:14)
      at isFile (node_modules/browserslist/node.js:38:42)
      at eachParent (node_modules/browserslist/node.js:46:13)
      at Object.getStat (node_modules/browserslist/node.js:197:15)
      at browserslist (node_modules/browserslist/index.js:433:19)
      at resolveTargets (node_modules/@babel/helper-compilation-targets/lib/index.js:174:46)
----
2021-03-01 13:55:20 +02:00
fisker Cheung ed9e9ab649 Improve json error code frame (#10433) 2021-03-01 10:04:09 +08:00
fisker Cheung 7aff95cac1 Refactor semicolon check (#10355) 2021-03-01 10:03:28 +08:00
fisker Cheung 9324380c53 JSON: Disallow sparse array (#10443) 2021-03-01 09:53:32 +08:00
dependabot[bot] 1227207909 Build(deps): Bump string-width from 4.2.1 to 4.2.2 (#10448)
Bumps [string-width](https://github.com/sindresorhus/string-width) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/sindresorhus/string-width/releases)
- [Commits](https://github.com/sindresorhus/string-width/compare/v4.2.1...v4.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-01 09:51:25 +08:00
fisker Cheung ed64ce0f0e JSON: Allow Infinity and NaN (#10451) 2021-03-01 09:14:20 +08:00
dependabot[bot] 39c0653846 Build(deps): Bump typescript from 4.1.5 to 4.2.2 (#10425) 2021-03-01 00:10:39 +00:00
dependabot[bot] 757ed71fe8 Build(deps-dev): Bump rollup from 2.39.0 to 2.40.0 (#10444) 2021-02-28 21:06:39 +00:00
Sosuke Suzuki fc396277fc Support TS 4.2 abstract constructor signature (#10418) 2021-02-28 22:00:17 +02:00
dependabot[bot] 001189677d Build(deps): Bump @angular/compiler from 11.2.1 to 11.2.3 (#10439) 2021-02-28 19:47:12 +00:00
dependabot[bot] dbc43961b3 Build(deps): Bump unified from 9.2.0 to 9.2.1 (#10431) 2021-02-28 19:46:02 +00:00
fisker CheungandGeorgii Dolzhykov 383e17665e Refactor decorators print (#10296)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-01 02:58:43 +08:00
Georgii Dolzhykov 4a8fe3bc3c Fix --debug-print-doc (#10445) 2021-02-28 20:52:57 +02:00
dependabot[bot] 92c26b0120 Build(deps): Bump @typescript-eslint/typescript-estree (#10438) 2021-02-28 18:52:01 +00:00
Georgii Dolzhykov ff7a194e8a Recreate yarn.lock 2021-02-28 18:49:56 +02:00
dependabot[bot] 5af3e4612b Build(deps): Bump meriyah from 4.1.2 to 4.1.4 (#10442) 2021-02-28 13:20:40 +00:00
dependabot[bot] 93d7132aad Build(deps): Bump string-width from 4.2.0 to 4.2.1 (#10441)
Bumps [string-width](https://github.com/sindresorhus/string-width) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/sindresorhus/string-width/releases)
- [Commits](https://github.com/sindresorhus/string-width/compare/v4.2.0...v4.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 20:13:39 +08:00
dependabot[bot] bb165ae974 Build(deps-dev): Bump @rollup/plugin-replace from 2.3.4 to 2.4.1 (#10440)
Bumps [@rollup/plugin-replace](https://github.com/rollup/plugins) from 2.3.4 to 2.4.1.
- [Release notes](https://github.com/rollup/plugins/releases)
- [Commits](https://github.com/rollup/plugins/compare/replace-v2.3.4...replace-v2.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 18:08:35 +08:00
dependabot[bot] 86b593cad5 Build(deps-dev): Bump @babel/types from 7.12.17 to 7.13.0 (#10428) 2021-02-28 08:37:38 +00:00
dependabot[bot] bf6cdea1d0 Build(deps-dev): Bump @babel/preset-env from 7.12.17 to 7.13.8 (#10436)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 15:42:57 +08:00
dependabot[bot] be957c91c7 Build(deps-dev): Bump @typescript-eslint/types from 4.15.1 to 4.15.2 (#10435) 2021-02-28 06:46:15 +00:00
dependabot[bot] b400a34a1a Build(deps-dev): Bump @babel/core from 7.12.17 to 7.13.8 (#10429)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.17 to 7.13.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.8/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 13:35:25 +08:00
dependabot[bot] 30594d30e5 Build(deps-dev): Bump webpack from 5.23.0 to 5.24.2 (#10432)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 13:34:29 +08:00
fisker Cheung c163d346d4 Extract json parser (#10405) 2021-02-28 11:38:21 +08:00
dependabot[bot] d800fd001e Build(deps-dev): Bump eslint-config-prettier from 8.0.0 to 8.1.0 (#10427) 2021-02-28 03:14:46 +00:00
dependabot[bot] 77e992b01d Build(deps-dev): Bump webpack from 5.23.0 to 5.24.2 in /website (#10430)
Bumps [webpack](https://github.com/webpack/webpack) from 5.23.0 to 5.24.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.23.0...v5.24.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-28 10:34:32 +08:00