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

Make the react/jsx-indent{,-props} rules properly #1

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

yamadayuki
Copy link
Collaborator

WHY & WHAT

If I use this in test React application, it notifies the errors and warnings around react/jsx-indent and react/jsx-indent-props. These rules have default value as 4 spaces. (c.f. https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md) It means the below:

{
  rules: [
    "react/jsx-indent-props": "warn",
    "react/jsx-indent": "warn",
  ]
}

// Above is equivalent to below
{
  rules: [
    "react/jsx-indent-props": ["warn", 4],
    "react/jsx-indent": ["warn", 4],
  ]
}

But we expect to the 2 spaces.

~/dev/src/github.com/yamadayuki/test-app master*
❯ git commit
Detected 10 errors, 14 warnings
./src/App.jsx: 10 errors, 14 warnings found.
  ./src/App.jsx:8:7 Expected indentation of 8 space characters but found 6. (react/jsx-indent)
  ./src/App.jsx:9:9 Expected indentation of 10 space characters but found 8. (react/jsx-indent)
  ./src/App.jsx:10:11 Expected indentation of 12 space characters but found 10. (react/jsx-indent)
  ./src/App.jsx:11:11 Expected indentation of 12 space characters but found 10. (react/jsx-indent)
  ./src/App.jsx:13:1 Expected indentation of 10 spaces but found 12. (@typescript-eslint/indent)
  ./src/App.jsx:13:1 Expected indentation of 10 spaces but found 12. (indent)
  ./src/App.jsx:13:13 Expected indentation of 10 space characters but found 12. (react/jsx-indent)
  ./src/App.jsx:14:11 Expected indentation of 12 space characters but found 10. (react/jsx-indent)
  ./src/App.jsx:15:13 Expected indentation of 14 space characters but found 12. (react/jsx-indent-props)
  ./src/App.jsx:16:13 Expected indentation of 14 space characters but found 12. (react/jsx-indent-props)
  ./src/App.jsx:17:13 Expected indentation of 14 space characters but found 12. (react/jsx-indent-props)
  ./src/App.jsx:18:13 Expected indentation of 14 space characters but found 12. (react/jsx-indent-props)
  ./src/App.jsx:19:1 Expected indentation of 10 spaces but found 12. (indent)
  ./src/App.jsx:19:1 Expected indentation of 10 spaces but found 12. (@typescript-eslint/indent)
  ./src/App.jsx:19:13 The closing bracket must be aligned with the opening tag (expected column 11) (react/jsx-closing-bracket-location)
  ./src/App.jsx:21:1 Expected indentation of 10 spaces but found 12. (indent)
  ./src/App.jsx:21:1 Expected indentation of 10 spaces but found 12. (@typescript-eslint/indent)
  ./src/App.jsx:21:13 Expected indentation of 10 space characters but found 12. (react/jsx-indent)
  ./src/App.jsx:22:1 Expected indentation of 8 spaces but found 10. (@typescript-eslint/indent)
  ./src/App.jsx:22:1 Expected indentation of 8 spaces but found 10. (indent)
  ./src/App.jsx:22:11 Expected indentation of 8 space characters but found 10. (react/jsx-indent)
  ./src/App.jsx:23:1 Expected indentation of 6 spaces but found 8. (indent)
  ./src/App.jsx:23:1 Expected indentation of 6 spaces but found 8. (@typescript-eslint/indent)
  ./src/App.jsx:23:9 Expected indentation of 6 space characters but found 8. (react/jsx-indent)
commit canceled with exit status 1. You have to fix ESLint errors.

@yamadayuki
Copy link
Collaborator Author

@KentoMoriwaki Please review on it

@yamadayuki
Copy link
Collaborator Author

I'll merge it now. Take a glance at this after merged

@yamadayuki yamadayuki merged commit 248e737 into master Feb 21, 2019
@yamadayuki yamadayuki deleted the yamadayuki/jsx-indent branch February 21, 2019 03:56
Copy link

@KentoMoriwaki KentoMoriwaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yamadayuki yamadayuki added the enhancement New feature or request label Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants