-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
chore(compiler-sfc): match @keyframes exactly
#13566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new regular expression, Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/compiler-sfc/src/style/pluginScoped.ts (1)
11-14: Ensure regex-style consistency across the file
keyframesREwisely re-uses the same prefix rule thatanimation(RE|NameRE)use, but note the slight stylistic mismatch:const animationNameRE = /^(-\w+-)?animation-name$/ const animationRE = /^(-\w+-)?animation$/ const keyframesRE = /^(?:-\w+-)?keyframes$/ <-- non-capturing groupFor uniformity (and to avoid accidental “eslint-regexp/no-capturing-group” toggle-flopping), consider switching all three to either capturing or non-capturing groups.
Example (non-capturing everywhere):-const animationNameRE = /^(-\w+-)?animation-name$/ -const animationRE = /^(-\w+-)?animation$/ +const animationNameRE = /^(?:-\w+-)?animation-name$/ +const animationRE = /^(?:-\w+-)?animation$/Purely cosmetic, but keeps grepping / lint rules predictable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/compiler-sfc/src/style/pluginScoped.ts(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (2)
packages/compiler-sfc/src/style/pluginScoped.ts (2)
24-29: 👍 Centralised keyframe detection improves maintainabilityReplacing the ad-hoc regex with
keyframesREremoves duplication and guarantees one-stop-shop updates if the matching logic ever changes. Implementation looks correct and has no behavioural regressions.
70-75: Guard clause now leverages shared regex – good callUsing
keyframesREinsideprocessRule()keeps the skip-logic in sync with theAtRulevisitor. Verified that the early-return behaviour is unchanged.
@keyframes exactly@keyframes exactly
Use the same matching rule as the
animationproperty.Summary by CodeRabbit