question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[import/extensions] 2.22.0 still shows `without an extension` error for importing tsx files from tsx files

See original GitHub issue

Almost like #1615, but getting error on my Github CI which uses the same yarn.lock file.

    2:22  error    Missing file extension for "../../components/organisms/document"  import/extensions

my lock file:

eslint-plugin-import@^2.22.0:
  version "2.22.0"
  resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz#92f7736fe1fde3e2de77623c838dd992ff5ffb7e"
  integrity sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg==
  dependencies:
    array-includes "^3.1.1"
    array.prototype.flat "^1.2.3"
    contains-path "^0.1.0"
    debug "^2.6.9"
    doctrine "1.5.0"
    eslint-import-resolver-node "^0.3.3"
    eslint-module-utils "^2.6.0"
    has "^1.0.3"
    minimatch "^3.0.4"
    object.values "^1.1.1"
    read-pkg-up "^2.0.0"
    resolve "^1.17.0"
    tsconfig-paths "^3.9.0"

EDIT My yarn lock file had eslint-plugin-import@2.20.1 also present. The lint was working fine at my local system.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
bcomnescommented, Apr 15, 2021

I ran into a similar issue (e.g. jsx files not registering with this rule) and adding some settings to the resolver settings fixed the issue:

Inside eslint.json:

{
"settings": {
    "import/resolver": {
      "node": {
        "extensions": [".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx"]
      }
    }
  }
}
1reaction
asimktcommented, Aug 3, 2020

hey @ljharb, I didn’t get a chance to recreate this issue. Busy with office work now. I will try to create one as soon as possible. I went ahead with 2.20.1 which solved the issue for me. (Hence closed this for now)

For future readers who have same issue: Could you please open a sandbox where the issue persists?

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint - Missing File Extension "tsx" for Typescript React Project
I'm trying to configure a CRA project with Typescript eslinting, and I've run into an eslint issue which says. Missing file extension for ......
Read more >
Migrating from TSLint to ESLint on Gatsby | by E.Y. - Medium
In my previous blogs, I briefly touched upon the basics about setting up ESLint with TypeScript, but I'd like to show you a...
Read more >
An import path cannot end with a '.tsx' extension in TS
The error "An import path cannot end with a '.tsx' extension" occurs when we include the extension when importing TypeScript files in a...
Read more >
Code Quality report fails when ESLint is set up (with plugins ...
I added ESLint to a project that already had the Code Quality job set up, which all of a sudden started to fail...
Read more >
eslint/eslint - Gitter
Not sure if this is the right place but I get: Failed to load config "@ljharb" to extend from. from a node_module's eslint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found