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

Question: how to map ".tsx" fiels to import ending with ".js" extension? #234

Closed
giacomorebonato opened this issue Aug 8, 2023 · 4 comments

Comments

@giacomorebonato
Copy link

Hi, thank you a lot for this plugin.

I am working on a TypeScript project with React and ESM (I have "type": "module" in package.json).
In my tsconfig.json I have "jsx": "react-jsx",, hence all my *.tsx files get compiled to .js.

Eslint returns this error in the import and goes away if I use the .jsx extension.

Screenshot 2023-08-08 at 15 15 24

This is how my settings section looks like:

    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx'],
    },
    'import/resolver': {
      node: {
        extensions: ['.js', '.jsx'],
      },
      typescript: {
        project: 'tsconfig.json',
      },
    }

What should I change to have tsx files mapped to import ending with .js extension?

@JounQin
Copy link
Collaborator

JounQin commented Aug 8, 2023

There do have such an alias, so please provide a runnable reproduction.

@giacomorebonato
Copy link
Author

Sorry, it's in a private repository. I'll re-open once can I provide a runnable reproduction.

@cvle
Copy link

cvle commented Nov 1, 2023

Running into the same problem when the import is through the tsconfig paths mapping

@JounQin
Copy link
Collaborator

JounQin commented Nov 2, 2023

@cvle Please raise a new issue with runnable reproduction.

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