From 09b64743bd32e1303728d637592317a89b842a23 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 14 Jan 2025 16:32:18 +1300 Subject: [PATCH] fix: prefix PrivateIdentifier names with a # (#921) BREAKING CHANGE: when using patterns to match against PrivateIdentifiers, their names are now prefixed with a #. fix #910 fix #911 --- src/utils/misc.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 705afac9d..75dc75fdc 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -53,8 +53,10 @@ function getNodeIdentifierText( let mut_identifierText: string | undefined | null = null; - if (isIdentifier(node) || isPrivateIdentifier(node)) { + if (isIdentifier(node)) { mut_identifierText = node.name; + } else if (isPrivateIdentifier(node)) { + mut_identifierText = `#${node.name}`; } else if (hasID(node) && isDefined(node.id)) { mut_identifierText = getNodeIdentifierText(node.id, context); } else if (hasKey(node) && isDefined(node.key)) {