$ npm install eslint-import-resolver-typescript
This plugin adds typescript support to eslint-plugin-import
.
This means you can:
import
/require
files with extension .ts
/.tsx
without using --ext
!paths
defined in tsconfig.json
.npm install --save-dev eslint-plugin-import typescript-eslint-parser eslint-import-resolver-typescript
Add the following to your .eslintrc
config:
{
"settings": {
"parser": "typescript-eslint-parser",
"plugins": [
"import"
],
"rules": {
// turn on errors for missing imports
"import/no-unresolved": "error"
},
"import/resolver": {
// use <root>/tsconfig.json
"typescript": {},
// use <root>/path/to/folder/tsconfig.json
"typescript": {
"directory": "./path/to/folder"
}
}
}
}
npm test
passes without a failure.© 2010 - cnpmjs.org x YWFE | Home | YWFE