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

adding support for setting the jsx pragma value via config #82

Merged
merged 1 commit into from
May 28, 2015

Conversation

dominicbarnes
Copy link
Contributor

This fixes #80

Instead of taking the approach mentioned there, this turned out to be far less complicated, it basically adds a second config option to the react/jsx-uses-react rule:

[ 2, 'dom' ]

This causes dom to be used in place of React as the used variable. I've also included a test and updated the docs for the aforementioned rule.

Let me know if there's anything else we need to do to get this merged! :D

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.46% when pulling 4822162 on dominicbarnes:jsx-pragma-config into 598ab38 on yannickcr:master.

@dominicbarnes
Copy link
Contributor Author

Although outside the scope of this PR, the rule name jsx-uses-react is a confusing name considering that it simultaneously supports the JSX pragma and this new config.

I was thinking it could be named jsx-uses-var instead, although that could just be confused with the very similarly-named jsx-uses-vars. (then there's backward-compatibility to consider)

@yannickcr
Copy link
Member

Thanks :)

But actually I'd prefer to keep the [1, {"pragma": "dom"}] format to be coherent with the other rules. Also, it allows us to add other options in the future without breaking anything.


var Hello = <div>Hello {this.props.name}</div>;
```

Copy link
Member

Choose a reason for hiding this comment

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

Great!

Just some little things: can you make a Rule Options section and use the same format as the other rules for the config file example ?

You can see an example here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md#rule-options

@dominicbarnes
Copy link
Contributor Author

I'm done making those changes! Let me know if there are any other changes to make

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 94.47% when pulling 82b7063 on dominicbarnes:jsx-pragma-config into 598ab38 on yannickcr:master.

@yannickcr
Copy link
Member

LGTM.

Thanks!

yannickcr added a commit that referenced this pull request May 28, 2015
Add support for setting the jsx pragma value in eslintrc (fixes #80)
@yannickcr yannickcr merged commit b21b741 into jsx-eslint:master May 28, 2015
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.

Allow setting jsx pragma value in eslintrc
3 participants