Skip to content

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

Closed
@giacomorebonato

Description

@giacomorebonato

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions