Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
- Add heuristic to skip candidate migrations inside `emit(…)` ([#18330](https://github.com/tailwindlabs/tailwindcss/pull/18330))

## [4.1.10] - 2025-06-11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ test('does not replace classes in invalid positions', async () => {

// Alpine/Livewire wire:…
await shouldNotReplace('<x-input.number required="foo" wire:model.blur="coins" />', 'blur')

// Vue 3 events
await shouldNotReplace(`emit('blur', props.modelValue)\n`, 'blur')
await shouldNotReplace(`$emit('blur', props.modelValue)\n`, 'blur')
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const CONDITIONAL_TEMPLATE_SYNTAX = [
/wire:[^\s]*?$/,
]
const NEXT_PLACEHOLDER_PROP = /placeholder=\{?['"]$/
const VUE_3_EMIT = /\b\$?emit\(['"]$/

export function isSafeMigration(
rawCandidate: string,
Expand Down Expand Up @@ -175,6 +176,11 @@ export function isSafeMigration(
return false
}

// Heuristic: Disallow replacements inside `emit('…', …)`
if (VUE_3_EMIT.test(currentLineBeforeCandidate)) {
return false
}

return true
}

Expand Down