Skip to content

Commit 9730315

Browse files
committed
refactor: use getStringLiteralValue
1 parent 221d2a9 commit 9730315

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/rules/no-unused-refs.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,9 @@ module.exports = {
242242
if (!arg0) {
243243
return
244244
}
245-
if (arg0.type === 'Literal') {
246-
usedRefs.add(arg0.value)
247-
} else if (
248-
arg0.type === 'TemplateLiteral' &&
249-
arg0.quasis.length === 1
250-
) {
251-
usedRefs.add(arg0.quasis[0].value.cooked)
245+
const name = utils.getStringLiteralValue(arg0)
246+
if (name !== null) {
247+
usedRefs.add(name)
252248
}
253249
}
254250
}

0 commit comments

Comments
 (0)