royriojas / esformatter-jsx

esformatter plugin: format jsx files (or js files with Facebook React JSX Syntax)
MIT License
142 stars 25 forks source link

Closing parenthisis on multi line JSX not formatted #96

Closed swinston1000 closed 7 years ago

swinston1000 commented 7 years ago

Hi

Thanks so much for the great plugin

It's working very well apart form one small thing. The closing parenthesis for the return statement is not indented properly.

image

These are my settings. I hope you can help me. Thanks.

{
    // autoformat on save
    "autoformat": true,

    // array of extensions for autoformat
    "extensions": ["js", "jsx"],

    // options for jsfmt
    "options": {
        "preset": "jquery",
        "indent": {
            "value": "    "
        },
        // plugins included
        "plugins": [
            "esformatter-jsx",
            // "esformatter-jsx-ignore",
            // "esformatter-braces",
            // "esformatter-dot-notation",
            // "esformatter-collapse-objects"
        ],
        "jsx": {
            "formatJSX": true, //Duh! that's the default 
            "attrsOnSameLineAsTag": false, // move each attribute to its own line 
            "maxAttrsOnTag": 3, // if lower or equal than 3 attributes, they will be kept on a single line 
            "firstAttributeOnSameLine": true, // keep the first attribute in the same line as the tag 
            "formatJSXExpressions": true, // default true, if false jsxExpressions won't be recursively formatted 
            "JSXExpressionsSingleLine": true, // default true, if false the JSXExpressions might span several lines 
            "alignWithFirstAttribute": false, // do not align attributes with the first tag 
            "spaceInJSXExpressionContainers": "", // default to one space. Make it empty if you don't like spaces between JSXExpressionContainers 
            "removeSpaceBeforeClosingJSX": false, // default false. if true <React.Something /> => <React.Something/> 
            "closingTagOnNewLine": false, // default false. if true attributes on multiple lines will close the tag on a new line 
            "JSXAttributeQuotes": "", // possible values "single" or "double". Leave it as empty string if you don't want to modify the attributes' quotes 
            "htmlOptions": {
                "brace_style": "collapse",
                "indent_char": " ",
                "indent_size": 4,
                "max_preserve_newlines": 2,
                "preserve_newlines": true
                    // put here the options for js-beautify.html 
            }
        }
    },
    "options-JSON": {
        "plugins": [
            "esformatter-quotes"
        ],
        "quotes": {
            "type": "double"
        }
    },
    "node-path": "node",
    "alert-errors": true,
    "ignore-selection": false
}
royriojas commented 7 years ago

duplicate of #56