npm.io
0.1.3 • Published 2 years ago

eslint-import-resolver-ts-parser

Licence
ISC
Version
0.1.3
Deps
0
Size
7 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

eslint-import-resolver-ts-parser

npm Package

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.

Installation

npm i -D eslint-import-resolver-ts-parser

Set up the parser

Make sure you've got the @typescript-eslint/parser and @typescript-eslint/eslint-plugin working. Check out their documentations.

Attach listener

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.

Configure resolver

Set ts-parser as the import/resolver. For example,

// .eslintrc.json
{
  // ...
  "settings": {
    "import/resolver": "ts-parser"
  }
}