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 indentation #358

Closed
LinusU opened this issue Dec 8, 2015 · 7 comments

Comments

@LinusU
Copy link
Member

commented Dec 8, 2015

Currently it seems like standard doesn't lint the indentation on JSX files. For example the following file lints without issues:

const React = require('react')

class Test extends React.Component {
  render () {
    return (
              <div>
       Test
          </div>
    )
  }
}

module.exports = Test
@Flet

This comment has been minimized.

Copy link
Member

commented Dec 10, 2015

This should probably be moved to eslint-config-standard-react.

Taking a look at it's eslintrc.json, I don't see the jsx-indent-props rule enabled, which I think is what you're looking for (or maybe it some other rule).

@LinusU

This comment has been minimized.

Copy link
Member Author

commented Dec 10, 2015

Hmm, it isn't jsx-indent-props, and as far as I can tell there isn't any plugin on that list that would do it. Maybe this should really be a job for the plugin that checks the indentation of normal code...

@feross

This comment has been minimized.

Copy link
Member

commented Dec 20, 2015

There's currently a proposal for the rule you want: yannickcr/eslint-plugin-react#342 Maybe you can weigh in on that issue?

@LinusU

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2015

Thanks!

@feross feross removed the blocked label Dec 29, 2015

@feross

This comment has been minimized.

Copy link
Member

commented Dec 29, 2015

This is implemented in eslint-plugin-react now. Let's release it in v6.

@feross feross added the v6 label Dec 29, 2015

@LinusU

This comment has been minimized.

Copy link
Member Author

commented Jan 4, 2016

Awesome news! 🍾

dignifiedquire added a commit to dignifiedquire/eslint-config-standard-react that referenced this issue Feb 2, 2016

Enforce jsx indentation in line with other indentations
This sets the following three rules

1. [`jsx-closing-bracket-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md)
2. [`jsx-indent-props`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md)
3. [`jsx-indent`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md)

`jsx-indent` and `jsx-indent-props` are set to indent to `2 spaces` as expected
from standard.

`jsx-closing-bracket-location` is set to the default which entails
the following to be valid:

```js
<Hello
  firstName="John"
  lastName="Smith"
/>

<Say
  firstName="John"
  lastName="Smith"
>
  Hello
</Say>
```

Closes standard/standard#358
@feross

This comment has been minimized.

Copy link
Member

commented Feb 4, 2016

This is released in eslint-config-standard-react 2.0.0.

@feross feross added enhancement and removed enhancement labels May 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.