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

Resolve .jsx? to .tsx? and force the .jsx? extensions #2776

Open
slavafomin opened this issue May 3, 2023 · 2 comments
Open

Resolve .jsx? to .tsx? and force the .jsx? extensions #2776

slavafomin opened this issue May 3, 2023 · 2 comments

Comments

@slavafomin
Copy link

slavafomin commented May 3, 2023

Hello!

Thank you for this great library!

However, I can't really figure out how to configure it in ESM TypeScript React project.

I would like the ESLint to report (and autofix) missing .js and .jsx extensions, however, it forces me to use the .ts(x) extensions instead.

In other words I want:

import { Component } from './component' to be corrected to
import { Component } from './component.jsx'

import { util } from './util' to be corrected to
import { util } from './util.js'

import { Component } from './component.tsx' and
import { util } from './util.ts'
should raise error.

Thanks!

@ljharb
Copy link
Member

ljharb commented May 8, 2023

Are the files actually present on disk with those extensions?

If not, this is a duplicate of #2729 and should be closed.

@karlhorky
Copy link
Contributor

karlhorky commented Mar 17, 2024

@ljharb I believe that the inability of import/extensions to map .js imports to .ts files on disk (and .jsx to .tsx, etc) is the same issue as @phryneas clarified over here in the other repo eslint-import-resolver-typescript:

Seems like there's also a PR open for that here in the eslint-plugin-import repo:

So maybe it's good to keep this current issue (2776) open until 2813 is landed, since the other issue in the eslint-plugin-import repo (#2729) has been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants