Skip to content

[eslint-config-airbnb] react version setting #1983

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

Closed
aczekajski opened this issue Jan 3, 2019 · 1 comment
Closed

[eslint-config-airbnb] react version setting #1983

aczekajski opened this issue Jan 3, 2019 · 1 comment

Comments

@aczekajski
Copy link

Config located in eslint-config-airbnb/rules/react.js consists of following lines:

react: {
  pragma: 'React',
  version: '16.0'
},

in the settings section, setting explicitely the react version.

Meanwhile, in the new release of eslint-plugin-react (v 7.12.0), the jsx-fragments rule was introduced which enforces <> syntax instead of <React.Fragment>. However, for this rule to work you need to have a React version set to at least 16.2. As an effect, airbnb settings causes my config to throw error even though I have a correct react version but I don't have it set in settings section of my eslintrc (because defaults are provided by eslint-plugin-react).

Solution to that would be to use the detect option for version which was also introduced in 7.12.0 of eslint-plugin-react.

@ljharb
Copy link
Collaborator

ljharb commented Jan 3, 2019

That is certainly something we are likely to change in a future version of this config. However, the current situation is that you should always be explicitly specifying your React version in your config; so for now, you can explicitly specify “detect” if you wish.

@ljharb ljharb closed this as completed in 6b5922c Aug 10, 2019
vunb pushed a commit to hsdt/javascript that referenced this issue Nov 27, 2019
eugene2candy pushed a commit to eugene2candy/javascript that referenced this issue Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants