Should 'react/react-in-jsx-scope' be disabled by default if the new JSX transform is used.
- Dominant language
- JavaScript
- Stars
- 148k
- Forks
- 26.6k
- PR merge metrics
- No merged PRs in 30d
Description
A [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) was introduced in React 17 and backported to React 16.14.0, 15.7.0, and 0.14.10, which enables people to use JSX features without having React in the scope. Obviously this will cause tons of `react/react-in-jsx-scope` errors in a new project (or that a project that used the codemod to remove the imports) that is using the `airbnb` config.
In CRA we use the following heuristic to catch if the new transform is available:
```
const hasJsxRuntime = (() => {
try {
require.resolve('react/jsx-runtime.js');
return true;
} catch (e) {
return false;
}
})();
```
My question is a) should the `airbnb` config use a similar heuristic or a) should the rule be disabled by default in a new major version or c) should the configuration option/issue be documented somewhere in detail as many people using the config will eventually run into it.
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the airbnb configuration and the react/react-in-jsx-scope rule, then compare the React JSX transform availability heuristic described in the issue with the existing configuration behavior. Done means the project has a decided policy—heuristic, default-rule change, or detailed documentation—and the corresponding behavior or guidance is covered by the relevant checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript, react
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100