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

Unexpected error comes out when everything is ok (related to jsx-indent) #1118

Closed
SidKwok opened this issue Mar 20, 2017 · 7 comments
Closed

Comments

@SidKwok
Copy link

SidKwok commented Mar 20, 2017

This is ok and no error comes out.

    return (
      <p>
        I'm {this.state.name}
      </p>
    )

when I add any character after this like:

    return (
      <p>
        I'm {this.state.name} any string here
      </p>
    )

and the error comes out:

Expected indentation of 8 space characters but found 1. (react/jsx-indent)

my eslint config :

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true
    }
  },
  env: {
    es6: true,
    commonjs: true,
    browser: true,
  },
  extends: [
      'standard',
      'standard-react'
  ],
  plugins: [
    'react',
    'babel',
    'promise'
  ],
  'rules': {
    'arrow-parens': 0,
    'generator-star-spacing': 0,
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

Is it a bug or something wrong with my config?

@ghost
Copy link

ghost commented Mar 20, 2017

Same for me, failing e.g. on the following line:
<Time fromNumber={this.state.value}/>&nbsp;<Translate for="shortHours"/>

Not sure from which version it start happening.

@SidKwok
Copy link
Author

SidKwok commented Mar 20, 2017

The version I used: ^6.10.2

@benperiton
Copy link

Yep, seems to be counting the first group of space after a react element. (6.10.2)

<Icon name="tasks" fixedWidth /> Create Order

Gives 1

<Icon name="tasks" fixedWidth />   Create Order

Gives 3

<Icon name="tasks" fixedWidth />Create Order

Gives 0

@ffigiel
Copy link

ffigiel commented Mar 20, 2017

Temporary fix: use a fixed version until the bug is fixed. 6.10.0 works fine

@SidKwok
Copy link
Author

SidKwok commented Mar 20, 2017

@megapctr it is not working for me

@aliaksandr-master
Copy link

I have 6.10.2 version and it doesn't work

          <div className="PageCampaignEditSettingsAdExample__headRating">
            <Rating rating={rating} />
            ( {reviews} )
          </div>

Expected indentation of 12 space characters but found 1 react/jsx-indent

@ljharb
Copy link
Member

ljharb commented Mar 20, 2017

This is a duplicate of #1117 - thanks for the extra test cases!

@ljharb ljharb closed this as completed Mar 20, 2017
@ljharb ljharb changed the title Unexpected error comes out when everything is ok (related to jsx-indet) Unexpected error comes out when everything is ok (related to jsx-indent) Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants