feat(scope-manager): add support for JSX scope analysis #2498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2455
And some of #2477
JSX is a first-class citizen of TS, so we should really support it as well.
I was going to just rely upon
eslint-plugin-react
's patch lint rules (react/jsx-uses-react
andreact/jsx-uses-vars
), but that leaves gaps in our tooling.For example #2455,
consistent-type-imports
makes assumptions and can create invalid fixes for react without this change.We could add options to that lint rule for the factory, but that is kind-of a sub-par experience and future rule authors will likely run into similar problems that they'd have to manually build support for.
parserOption
:jsxPragma
- the name to use for constructing JSX elements. Defaults to"React"
. Will be auto detected from the tsconfig.jsxFragmentName
- the name that unnamed JSX fragments use. Defaults tonull
(i.e. assumesReact.Fragment
). Will be auto detected from the tsconfig.