UNPKG

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

Version:

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

25 lines (23 loc) • 818 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSafeStyled = isSafeStyled; var _eslintCodemodUtils = require("eslint-codemod-utils"); var _isSafeStyleArgument = require("./is-safe-style-argument"); function isSafeStyled(styled) { return styled.references.every(function (ref) { var callExpression = (0, _eslintCodemodUtils.closestOfType)(ref.identifier, 'CallExpression'); if (!callExpression) { return false; } /** * If it's not in the form `styled.tagName()` * then we consider it unsafe to auto-fix. */ if (callExpression.callee.type !== 'MemberExpression' || callExpression.callee.object !== ref.identifier) { return false; } return callExpression.arguments.every(_isSafeStyleArgument.isSafeStyleArgument); }); }