Commit Graph
100 Commits
Author SHA1 Message Date
Sosuke Suzuki e92dcbd1a5 Add new ESLint prefer-ast-path-node (#13470)
* Add new lint rule `prefer-path-get-value`

* Add new rule

* Apply fix

* Ingore projects in benchmark

* Add comment
2022-09-11 18:39:06 +09:00
Sosuke Suzuki e3ef1e4566 Drop Node.js 14 for development build (#13439)
* Drop Node.js 16 for development

* Fix engine

* Address review
2022-09-08 01:03:45 +09:00
Sosuke Suzuki 1142cf0cb7 Fix generate truncate comment (#13437)
Fix condition
2022-09-07 18:11:10 +09:00
Sosuke Suzuki 40af3ed1ca Keep trailing-comma for var function (#13402)
* Keep trailing-comma for last el

* Make hasComma function

* Fix tests

* Add changelog
2022-08-31 00:59:34 +09:00
Sosuke Suzuki 68bd87b24b Fix generated changelog comment for css like syntax (#13403)
Fix generated comment for css like syntax
2022-08-31 00:59:20 +09:00
Sosuke Suzukiandfisker Cheung 726ad132d8 Update Jest to v29 (#13355)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-08-28 20:02:55 +08:00
Sosuke Suzuki 503045c050 Use import() for postcss parsers (#13277)
* Import core parsers

* Import media parser

* Import selector parser

* Import value parser

* Remove require

* Improve imports

* Fix bundle config
2022-08-15 22:30:46 +09:00
Sosuke Suzukiandfisker Cheung 7d74e821e0 Use import() for html parser (#13270)
* Use `import()` for html parser

* Update src/language-html/parser-html.js

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

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-08-12 23:49:45 +09: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
Sosuke SuzukiandHolger 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
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
Sosuke Suzuki 75c8d46ab4 Drop Node.js 12 Support (#13118)
* Drop Node.js 12 Support

* Update CHANGELOG

* Update build target

* Comment out

* Remove node 14 from `exclude`

* Update CI

* Update changelog_unreleased/api/11830.md
2022-07-17 04:26:27 +09:00
Sosuke Suzuki 33fcc6c4dd Update requirements (#13117) 2022-07-17 00:08:47 +09:00
Sosuke Suzuki 89f90fc013 Insert spaces in pipe (#13100)
* Insert spaces to pipe arguments

* Update snapshots

* Add changelog

* Fix lint problem
2022-07-16 17:18:55 +09:00
Sosuke Suzuki ae3dd17114 Refactor: Extract printEndOfOpeningTag (#13086)
* Refactor

* Rename

* Fix typo
2022-07-09 20:05:27 +09:00
Sosuke Suzuki fde0b49d78 Run prettier 2022-06-18 21:49:24 +09:00
Sosuke Suzuki 6b388faa50 Add truncate 2022-06-14 15:36:02 +09:00
Sosuke Suzukiandfisker Cheung 934068ac6a Add 2.7 blog post (#12966)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-06-14 14:25:40 +08:00
Sosuke Suzuki 2316e2fecd Update linguist-language (#12994)
* Install new `linguist-language`

* Remove `.mts` and `.cts`

* Update tests
2022-06-12 01:55:11 +09:00
sosukesuzuki e5868ad368 Update changelog 2022-06-11 23:36:35 +09:00
Sosuke SuzukiandSimon 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
Sosuke Suzuki 97bab8f984 Update angular-estree-parser (#12993)
* Update `angular-estree-parser`

* Add tests

* Add changelog
2022-06-11 20:08:46 +09:00
Sosuke Suzuki 7f9a08762d Update dependency flow-parser to v0.180.0 (#12990)
* Update `flow-parser`

* Update snapshots
2022-06-11 00:06:22 +09:00
Sosuke Suzuki be9d63e543 Avoid printing attribute per line in Vue SFC blocks (#12895)
* Avoid print single attribute perline for Vue SFC blocks

* Add tests

* Add changelog

* Fix typo

* Add more tests
2022-06-04 23:25:27 +09:00
Sosuke Suzuki a808df643d Update @typescript-eslint/typescript-estree to 5.27.0 and move tests (#12959)
* Install latest typescript-estree

* Move tests for type parameter of typeof

* Update changelog
2022-06-01 06:47:51 +09:00
Sosuke Suzuki 9c11aa141a Add tests for TS 4.7 features (#12924)
* Add tests for instantiation expressions

* Add tests for infer extends

* Add tests for optional variance

* Update changelog
2022-05-28 03:37:30 +09:00
Sosuke Suzuki 3147244f55 Update dependencies to support TypeScript 4.7 (#12921)
* Update `@typescript-eslint/typescript-estree` to 5.26.0

* Update `typescript` to `4.7.1-rc`

* Fix syntax kind

* Add `jsdoc_only_types.ts` to unstable tests

* Make printing jsdoc type stable

* Update typescript
2022-05-27 01:46:31 +09:00
Sosuke Suzuki 5b113e71b1 Add changelog for TypeScript 4.7 (#12901) 2022-05-22 03:33:18 +09:00
Sosuke Suzuki 2fc6e5dd4f Support TS 4.7 optional variance (#12900)
* Print `in` and `out`

* Add tests

* Add tests for jsx
2022-05-22 03:33:05 +09:00
Sosuke Suzuki 1eecc85985 Support TS 4.7 instantiation expression (#12898)
* Handle `TSInstantiationExpression`

* Print `typeParameters` for `TSTypeQuery`

* Add tests

* Add more tests
2022-05-22 03:30:47 +09:00
Sosuke Suzuki bc6539c15c Add tests for extends constraints for infer (#12897) 2022-05-22 03:28:47 +09:00
Sosuke Suzuki a1efda838a Update @babel/parser (#12896) 2022-05-21 23:00:06 +09:00
Sosuke Suzuki 36c20c51bc Support Speculation Rules API formatting in HTML (#12882)
* Add script formatting for `speculationrules`

* Fix lint problems
2022-05-17 10:38:46 +09:00
Sosuke Suzuki 9fd05e8de5 Sort options (#12801) 2022-05-07 15:18:52 +09:00
Sosuke Suzuki fe6820e815 Try to fix pnpm error on Dev Package Tests (#12774)
* Remove `-y` from `pnpm init`

* Change
2022-05-01 11:49:15 +09:00
Sosuke Suzuki 9348049311 Refactor: Use optional chaining in src/language-js/comments.js (#12747)
* Use optional chaining in `src/language-js/comments.js`

* Using sets

* Address review
2022-04-30 21:16:43 +09:00
Sosuke Suzuki 504d751036 Preserve blank line between export specifiers (#12746)
* Preserve blank line between export specifiers

* Add changelog

* rename
2022-04-29 17:42:42 +09:00
Sosuke Suzuki a4cba80dc0 Allow formatting for Vue template expression written in TypeScript (#12584)
* Support TS expression in vue SFC

* Add changelog

* Add `__ts_expression`

* Add `__vue_ts_expression`

* Add tests

* Do not use `ast.walk`

* Address review

* Add `__vue_ts_event_binding`

* Fix
2022-04-17 13:12:19 +09: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
Sosuke Suzukiandfisker Cheung f8ce0e303b Fix HTML AST JSON serializer for debugging (#12611)
* Add `JSON.stringify` replacer

* Fix serializer for playground

* Use `opt.parser`

* Consitent style

* lwc

* Revert "lwc"

This reverts commit 799bf357e8b30765944b29639a45b3c326bce615.

Revert "Use `opt.parser`"

This reverts commit 3046f52798ce740ea0ed267bf46c3221606b1fbc.

Revert "Add `JSON.stringify` replacer"

This reverts commit 54266cde61ea8f7cc4b3b0c9714559c93b456923.

* Rewrite `Node` class

* Revert changes in playground

* Revert wrong changes

* Update clean.js

* Set `configurable: true`

* Fix missing `return`

* Fix: "children" and "attrs" are enumerable

* Type check

* Revert unnessary change

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-04-08 23:36:23 +09:00
Sosuke Suzuki 41ebbb0a0d Update vendors (#12585) 2022-04-03 10:27:05 +09:00
Sosuke Suzuki 8a52865cf9 Clean changelog_unureleased 2022-04-03 01:37:22 +09:00
Sosuke Suzuki 54b5418936 Merge branch 'patch-release' into main 2022-04-03 01:35:53 +09:00
Sosuke Suzuki 3abd7c9cd6 Git blame ignore 2.6.2 2022-04-03 01:33:49 +09:00
Sosuke Suzuki e2d9e9139d Bump Prettier dependency to 2.6.2 2022-04-03 01:33:49 +09:00
Sosuke Suzuki d2b63070af Update dependents count 2022-04-03 01:33:18 +09:00
Sosuke Suzuki d6f82a024a Release 2.6.2 2022-04-03 01:31:20 +09:00
Sosuke Suzukiandfisker Cheung 2bca9d65f4 Add new workflow to prevent updating users.yml (#11784)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-04-03 00:32:34 +09:00
Sosuke Suzuki 875694e3a9 Install dependencies for website (#12566) 2022-04-03 00:32:33 +09:00
Sosuke Suzukiandfisker Cheung 6d7c8ac387 Add new workflow to prevent updating users.yml (#11784)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-04-02 20:46:14 +08:00
Sosuke Suzuki 250847c2cc Install dependencies for website (#12566) 2022-03-31 22:50:48 +09:00
Sosuke Suzuki f7f13dcf82 Clean changelog_unreleased 2022-03-25 15:24:55 +09:00
Sosuke Suzuki f35121bde4 Git blame ignore 2.6.1 2022-03-25 14:01:16 +09:00
Sosuke Suzuki 678fe1562d Bump Prettier dependency to 2.6.1 2022-03-25 14:01:16 +09:00
Sosuke Suzuki 348ee15661 Update dependents count 2022-03-25 14:00:46 +09:00
Sosuke Suzuki ad505bf771 Release 2.6.1 2022-03-25 13:58:22 +09:00
Sosuke Suzuki 0e6c1d58d8 Enter OTP via enquirer (#12528) 2022-03-24 23:47:29 +09:00
Sosuke Suzuki becb6c9b74 Fix non-idempotent formatting of function calls with complex type arguments (#12508)
* Fix

* Add TS tests

* Add Flow tests

* Add changelog
2022-03-23 23:09:58 +09:00
Sosuke Suzuki 0d34974a07 Run prettier after release (#12472) 2022-03-16 18:38:31 +08:00
Sosuke Suzuki 58e48b79da Clean changelog_unreleased 2022-03-16 13:35:41 +09:00
eb671dd983 2.6 blog post (#12412)
* Generate

* Generate

* Add TS4.6 changelog

* Regenerate

* Add changelog to switch to esbuild

* Add category

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Address review

* Regenerate

* Highlight TS 4.6

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Regenerate

* Update changelog_unreleased/typescript/12390.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Add thanks message for sponsors

* Address review!

* Update cspell.json

* Fix link of Ubie

* Generate

* Add `Thanks to our sponsors!`

* Update cspell

* Address review

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>

* Regenerate

* Add `--print-truncate` option

* Address review

* Generate

Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
2022-03-16 13:25:48 +09:00
Sosuke Suzuki 2f45d9bcc3 Fix release script 2022-03-16 13:25:18 +09:00
Sosuke Suzuki 08bcf83a2e Update dependents count 2022-03-16 13:24:52 +09:00
Sosuke Suzuki 22e59fb8c6 Git blame ignore 2.6.0 2022-03-16 13:24:48 +09:00
Sosuke Suzuki f7c4423733 Bump Prettier dependency to 2.6.0 2022-03-16 13:24:48 +09:00
Sosuke Suzuki cba25e6b09 Release 2.6.0 2022-03-16 13:09:58 +09:00
Sosuke Suzuki 828b7a30ea Print trailing comma for rest elements in tuple types (#12390)
* Remove `hasRest` condition for printing tuple types

* Update snapshots

* Fix test file name

* Add changelog
2022-03-05 15:40:11 +09:00
Sosuke Suzukiandfisker Cheung 199a1bb389 Support decorator auto accessors syntax (#12299)
* Handle `ClassAccessorProperty`

* Disable file

* Add `babel-plugins` tests

* Add more tests

* Fix tests

* Fix typo

* Add changelog

* Fix printing for no-semi

* Update statement.js

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-03-02 16:00:50 +09:00
Sosuke Suzuki 162097e2d2 Format .swcrc as a JSON file (#12320)
* Format `.swcrc` as JSON

* Test `.swcrc` JSON formatting

* Add changelog

* Update snapshots

* Address reviews

* Update `cspell.json`

* Address review
2022-02-18 08:39:12 +09:00
Sosuke Suzuki 8c49fd0f6f Support destructuring private proposal (#12276)
* Enable `destructuringPrivate` plugiin

* Add tests

* Add changelog

* Add more tests
2022-02-14 11:28:47 +09:00
Sosuke Suzukiandfisker Cheung 0aff39fd2b Update docs about ./scripts/vendors (#12300)
* Update docs

* Update scripts/vendors/README.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-02-14 11:26:29 +09:00
Sosuke Suzuki b14b13d2cf Update tempy to 2.0.0 (#12247)
* Update `tempy`

* require `tempy` directly

* Fix

* Fix

* Vendors

* Remove `vendord.d.tsd`

* Fix path
2022-02-12 18:23:50 +09:00
Sosuke Suzuki 5fbb8cacc4 Add changelog for unicode set notation proposal (#12277)
* Add changelog for unicode set notation

* Fix typo
2022-02-12 17:56:35 +09:00
Sosuke Suzuki 34fbd099de Update execa to 6.0.0 (#12245)
* Update execa

* Fix

* require `execa` directly

* Run `vendors:bundle`

* Run `vendors:bundle`

* Generate dts with considering defautl export

* Remove `vendors-versions.json`
2022-02-12 12:07:22 +09:00
Sosuke Suzuki 6819dc91f6 Add an esbuild plugin to add @ts-nocheck annotation for vendors (#12248)
* Enable prettier

* Add `esbuildPluginTsNocheck`

* Run build

* Update cspell.json
2022-02-06 23:25:29 +09:00
Sosuke Suzuki fce558e97a Tweaks vendors (#12246)
* Add `scripts` for vendors

* Add links to README
2022-02-06 21:44:54 +09:00
Sosuke Suzuki 1f50c8417d Run tests for logical-assignment operators witn flow (#12244) 2022-02-06 21:07:02 +09: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
Sosuke Suzuki a0cc4ab43b Reduce bundle size of parser-postcss.js (#12204)
* Extract utils

* Move `utils.js` to `utils/index.js`
2022-01-31 16:46:47 +09: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 ff78a94424 Reduce bundle size of parser-html.js (#12176) 2022-01-28 10:07:37 +08:00
Sosuke Suzuki 893f43a599 Remove unused api at build time (#12171) 2022-01-27 19:24:36 +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
Sosuke Suzuki d13feed42b Reduce JS parsers bundle size (#12156)
* Extract utils

* utils.js -> utils/index.js

* Fix linter
2022-01-26 23:29:19 +09:00
Sosuke Suzuki db73cc8e0c Print end-of-line comment for continue/break statements (#12075)
* Add handleBreakAndContinueStatementComments to handleEndOfLineComment

* Add tests

* Add changelog

* Update tests

* Add more tests

* Fix for own line comments

* Fix tests

* Fix tests

* Fix tests

* Add unstable tests
2022-01-19 22:29:37 +09:00
Sosuke Suzuki 6ccc462409 Print comments for parenthesized TS keyword types (#12070)
* Prefer node.start for TS keyword types

* Add tests

* Add changelog

* Refactor

* Use isTsKeywordType

* Fix lint problems
2022-01-13 09:54:06 +09:00
Sosuke Suzuki c083abac94 Enable @typescript-eslint/prefer-ts-expect-error (#12071)
* Add @typescript-eslint/eslint-plugin

* Enable prefer-ts-expect-error

* Address review
2022-01-10 10:35:09 +09:00
Sosuke Suzuki d1132d5f2b Add a new blog post (#12046)
* Add new blog

* Fix typo
2022-01-06 11:50:30 +09:00
Sosuke Suzuki a50bc4e14a Preserve end-of-line comment for if statement without blocks (#12017)
* Print as dangling comments

* Add tests

* Add changelog

* Use symbol instead of string
2022-01-06 09:31:58 +09:00
Sosuke Suzuki 66e4597c0e Update acorn (#12039) 2022-01-03 04:22:42 +08:00
sosukesuzuki 59336b9791 Clean changelog_unreleased 2021-12-04 23:35:40 +09:00
sosukesuzuki c63f8617d5 Merge branch 'patch-release' into main 2021-12-04 23:33:56 +09:00
sosukesuzuki 2ae1f98475 Update dependents count 2021-12-04 23:33:30 +09:00
sosukesuzuki 7a8e42de18 Git blame ignore 2.5.1 2021-12-04 23:33:25 +09:00
sosukesuzuki 4683a6284d Bump Prettier dependency to 2.5.1 2021-12-04 23:33:25 +09:00
sosukesuzuki 56ed71d1c9 Release 2.5.1 2021-12-04 23:31:03 +09:00
Sosuke Suzukiandfisker Cheung c0250b3837 Improve formatting for empty tuple types (#11884)
* Don't print trailing comma when tuple is empty

* Add tests

* Don't print softline

* Add tests

* Update tests

* Add changelog

* Update changelog_unreleased/typescript/11884.md

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

* Fix names

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-12-04 22:21:21 +09:00
Sosuke Suzuki 046132520d Remove prepare-release script (#11913) 2021-12-03 18:06:15 +09:00