mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Add heuristic to skip candidate migrations inside emit(…) (#18330)
Fixes #18318
This commit is contained in:
parent
44534963c3
commit
5fc6698b7b
@ -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
|
||||
|
||||
|
||||
@ -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')
|
||||
})
|
||||
|
||||
@ -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,
|
||||
@ -175,6 +176,11 @@ export function isSafeMigration(
|
||||
return false
|
||||
}
|
||||
|
||||
// Heuristic: Disallow replacements inside `emit('…', …)`
|
||||
if (VUE_3_EMIT.test(currentLineBeforeCandidate)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user