Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsx-indent inserts unwanted space after text content #900

Closed
Wilfred opened this issue Oct 10, 2016 · 2 comments
Closed

jsx-indent inserts unwanted space after text content #900

Wilfred opened this issue Oct 10, 2016 · 2 comments
Labels

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Oct 10, 2016

Given the JS code:

const MyComponent = React.createClass({
  render() {
    return (
        <nav>
            <ul>
                <li>
                   bar {foo}
                </li>
            </ul>
        </nav>
    );
  },
});

and the following eslint configuration:

{
    "parserOptions": {
        "ecmaVersion": 6,
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "rules": {
        "react/jsx-indent": "warn"
    },
    "plugins": [
        "react"
    ]
}

Running eslint with --fix produces:

const MyComponent = React.createClass({
  render() {
    return (
        <nav>
            <ul>
                <li>
                   bar           {foo}
                </li>
            </ul>
        </nav>
    );
  },
});

It looks like it's trying to apply the indent to {foo} even though it's not the first text on the line.

Repeatedly running eslint --fix moves the {foo} further along.

@yannickcr yannickcr added the bug label Oct 10, 2016
@yannickcr
Copy link
Member

Ok, seems the space is inserted after bar instead of before, I'll have a look.

@Wilfred
Copy link
Contributor Author

Wilfred commented Oct 14, 2016

Thank you very much :)

Would you mind releasing when you have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants