From 5e6610e815df8290710925ee63d01bea04d2a69d Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 17 Jul 2026 10:27:51 +0800 Subject: [PATCH] [3.9.x] Support `import defer` (#19624) --- changelog_unreleased/typescript/19624.md | 13 ++ package.json | 8 +- .../__snapshots__/format.test.js.snap | 4 - ...decorator-auto-accessors-abstract-class.ts | 1 - yarn.lock | 136 +++++++++--------- 5 files changed, 85 insertions(+), 77 deletions(-) create mode 100644 changelog_unreleased/typescript/19624.md diff --git a/changelog_unreleased/typescript/19624.md b/changelog_unreleased/typescript/19624.md new file mode 100644 index 000000000..b6162ab97 --- /dev/null +++ b/changelog_unreleased/typescript/19624.md @@ -0,0 +1,13 @@ +#### Support `import defer` (#19624 by @fisker) + + +```tsx +// Input +import defer * as foo from "foo"; + +// Prettier stable +import * as foo from "foo"; + +// Prettier main +import defer * as foo from "foo"; +``` diff --git a/package.json b/package.json index 180f4096b..bbdf9d672 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "@prettier/html-event-attributes": "0.0.2", "@prettier/html-tags": "2.2.0", "@prettier/parse-srcset": "3.1.0", - "@typescript-eslint/typescript-estree": "8.63.0", - "@typescript-eslint/visitor-keys": "8.63.0", + "@typescript-eslint/typescript-estree": "8.64.0", + "@typescript-eslint/visitor-keys": "8.64.0", "acorn": "8.17.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "15.5.0", @@ -138,8 +138,8 @@ "@eslint/js": "10.0.1", "@stylistic/eslint-plugin": "5.10.0", "@types/jsesc": "3.0.3", - "@typescript-eslint/eslint-plugin": "8.63.0", - "@typescript-eslint/parser": "8.63.0", + "@typescript-eslint/eslint-plugin": "8.64.0", + "@typescript-eslint/parser": "8.64.0", "base64-arraybuffer-es6": "3.1.0", "browserslist": "4.28.5", "browserslist-to-esbuild": "2.1.1", diff --git a/tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap b/tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap index 11cb51bd0..ce4862d09 100644 --- a/tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap @@ -111,7 +111,6 @@ abstract class Foo { declare accessor prop7: number; private accessor #p: any; - accessor a!; abstract accessor #s; accessor #d?; abstract accessor f; @@ -123,7 +122,6 @@ abstract class Foo { declare accessor prop7: number private accessor #p: any - accessor a! abstract accessor #s accessor #d? abstract accessor f @@ -142,7 +140,6 @@ abstract class Foo { declare accessor prop7: number; private accessor #p: any; - accessor a!; abstract accessor #s; accessor #d?; abstract accessor f; @@ -154,7 +151,6 @@ abstract class Foo { declare accessor prop7: number; private accessor #p: any; - accessor a!; abstract accessor #s; accessor #d?; abstract accessor f; diff --git a/tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts b/tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts index 7009742de..f47d2fb2c 100644 --- a/tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts +++ b/tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts @@ -2,7 +2,6 @@ abstract class Foo { declare accessor prop7: number; private accessor #p: any; - accessor a!; abstract accessor #s; accessor #d?; abstract accessor f; diff --git a/yarn.lock b/yarn.lock index 5b75528bd..1067afab7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,105 +2742,105 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/eslint-plugin@npm:8.63.0" +"@typescript-eslint/eslint-plugin@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.64.0" dependencies: "@eslint-community/regexpp": "npm:^4.12.2" - "@typescript-eslint/scope-manager": "npm:8.63.0" - "@typescript-eslint/type-utils": "npm:8.63.0" - "@typescript-eslint/utils": "npm:8.63.0" - "@typescript-eslint/visitor-keys": "npm:8.63.0" + "@typescript-eslint/scope-manager": "npm:8.64.0" + "@typescript-eslint/type-utils": "npm:8.64.0" + "@typescript-eslint/utils": "npm:8.64.0" + "@typescript-eslint/visitor-keys": "npm:8.64.0" ignore: "npm:^7.0.5" natural-compare: "npm:^1.4.0" ts-api-utils: "npm:^2.5.0" peerDependencies: - "@typescript-eslint/parser": ^8.63.0 + "@typescript-eslint/parser": ^8.64.0 eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: ">=4.8.4 <6.1.0" - checksum: 10/ab60da4c4a66e8b882b6d585457c6cd352492917940d43b255021f71fc057d327fe8e46856316b312a5c5b78b1245acb129869a7c60a7c2fa65e7822ef58c7c6 + checksum: 10/ec7cbcb44968386a4b9aff9272ce6b75bdcc7f398db5f2d07a21854baf0364ca33c74268c0e19d21386c6b87b9358b141df7bef3d26e4e4e7a9eb5f8f394dc75 languageName: node linkType: hard -"@typescript-eslint/parser@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/parser@npm:8.63.0" +"@typescript-eslint/parser@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/parser@npm:8.64.0" dependencies: - "@typescript-eslint/scope-manager": "npm:8.63.0" - "@typescript-eslint/types": "npm:8.63.0" - "@typescript-eslint/typescript-estree": "npm:8.63.0" - "@typescript-eslint/visitor-keys": "npm:8.63.0" + "@typescript-eslint/scope-manager": "npm:8.64.0" + "@typescript-eslint/types": "npm:8.64.0" + "@typescript-eslint/typescript-estree": "npm:8.64.0" + "@typescript-eslint/visitor-keys": "npm:8.64.0" debug: "npm:^4.4.3" peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: ">=4.8.4 <6.1.0" - checksum: 10/40ee2a1c703898b9c6df0731e5584ce0bf63d8c13fb464a952500dae156b68b41b522b2cb4755a2f0cb7e0d529b0888e3ba783e3eeb1236c062a3a7ca227f634 + checksum: 10/7239b16a6ca6bb1764ad04bc1eb46997336541d049fcffb4966ef404fbb02324b2b33aed50c2b976359ec8d3c97b90668cfd6aa9177228b4b799152f01a3904a languageName: node linkType: hard -"@typescript-eslint/project-service@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/project-service@npm:8.63.0" +"@typescript-eslint/project-service@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/project-service@npm:8.64.0" dependencies: - "@typescript-eslint/tsconfig-utils": "npm:^8.63.0" - "@typescript-eslint/types": "npm:^8.63.0" + "@typescript-eslint/tsconfig-utils": "npm:^8.64.0" + "@typescript-eslint/types": "npm:^8.64.0" debug: "npm:^4.4.3" peerDependencies: typescript: ">=4.8.4 <6.1.0" - checksum: 10/16b07d0e95abfbe56eccc7c67185caf43e9059740c82a09a0f0f4393539f89a19f8c1b996d396f9476401af55bd804897fd19c988712db3e0f36562d2805c223 + checksum: 10/511b9a8f1dcb32c99003cab9791309056ac6e889fe46227600deb743e869a63b3e78d7d2d3ef1bf65b2d5e574b73add3040fbef4c0f94aed587368aaea149559 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/scope-manager@npm:8.63.0" +"@typescript-eslint/scope-manager@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/scope-manager@npm:8.64.0" dependencies: - "@typescript-eslint/types": "npm:8.63.0" - "@typescript-eslint/visitor-keys": "npm:8.63.0" - checksum: 10/6b0183e85d79e287660274d39fed1fc8321ae03ae40545acaad6718fd2524063d302f3348c04576d038a25f16f8c9ca4e8780a0ad754f1a494a00027e867deda + "@typescript-eslint/types": "npm:8.64.0" + "@typescript-eslint/visitor-keys": "npm:8.64.0" + checksum: 10/3c72c4915cee19d632ddc7491c3a4668dd04aa8bcb112fde8ac10aea2cc0364aaa8439d9939d0c62a7b4159fc22f4ced7cba3a77df4422b21d76497068f08076 languageName: node linkType: hard -"@typescript-eslint/tsconfig-utils@npm:8.63.0, @typescript-eslint/tsconfig-utils@npm:^8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/tsconfig-utils@npm:8.63.0" +"@typescript-eslint/tsconfig-utils@npm:8.64.0, @typescript-eslint/tsconfig-utils@npm:^8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/tsconfig-utils@npm:8.64.0" peerDependencies: typescript: ">=4.8.4 <6.1.0" - checksum: 10/7c23671159f8593b676d53bc52b4a3bd4c3ad62abe2ad99b379b70298abf3b784cdcf18ca2b10f2aa62a9f8e0232e6efb87364940a3bd4a32126a357f39ac3c8 + checksum: 10/905469c5067a9a2d18d065848c6497081ab787b22a9d7c06499f4bb593b7d67f9fb17e7861a114c46626555853cc52d4542db5311c8dc7cd138e45461a73e589 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/type-utils@npm:8.63.0" +"@typescript-eslint/type-utils@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/type-utils@npm:8.64.0" dependencies: - "@typescript-eslint/types": "npm:8.63.0" - "@typescript-eslint/typescript-estree": "npm:8.63.0" - "@typescript-eslint/utils": "npm:8.63.0" + "@typescript-eslint/types": "npm:8.64.0" + "@typescript-eslint/typescript-estree": "npm:8.64.0" + "@typescript-eslint/utils": "npm:8.64.0" debug: "npm:^4.4.3" ts-api-utils: "npm:^2.5.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: ">=4.8.4 <6.1.0" - checksum: 10/8a1001edb129aec55c4ef8567f5f33af4b0ee92e89463f45e7d8a006872e438db1a3cbe2364769d205124d9d143018c920e165868788a0e7aee15466ed6d38f0 + checksum: 10/7ab1fd8c0d292c0155cf137d316b1618681eca0fe4cf446a05d909de41311ec6bb64fed82513e822063a962508d5b3e615fb0155a4a565d6b9c6cb81d06a5cd2 languageName: node linkType: hard -"@typescript-eslint/types@npm:8.63.0, @typescript-eslint/types@npm:^8.56.0, @typescript-eslint/types@npm:^8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/types@npm:8.63.0" - checksum: 10/f72eb114970cae0da8e53f68cd8dca1b51ac410f4438141a2851655fa07aacb3090e24a2ae53462cf0970e4d5b52cabf9693aa6f07abdff5c210874806427e5b +"@typescript-eslint/types@npm:8.64.0, @typescript-eslint/types@npm:^8.56.0, @typescript-eslint/types@npm:^8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/types@npm:8.64.0" + checksum: 10/b8951c00ce9b9702f3201f017354774ea5f39c30c2b6f815cb50d91f53f61c325e30f548329daf731d5169d752095cf102da54b754fb202bcfb619faa56fa9f4 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.63.0" +"@typescript-eslint/typescript-estree@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.64.0" dependencies: - "@typescript-eslint/project-service": "npm:8.63.0" - "@typescript-eslint/tsconfig-utils": "npm:8.63.0" - "@typescript-eslint/types": "npm:8.63.0" - "@typescript-eslint/visitor-keys": "npm:8.63.0" + "@typescript-eslint/project-service": "npm:8.64.0" + "@typescript-eslint/tsconfig-utils": "npm:8.64.0" + "@typescript-eslint/types": "npm:8.64.0" + "@typescript-eslint/visitor-keys": "npm:8.64.0" debug: "npm:^4.4.3" minimatch: "npm:^10.2.2" semver: "npm:^7.7.3" @@ -2848,32 +2848,32 @@ __metadata: ts-api-utils: "npm:^2.5.0" peerDependencies: typescript: ">=4.8.4 <6.1.0" - checksum: 10/793e0227698f4d8b325922816f27a4e737760aae255874c2021c5e2179499fd036b9e87bf0346ead6360444fb7ab4815bb558c94a17d8481632351bbdb2780bf + checksum: 10/833101d25e820d1d0e317dfc9beca985b3c87e5458b20ed002c86c2d425667aa506f756f1759b54f724033effb529266f836f912c460ee662f347fb43dded6ed languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.63.0, @typescript-eslint/utils@npm:^8.0.0": - version: 8.63.0 - resolution: "@typescript-eslint/utils@npm:8.63.0" +"@typescript-eslint/utils@npm:8.64.0, @typescript-eslint/utils@npm:^8.0.0": + version: 8.64.0 + resolution: "@typescript-eslint/utils@npm:8.64.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.9.1" - "@typescript-eslint/scope-manager": "npm:8.63.0" - "@typescript-eslint/types": "npm:8.63.0" - "@typescript-eslint/typescript-estree": "npm:8.63.0" + "@typescript-eslint/scope-manager": "npm:8.64.0" + "@typescript-eslint/types": "npm:8.64.0" + "@typescript-eslint/typescript-estree": "npm:8.64.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: ">=4.8.4 <6.1.0" - checksum: 10/017bd1998822902b5dde5af9e031908aeb8861565b947aa217d5641bac4758fb831c52629b600bb58a990fcfef1ca58eaf5b44595575bb71a43761c2f40a7f56 + checksum: 10/ff7e5374bd6ef60d7df723e6440468e3a5d4879d1d9876e322904319a1f1d2f98d858fc9b9169dbbd7ee0786a07102a058f13e2b6c16d1bf9aae9eb836a258a3 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.63.0": - version: 8.63.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.63.0" +"@typescript-eslint/visitor-keys@npm:8.64.0": + version: 8.64.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.64.0" dependencies: - "@typescript-eslint/types": "npm:8.63.0" + "@typescript-eslint/types": "npm:8.64.0" eslint-visitor-keys: "npm:^5.0.0" - checksum: 10/9edcff478ba98f81f843b0c02874f3ef58c15b1001b2cf74d878416340c460a7c6e37442b4bee3ef226f0029131d620ee05a9ee3d19ec694ffa07fcf9a7a03ca + checksum: 10/d149be4ac0e67c51097cdb7335d8e2d29b9dc0de173961c5cc550e938a00a3af28b1f8ecd7ad832fcfe489d1b11e36fdd394b6ea92115a7558123562e31a704f languageName: node linkType: hard @@ -8205,10 +8205,10 @@ __metadata: "@prettier/parse-srcset": "npm:3.1.0" "@stylistic/eslint-plugin": "npm:5.10.0" "@types/jsesc": "npm:3.0.3" - "@typescript-eslint/eslint-plugin": "npm:8.63.0" - "@typescript-eslint/parser": "npm:8.63.0" - "@typescript-eslint/typescript-estree": "npm:8.63.0" - "@typescript-eslint/visitor-keys": "npm:8.63.0" + "@typescript-eslint/eslint-plugin": "npm:8.64.0" + "@typescript-eslint/parser": "npm:8.64.0" + "@typescript-eslint/typescript-estree": "npm:8.64.0" + "@typescript-eslint/visitor-keys": "npm:8.64.0" acorn: "npm:8.17.0" acorn-jsx: "npm:5.3.2" angular-estree-parser: "npm:15.5.0"