Resolver using @typescript-eslint parser service. Plugin for eslint-plugin-import
.
This plugin reads options from @typescript-eslint
parser service, and then uses typescript
compiler APIs to resolve paths. It can resolve whatever typescript
can resolve.
npm i -D eslint-import-resolver-ts-parser-service
Make sure you've got the @typescript-eslint/parser
and @typescript-eslint/eslint-plugin
working. Check out their documentations.
Extend your eslint config with plugin:ts-parser-service/listen
. For example,
// .eslintrc.json
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:ts-parser-service/listen",
]
}
eslint-plugin-ts-parser-service
helps us get the parser service serving the parsing file.
Set ts-parser
as the import/resolver
. For example,
// .eslintrc.json
{
// ...
"settings": {
"import/resolver": "ts-parser-service"
}
}