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 support] First line of nested JSX has improper indenting applied. #667

Open
godd9170 opened this issue Apr 9, 2015 · 4 comments
Open

Comments

@godd9170
Copy link

godd9170 commented Apr 9, 2015

This might be related to #665, a bit different though.
In the following example <div className='project-tiles-project-body'> gets nicely indented, however it's child elements and closing tag do not.

projectListing = (
      <div className='project-tiles-project-body'>
        <div className='project-tiles-project-column'>
          {projectListingLeft}
        </div>
        <div className='project-tiles-project-column'>
          {projectListingRight}
          {newDocument}
        </div>
      </div>
    );

Becomes

projectListing = (
            <div className='project-tiles-project-body'>
        <div className='project-tiles-project-column'>
          {projectListingLeft}
        </div>
        <div className='project-tiles-project-column'>
          {projectListingRight}
          {newDocument}
        </div>
      </div>
        );
@godd9170 godd9170 mentioned this issue Apr 9, 2015
@godd9170 godd9170 changed the title First line of nested JSX has improper indenting applied. [JSX support] First line of nested JSX has improper indenting applied. Apr 9, 2015
@bitwiseman
Copy link
Member

Yeah this is due to #665. What is your indent setting? 8 spaces? Tab?

@godd9170
Copy link
Author

My indent setting was 4 spaces, and I just noticed this option:

screen shot 2015-04-10 at 10 23 11 am

Which unfortunately also indents only the first line of the HTML markup.

@bitwiseman
Copy link
Member

Yeah, the setting you mention should have no effect on JSX. That's html specific.

@jaxbot
Copy link

jaxbot commented Apr 16, 2015

Another example:

Input:

var PinActions = require("../actions/PinActions");

module.exports = React.createClass({
  _newPost: function() {
    PinActions.newPost();
  },
  render: function() {
    return (
      <header>
        Reacterest
        <span className="new" onClick={this._newPost}>+</span>
      </header>
    );
  }
});

Output by default:

var PinActions = require("../actions/PinActions");

module.exports = React.createClass({
    _newPost: function() {
        PinActions.newPost();
    },
    render: function() {
        return (
            <header>
        Reacterest
        <span className="new" onClick={this._newPost}>+</span>
      </header>
        );
    }
});

Output with indent set to 2 spaces:

var PinActions = require("../actions/PinActions");

module.exports = React.createClass({
  _newPost: function() {
    PinActions.newPost();
  },
  render: function() {
    return (
      <header>
        Reacterest
        <span className="new" onClick={this._newPost}>+</span>
      </header>
    );
  }
});

Works fine after adjusting that, would be cool if it could auto-detect.

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

No branches or pull requests

3 participants