Skip to content

Commit 5d23bbf

Browse files
committed
fix: don't operate on non-matching class key names
1 parent 5c37c87 commit 5d23bbf

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/helpers.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,17 @@ export function findClassNodes (ast: AST.VDocumentFragment, utils: CodemodPlugin
209209
results.push(node)
210210
} else if (
211211
node.type === 'Property'
212-
&& (node.key.type === 'Literal'
213-
|| (node.key.type === 'Identifier' && !node.computed)
212+
&& (
213+
(
214+
node.key.type === 'Literal'
215+
&& typeof node.key.value === 'string'
216+
&& matchingRegexp.test(node.key.value)
217+
)
218+
|| (
219+
node.key.type === 'Identifier'
220+
&& !node.computed
221+
&& matchingRegexp.test(node.key.name)
222+
)
214223
)
215224
) {
216225
results.push(node.key)

0 commit comments

Comments
 (0)