eslint-plugin-import: [import/extensions] 2.20.0 still shows errors for importing TS files from JS files without an extension
C:\projects\path\to\code\ReduxDevTools.jsx
6:40 error Missing file extension for "../utilities/cookies" import/extensions
This is the same error I was getting on 2.19.1 (as seen in https://github.com/benmosher/eslint-plugin-import/issues/1558). The error does not appear in 2.18.3.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fixing issue related to TypeScript + AirBnB defaults: https://github.com/benmosher/eslint-plugin-import/issues/1615#issuecomment-579666755 — committed to fullstorydev/fullstory-data-layer-observer by patrick-fs 4 years ago
- fixing issue related to TypeScript + AirBnB defaults: https://github.com/benmosher/eslint-plugin-import/issues/1615#issuecomment-579666755 — committed to fullstorydev/fullstory-data-layer-observer by patrick-fs 4 years ago
- adding eslint + git pre-commit hook (#18) * adding eslint and lint scripts * adding pre-commit hook * whitespace fixup * specifying .ts files in lint npm scripts * fixing issue related to... — committed to fullstorydev/fullstory-data-layer-observer by patrick-fs 4 years ago
- Fix issue with missing file extension See: https://github.com/benmosher/eslint-plugin-import/issues/1615#issuecomment-577500405 — committed to bkiac/configs by bkiac 4 years ago
Nevermind, this is working correctly for when I set this in the
rules
:and set this in the
settings
:I believe in 2.18.3 it wasn’t reporting errors that it should have been reporting based on my config (I was not overriding the default
import/extensions
that is used in airbnb which only allows for normal JavaScript files).I got the same problem with .vue file and it took me a whole day, read every single thread about these 2 rules (import/extensions and import/no-unresolved), and still got errors.
after trying your setting, it works like a charm, and I still have no idea why 😐
here are my .eslintrc.js file
I had the same problem with
.vue
files. I missed this extension inimport/resolver
settings.This fixed it for me:
Try to replace
.vue
with.ts
@Methuselah96: No, i doesn’t work for me:
still got the error:
plugin:import/typescript
seems to coversettings
; couldrules
be added there too to cover it?@javierguzman It was closed rather than committed (see https://github.com/benmosher/eslint-plugin-import/pull/1637#pullrequestreview-351678384). For my case I’m switching to using eslint-config-airbnb-typescript rather than eslint-config-airbnb-base directly.
Tested locally and that works, so opened https://github.com/benmosher/eslint-plugin-import/pull/1637.
@thewilkybarkid I think you still need to override
import/extensions
in therules
section, not just thesettings
section. I don’t know if that’s intentional or not.To clarify, when using
airbnb-base
andplugin:import/typescript
you still need to include theimport/extensions
rule yourself?I’m also getting this error when importing
.ts
files in typescript as well.Even explicitly changing the settings in my
.eslitntrc
to include.ts
still results in an error:or setting the rule directly to:
We’re seeing
Missing file extension "ts" for ...
moving from 2.18.2 to 2.20.0 (refs https://github.com/libero/article-store/pull/174).