feat: add no-unknown-animations rule - #535
Open
Gaic4o wants to merge 1 commit into
Open
Conversation
3 tasks
DMartens
reviewed
Aug 18, 2026
| // Helpers | ||
| //----------------------------------------------------------------------------- | ||
|
|
||
| const animationPropertyPattern = /^animation(?:-name)?$/iu; |
Contributor
There was a problem hiding this comment.
This should also check for vendored prefixes (e.g. -webkit-animation) as the @keyframes check also does.
DMartens
reviewed
Aug 18, 2026
| /* | ||
| * If the value can't be matched against the property grammar, | ||
| * its animation name can't be determined reliably. This | ||
| * includes dynamic values such as var(). Invalid property |
Contributor
There was a problem hiding this comment.
I think the rule should support checking local resolvable var declarations.
There will be a helper for this but this rule could already check the default value of a var, e.g. "slide-in" in animation: var(--animation-name, "slide-in").
DMartens
reviewed
Aug 18, 2026
| continue; | ||
| } | ||
|
|
||
| const name = getAnimationName(child); |
Contributor
There was a problem hiding this comment.
The name should not be null as the lexer already checks that it is a string or an identifier. Otherwise a test case for this is missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI acknowledgment
What is the purpose of this pull request?
This PR adds the
no-unknown-animationsrule to report animation names that don't match any@keyframesrule defined in the same source.What changes did you make? (Give an overview)
no-unknown-animationsrule foranimationandanimation-namedeclarations.Related Issues
fixes #529
Disclosure: I'm a participant of open source contribution program OSSCA