fix: skip `log_if_contains_state` if only logging literals (#15468)

pull/15466/head
Rich Harris 6 months ago committed by GitHub
parent 3326bd8ae7
commit eaf0087d7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: skip `log_if_contains_state` if only logging literals

@ -44,7 +44,8 @@ export function CallExpression(node, context) {
node.callee.property.type === 'Identifier' && node.callee.property.type === 'Identifier' &&
['debug', 'dir', 'error', 'group', 'groupCollapsed', 'info', 'log', 'trace', 'warn'].includes( ['debug', 'dir', 'error', 'group', 'groupCollapsed', 'info', 'log', 'trace', 'warn'].includes(
node.callee.property.name node.callee.property.name
) ) &&
node.arguments.some((arg) => arg.type !== 'Literal') // TODO more cases?
) { ) {
return b.call( return b.call(
node.callee, node.callee,

Loading…
Cancel
Save