Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
properties.forEach((property) => {
if (!t.isIdentifier(property.key)) {
newProperties.push(property);
return;
}
let value = property.value;
switch (property.key.name) {
case 'style':
/*eslint-disable no-empty */
if (value === node) {
// we found our style, but do nothing, because it is
// later on appended to the className property
/*eslint-enable no-empty */
} else if (t.isArrayExpression(value)) {
var newElements = [];
const singleArgumentCase = firstArgument => {
const isElement = t.isStringLiteral(firstArgument);
const isReactComponent = t.isIdentifier(firstArgument);
const isMemberExpression = t.isMemberExpression(firstArgument);
let attributes = [];
if (isElement) {
const { id, className, tag } = getTagAndClassNamesAndId(
firstArgument.value
);
className &&
attributes.push(
bJsxAttr(t.JSXIdentifier("className"), processClassName(className))
);
id && attributes.push(bJsxAttr(t.JSXIdentifier("id"), t.StringLiteral(id)));
return bJsxElem({
selfClosing: true,
name: tag,
attributes
const isHyperscriptCall = node => {
return t.isIdentifier(node.callee, {
name: "h"
});
};
const singleArgumentCase = firstArgument => {
const isElement = t.isStringLiteral(firstArgument);
const isReactComponent = t.isIdentifier(firstArgument);
const isMemberExpression = t.isMemberExpression(firstArgument);
let attributes = [];
if (isElement) {
const { id, className, tag } = getTagAndClassNamesAndId(
firstArgument.value
);
className &&
attributes.push(
bJsxAttr(t.JSXIdentifier("className"), t.StringLiteral(className))
);
id && attributes.push(bJsxAttr(t.JSXIdentifier("id"), t.StringLiteral(id)));
return bJsxElem({
selfClosing: true,
name: tag,
attributes
});
function evaluateExpression(path, stylesheets) {
const node = path.node;
if (!t.isIdentifier(node.object) || !t.isIdentifier(node.property)) {
return null;
}
const sheetId = node.object.name;
const sheet = stylesheets[sheetId];
if (!sheet) {
return null;
}
const styleId = node.property.name;
const style = sheet[styleId];
if (!style) {
return null;
}
CallExpression(path) {
if (t.isIdentifier(path.node.callee, { name: 'require' })) {
dependencies.push(processRequireCall(path));
path.skip();
}
},
});