Skip to content

Commit

Permalink
fix: prefix PrivateIdentifier names with a # (#921)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: when using patterns to match against PrivateIdentifiers, their names are now prefixed with a #.

fix #910 fix #911
  • Loading branch information
RebeccaStevens committed Jan 14, 2025
1 parent 3999418 commit 09b6474
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 09b6474

Please sign in to comment.