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

Change Request: Support JSX references #645

Open
1 of 4 tasks
nzakas opened this issue Jan 29, 2025 · 0 comments
Open
1 of 4 tasks

Change Request: Support JSX references #645

nzakas opened this issue Jan 29, 2025 · 0 comments

Comments

@nzakas
Copy link
Member

nzakas commented Jan 29, 2025

Which packages would you like to change?

  • espree
  • eslint-scope
  • eslint-visitor-keys

What problem do you want to solve?

Currently, eslint-scope does not recognize JSX tag as references to imported bindings, such as:

import { Foo } from "./components/foo.js";

export function render() {
    return <Foo />
}

This means any rule that wants to work with JSX needs to track references themselves.

Initially we didn't track JSX references because we weren't sure if JSX would stick around, and if so, whether the semantics would remain the same. At this point, all of the frameworks using JSX treat it the same, so I think it's time to update this behavior.

What do you think is the correct solution?

We could add a new option, jsx (not married to that name) that, when set to true, will add JSX tags as references for imported symbols.

Implementing as an option means it's not a breaking change, and we could choose to turn it on in ESLint whenever we want (first with a flag, then with a major release).

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant