UNPKG

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

Version:

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

28 lines • 923 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(ref => { const callExpression = closestOfType(ref.identifier, 'CallExpression'); if (!callExpression) { return false; } if (callExpression.callee !== ref.identifier) { return false; } if (callExpression.arguments.length !== 1) { return false; } const argument = callExpression.arguments[0]; if (argument.type !== 'ObjectExpression') { return false; } return argument.properties.every(property => isSafeProperty(property, isSafeKeyframePropertyValue)); }); }