Eslint-plugin-react: jsx-indent fails with arrays

Created on 7 Nov 2016  路  1Comment  路  Source: yannickcr/eslint-plugin-react

export function X(props) {
    return (
        <div>
            {d &&
                [
                    <B key="1"/>,
                    <C
                        {...props}
                    />,
                ]
            }
        </div>
    );
}

The <C component is wanted both at indentation 16 (1 less than above) and at 20 - so it errors either way.

this is in my .eslintrc

"react/jsx-indent": ["error", 4],

The example works fine in 6.3.0 (I had avoided upgraded until ternaries worked a bit better).

bug

Most helpful comment

It seems actually this can be fixed by putting the [ on the same line as {d &&

>All comments

It seems actually this can be fixed by putting the [ on the same line as {d &&

Was this page helpful?
0 / 5 - 0 ratings