How to use the js-beautify-ejsx.html function in js-beautify-ejsx

To help you get started, we’ve selected a few js-beautify-ejsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github royriojas / esformatter-jsx / src / format-jsx.js View on Github external
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;

js-beautify-ejsx

jsbeautifier.org for node

MIT
Latest version published 7 years ago

Package Health Score

72 / 100
Full package analysis

Popular js-beautify-ejsx functions