Skip to content

Commit

Permalink
animation-name with dash (-)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorozco committed Sep 18, 2020
1 parent bb2bcbb commit 86fa6dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build-system/eslint-rules/jss-animation-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ module.exports = function (context) {
}
// Could be {key: val} identifier or {'key': val} string
const keyName = node.key.name || node.key.value;
if (keyName !== 'animationName' && keyName !== 'animation') {
const isKeyAnimationName =
keyName === 'animationName' || keyName === 'animation-name';
if (!isKeyAnimationName && keyName !== 'animation') {
return;
}
if (typeof node.value.value !== 'string') {
Expand All @@ -54,13 +56,13 @@ module.exports = function (context) {
return;
}
if (
(keyName === 'animationName' && !/^\$/.test(node.value.value)) ||
(isKeyAnimationName && !/^\$/.test(node.value.value)) ||
(keyName === 'animation' && !/(^| )\$/.test(node.value.value))
) {
context.report({
node: node.value,
message: `The animation name in property ${keyName} should start with $${
keyName === 'animationName' ? ` (e.g. $${node.value.value})` : ''
isKeyAnimationName ? ` (e.g. $${node.value.value})` : ''
}.\nThis scopes it to a @keyframes rule present in this module.`,
});
}
Expand Down

0 comments on commit 86fa6dc

Please sign in to comment.