Print declare and export keywords for nested namespace (#15249)
This commit is contained in:
1 parent
b4082cb647
commit
1b0c756bd6
6 files changed
+178
-56
No files matched your search
@@ -0,0 +1,16 @@
|
||||
#### Print `declare` and `export` keywords for nested namespace (#15249 by @sosukesuzuki)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```tsx
|
||||
// Input
|
||||
declare namespace abc1.def {}
|
||||
export namespace abc2.def {}
|
||||
|
||||
// Prettier stable
|
||||
namespace abc1.def {}
|
||||
namespace abc2.def {}
|
||||
|
||||
// Prettier main
|
||||
declare namespace abc1.def {}
|
||||
export namespace abc2.def {}
|
||||
```
|
||||
+3
-3
@@ -38,8 +38,8 @@
|
||||
"@iarna/toml": "2.2.5",
|
||||
"@prettier/is-es5-identifier-name": "0.2.0",
|
||||
"@prettier/parse-srcset": "3.1.0",
|
||||
"@typescript-eslint/typescript-estree": "6.3.0",
|
||||
"@typescript-eslint/visitor-keys": "6.3.0",
|
||||
"@typescript-eslint/typescript-estree": "6.4.0",
|
||||
"@typescript-eslint/visitor-keys": "6.4.0",
|
||||
"acorn": "8.10.0",
|
||||
"acorn-jsx": "5.3.2",
|
||||
"angular-estree-parser": "7.0.0",
|
||||
@@ -113,7 +113,7 @@
|
||||
"@types/file-entry-cache": "5.0.2",
|
||||
"@types/find-cache-dir": "3.2.1",
|
||||
"@types/jest": "29.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "6.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "6.4.0",
|
||||
"benchmark": "2.1.4",
|
||||
"browserslist-to-esbuild": "1.2.0",
|
||||
"c8": "8.0.1",
|
||||
|
||||
@@ -116,6 +116,48 @@ namespace X {
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`module_nested.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
declare module abc1.def {}
|
||||
|
||||
export declare module abc2.def {}
|
||||
|
||||
export module abc3.def {}
|
||||
|
||||
module abc4.def {}
|
||||
|
||||
declare module abc5.def.ghi {}
|
||||
|
||||
export declare module abc2.def.ghi {}
|
||||
|
||||
export module abc3.def.ghi {}
|
||||
|
||||
module abc4.def.ghi {}
|
||||
|
||||
=====================================output=====================================
|
||||
declare module abc1.def {}
|
||||
|
||||
export declare module abc2.def {}
|
||||
|
||||
export module abc3.def {}
|
||||
|
||||
module abc4.def {}
|
||||
|
||||
declare module abc5.def.ghi {}
|
||||
|
||||
export declare module abc2.def.ghi {}
|
||||
|
||||
export module abc3.def.ghi {}
|
||||
|
||||
module abc4.def.ghi {}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`namespace_function.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
@@ -133,3 +175,45 @@ namespace X {
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`namespace_nested.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
declare namespace abc1.def {}
|
||||
|
||||
export declare namespace abc2.def {}
|
||||
|
||||
export namespace abc3.def {}
|
||||
|
||||
namespace abc4.def {}
|
||||
|
||||
declare namespace abc5.def.ghi {}
|
||||
|
||||
export declare namespace abc2.def.ghi {}
|
||||
|
||||
export namespace abc3.def.ghi {}
|
||||
|
||||
namespace abc4.def.ghi {}
|
||||
|
||||
=====================================output=====================================
|
||||
declare namespace abc1.def {}
|
||||
|
||||
export declare namespace abc2.def {}
|
||||
|
||||
export namespace abc3.def {}
|
||||
|
||||
namespace abc4.def {}
|
||||
|
||||
declare namespace abc5.def.ghi {}
|
||||
|
||||
export declare namespace abc2.def.ghi {}
|
||||
|
||||
export namespace abc3.def.ghi {}
|
||||
|
||||
namespace abc4.def.ghi {}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,15 @@
|
||||
declare module abc1.def {}
|
||||
|
||||
export declare module abc2.def {}
|
||||
|
||||
export module abc3.def {}
|
||||
|
||||
module abc4.def {}
|
||||
|
||||
declare module abc5.def.ghi {}
|
||||
|
||||
export declare module abc2.def.ghi {}
|
||||
|
||||
export module abc3.def.ghi {}
|
||||
|
||||
module abc4.def.ghi {}
|
||||
@@ -0,0 +1,15 @@
|
||||
declare namespace abc1.def {}
|
||||
|
||||
export declare namespace abc2.def {}
|
||||
|
||||
export namespace abc3.def {}
|
||||
|
||||
namespace abc4.def {}
|
||||
|
||||
declare namespace abc5.def.ghi {}
|
||||
|
||||
export declare namespace abc2.def.ghi {}
|
||||
|
||||
export namespace abc3.def.ghi {}
|
||||
|
||||
namespace abc4.def.ghi {}
|
||||
@@ -1801,20 +1801,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/eslint-plugin@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:6.3.0"
|
||||
"@typescript-eslint/eslint-plugin@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:6.4.0"
|
||||
dependencies:
|
||||
"@eslint-community/regexpp": ^4.5.1
|
||||
"@typescript-eslint/scope-manager": 6.3.0
|
||||
"@typescript-eslint/type-utils": 6.3.0
|
||||
"@typescript-eslint/utils": 6.3.0
|
||||
"@typescript-eslint/visitor-keys": 6.3.0
|
||||
"@typescript-eslint/scope-manager": 6.4.0
|
||||
"@typescript-eslint/type-utils": 6.4.0
|
||||
"@typescript-eslint/utils": 6.4.0
|
||||
"@typescript-eslint/visitor-keys": 6.4.0
|
||||
debug: ^4.3.4
|
||||
graphemer: ^1.4.0
|
||||
ignore: ^5.2.4
|
||||
natural-compare: ^1.4.0
|
||||
natural-compare-lite: ^1.4.0
|
||||
semver: ^7.5.4
|
||||
ts-api-utils: ^1.0.1
|
||||
peerDependencies:
|
||||
@@ -1823,7 +1822,7 @@ __metadata:
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 1493c6c661993640eef56893a7919cb964165cb46653c62468e71ce02a5ec8c654dd7e9767587aea67ec16c026a5630011bc7ea6c04e2fa8a4afee7f26a51358
|
||||
checksum: d59e88228a4088f3dcaa614103eefa7a0c57315ed79ee1c48afd9817ad013522aa9a9f987e90e1fd7dccc0bbb03ed23e4df6f5ea5cceef8856db33c78ea13d53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1837,22 +1836,22 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:6.3.0"
|
||||
"@typescript-eslint/scope-manager@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:6.4.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 6.3.0
|
||||
"@typescript-eslint/visitor-keys": 6.3.0
|
||||
checksum: 1690465f620f2b4517d45516864ef107258b2b608293d72606d0f115e11a8c1416b3d57e1b67f1daa1838f0239f71464aead57fe77c53ebd54b0aeee5fd4cf5e
|
||||
"@typescript-eslint/types": 6.4.0
|
||||
"@typescript-eslint/visitor-keys": 6.4.0
|
||||
checksum: 19406eac3a1899f77eb7c3aa52577e2146075e1318c6eb34d220678afa167832b89c90860714f33b99e107544b48f6970594ca4bcf48c5ede8f2a14a0795ba33
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/type-utils@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/type-utils@npm:6.3.0"
|
||||
"@typescript-eslint/type-utils@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/type-utils@npm:6.4.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree": 6.3.0
|
||||
"@typescript-eslint/utils": 6.3.0
|
||||
"@typescript-eslint/typescript-estree": 6.4.0
|
||||
"@typescript-eslint/utils": 6.4.0
|
||||
debug: ^4.3.4
|
||||
ts-api-utils: ^1.0.1
|
||||
peerDependencies:
|
||||
@@ -1860,7 +1859,7 @@ __metadata:
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: cf2ab9d576bc9f3c0554318d20cb92671e4f46a07c24271fc47f144139b3843dab54592ee2e0962f81ad588f57a0b0a7c09d7e1047c720143a54bb1ec3ac4007
|
||||
checksum: 7930d2ffdc844a5b706d48ae3e4584882f7f0c06d581a3b06bc280a351c55974b16dbb73f1842f7389f04b80c2cfaf867edd2f261b699804d8a4fea9c20b3869
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1871,10 +1870,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/types@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/types@npm:6.3.0"
|
||||
checksum: 3c133e4c1b06d009739f1a4387831eb99758ba45b06b6f632fe9cf14c2839fc92dcbdbb6d94ca42c1cb5ab4ca1b31a5ead50a72e0a084b62e4de15255c451160
|
||||
"@typescript-eslint/types@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/types@npm:6.4.0"
|
||||
checksum: 85b293ad1559dbf8103b2c4cfd0db11c3d9c970d502e2c13d4b1d35e420567042d7077a716d2b4e5113286314d5260f378f242a6dd22ad4b94b4aa69c5f79223
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1896,12 +1895,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:6.3.0"
|
||||
"@typescript-eslint/typescript-estree@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:6.4.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 6.3.0
|
||||
"@typescript-eslint/visitor-keys": 6.3.0
|
||||
"@typescript-eslint/types": 6.4.0
|
||||
"@typescript-eslint/visitor-keys": 6.4.0
|
||||
debug: ^4.3.4
|
||||
globby: ^11.1.0
|
||||
is-glob: ^4.0.3
|
||||
@@ -1910,24 +1909,24 @@ __metadata:
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: b2bb03411a5d079a9fd3310eec0af3b81a99827569cb3957724071aa54ac6c88449fbd1ebb72d7a356d5994d7e9542b5292a385ca3c3b0bc8049bb61a40a8ae9
|
||||
checksum: a8db3896550515d0adf140ee115527b409916c4a14ac1f45b5623d130a27ae2d08a1ac906ceda440b01167c88846e2b91ca2025f3d718bff389948f66990c1e7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/utils@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/utils@npm:6.3.0"
|
||||
"@typescript-eslint/utils@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/utils@npm:6.4.0"
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils": ^4.4.0
|
||||
"@types/json-schema": ^7.0.12
|
||||
"@types/semver": ^7.5.0
|
||||
"@typescript-eslint/scope-manager": 6.3.0
|
||||
"@typescript-eslint/types": 6.3.0
|
||||
"@typescript-eslint/typescript-estree": 6.3.0
|
||||
"@typescript-eslint/scope-manager": 6.4.0
|
||||
"@typescript-eslint/types": 6.4.0
|
||||
"@typescript-eslint/typescript-estree": 6.4.0
|
||||
semver: ^7.5.4
|
||||
peerDependencies:
|
||||
eslint: ^7.0.0 || ^8.0.0
|
||||
checksum: 98a078a3948e8b6a45dec8f3be9bcb72dc98faa2fe84336b1925efb7caa06c05a2fbf7290cddb420465b415cc05252548e2b839b9311f99bce84cf856fd32888
|
||||
checksum: abc55382c601c7ed298076548d2df78f15b07ed6830086db6ce1b82d461f0a190ee103a804690ac9205cdca9f373a864e1dd3e20012e9d103f3137963e0aa5ea
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1959,13 +1958,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:6.3.0"
|
||||
"@typescript-eslint/visitor-keys@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:6.4.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 6.3.0
|
||||
"@typescript-eslint/types": 6.4.0
|
||||
eslint-visitor-keys: ^3.4.1
|
||||
checksum: fc3148c3284de3f42724736f312a4fd0c3c2029617ae2ea9a84cf6601d31f600ee6563f9288de162028ffffde85b58d92feaafbe75a2da863ff2c4e3a0b5ed8c
|
||||
checksum: 42eb614b9c0a49b6929e093757d772fd27fe5dda9c75f4c7820d1710012c8257eea9bd4f1c4173e2265a8a9ad86cefc1a21869893e7304f3b29b94fa1f987554
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6270,13 +6269,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"natural-compare-lite@npm:^1.4.0":
|
||||
version: 1.4.0
|
||||
resolution: "natural-compare-lite@npm:1.4.0"
|
||||
checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"natural-compare@npm:^1.4.0":
|
||||
version: 1.4.0
|
||||
resolution: "natural-compare@npm:1.4.0"
|
||||
@@ -7019,9 +7011,9 @@ __metadata:
|
||||
"@types/file-entry-cache": 5.0.2
|
||||
"@types/find-cache-dir": 3.2.1
|
||||
"@types/jest": 29.5.3
|
||||
"@typescript-eslint/eslint-plugin": 6.3.0
|
||||
"@typescript-eslint/typescript-estree": 6.3.0
|
||||
"@typescript-eslint/visitor-keys": 6.3.0
|
||||
"@typescript-eslint/eslint-plugin": 6.4.0
|
||||
"@typescript-eslint/typescript-estree": 6.4.0
|
||||
"@typescript-eslint/visitor-keys": 6.4.0
|
||||
acorn: 8.10.0
|
||||
acorn-jsx: 5.3.2
|
||||
angular-estree-parser: 7.0.0
|
||||
|
||||
Reference in new issue
Block a user