UNPKG

@atlaskit/eslint-plugin-ui-styling-standard

Version:

The eslint plugin to enforce and educate on Atlassian's UI Styling Standard

30 lines • 957 B
import { closestOfType } from 'eslint-codemod-utils'; import { isSafeProperty } from './is-safe-property'; import { isSafeStyleObject } from './is-safe-style-object'; function isSafeKeyframePropertyValue(value) { if (value.type !== 'ObjectExpression') { return false; } return isSafeStyleObject(value); } export function isSafeKeyframes(keyframes) { return keyframes.references.every(function (ref) { var callExpression = closestOfType(ref.identifier, 'CallExpression'); if (!callExpression) { return false; } if (callExpression.callee !== ref.identifier) { return false; } if (callExpression.arguments.length !== 1) { return false; } var argument = callExpression.arguments[0]; if (argument.type !== 'ObjectExpression') { return false; } return argument.properties.every(function (property) { return isSafeProperty(property, isSafeKeyframePropertyValue); }); }); }