eslint-plugin-import
eslint-plugin-import copied to clipboard
[Fix]: `no-unresolved`: Support importing only types when the module isn't installed
- [x] write tests
- [x] implement feature/fix bug
- [x] update docs
- [x] make a note in change log
Don't trigger an error when only typings are imported and the actual module is not installed (only its typings are installed under (node_modules/@types
).
This is useful when defining packages holding domain objects that only need to reference types, without using the actual module.
I chose memorystream for the test for several reasons:
- I needed a module that won't be added to the project any time soon (adding it would break the tests!)
- I needed to use a module with publicly available typings
- It's what I used for the initial debugging :)
Please feel free to comment on code logic, test strategy and documentation phrasing, all feedback is welcome!
You should use eslint-import-resolver-typescript
Indeed; with the typescript eslint resolver (which is required when using typescript) this shouldn't be an issue.
@EdenGottlieb can you confirm that using it solves the issue for you?