UNPKG

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

Version:

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

37 lines (36 loc) • 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSafeUsage = isSafeUsage; var _contextCompat = require("@atlaskit/eslint-utils/context-compat"); var _findVariable = require("@atlaskit/eslint-utils/find-variable"); var _isSafeCss = require("./is-safe-css"); var _isSafeKeyframes = require("./is-safe-keyframes"); function isSafeUsage(_ref) { var context = _ref.context, specifier = _ref.specifier, supportedImports = _ref.supportedImports; if (!('name' in specifier.imported)) { return false; } var importName = specifier.imported.name; if (!supportedImports.has(importName)) { return false; } if (importName === 'css') { var css = (0, _findVariable.findVariable)({ identifier: specifier.local, sourceCode: (0, _contextCompat.getSourceCode)(context) }); return css !== null && (0, _isSafeCss.isSafeCss)(css); } if (importName === 'keyframes') { var keyframes = (0, _findVariable.findVariable)({ identifier: specifier.local, sourceCode: (0, _contextCompat.getSourceCode)(context) }); return keyframes !== null && (0, _isSafeKeyframes.isSafeKeyframes)(keyframes); } return true; }