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

Add option to sort shorthand props on jsx-sort-props #336

Merged
merged 1 commit into from
Nov 29, 2015

Conversation

lucasmotta
Copy link
Contributor

You can now require that shorthand props should come before all other props, but still respecting the alphabetical order.


The following are valid situations:

<Component a b="b" />
<Component x z a="a" b="b" />

And the following are invalid:

<Component z x a="a" b="b" /> // should be in alphabetical order
<Component x z b="b" a="a" /> // should be in alphabetical order
<Component a="a" b="b" x z /> // shorthand props should be at the start

  • Tests
  • Backwards compatibility

You can now require that shorthand props should come before
all other props, but still respecting the alphabetical order.

The following are valid situations:
```
<Component a b="b" />
<Component x z a="a" b="b" />
```

And the following are invalid:
```
<Component z x a="a" b="b" /> // should be in alphabetical order
<Component x z b="b" a="a" /> // should be in alphabetical order
<Component a="a" b="b" x z /> // shorthand props should be at the start
```
yannickcr added a commit that referenced this pull request Nov 29, 2015
Add shorthandFirst option to jsx-sort-props
@yannickcr yannickcr merged commit 2153154 into jsx-eslint:master Nov 29, 2015
@yannickcr
Copy link
Member

Great, thanks!

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

Successfully merging this pull request may close these issues.

2 participants