Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
format(ast, noAlign) {
const me = this;
let source = ast.source();
const response = replaceJSXExpressionContainer(source);
const containers = response.containers;
source = response.source;
if (!jsxOptions.attrsOnSameLineAsTag) {
source = me.prepareToProcessTags(source);
}
source = beautifier.html(source, htmlOptions);
if (!jsxOptions.attrsOnSameLineAsTag) {
source = me.operateOnOpenTags(source, htmlOptions);
}
if (!noAlign) {
source = alingText(source, ast, htmlOptions);
}
source = restoreContainers(source, containers, jsxOptions.spaceInJSXExpressionContainers, jsxOptions.removeSpaceBeforeClosingJSX);
if (containers.length > 0 || jsxOptions.JSXAttributeQuotes) {
const expressionContainers = { };
const ast2 = falafel(source, (node) => {
if (node.type === 'JSXAttribute' && node.value && node.value.type === 'StringLiteral' && jsxOptions.JSXAttributeQuotes) {
const jsxAttrValue = node.value;