1
- # eslint-import-resolver-typescript
1
+ # eslint-import-resolver-ts
2
2
3
- [ ![ Build Status ] ( https://travis-ci.org/alexgorbatchev/ eslint-import-resolver-typescript .svg?branch=master )] ( https://travis-ci.org/alexgorbatchev /eslint-import-resolver-typescript )
3
+ [ ![ Travis ] ( https://img.shields.io/travis/com/rx-ts/ eslint-import-resolver-ts .svg )] ( https://travis-ci.com/rx-ts /eslint-import-resolver-ts )
4
4
5
5
This plugin adds typescript support to [ ` eslint-plugin-import ` ] ( https://www.npmjs.com/package/eslint-plugin-import ) .
6
6
7
7
This means you can:
8
8
9
9
- ` import ` /` require ` files with extension ` .ts ` /` .tsx ` !
10
10
- Use [ ` paths ` ] ( https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping ) defined in ` tsconfig.json ` .
11
+ - prefer resolve ` @types/* ` definitions over plain ` .js `
12
+ - Multiple tsconfigs just like normal
11
13
12
14
## Installation
13
15
14
- ``` bash
15
- npm install --save-dev eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-typescript
16
+ ``` sh
17
+ # npm
18
+ npm i -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-ts
19
+
20
+ # yarn
21
+ yarn add -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-ts
16
22
```
17
23
18
24
## Configuration
@@ -32,30 +38,30 @@ Add the following to your `.eslintrc` config:
32
38
},
33
39
" import/resolver" : {
34
40
// use <root>/tsconfig.json
35
- " typescript " : {},
41
+ " ts " : {},
36
42
37
43
// use <root>/path/to/folder/tsconfig.json
38
- " typescript " : {
44
+ " ts " : {
39
45
" directory" : " ./path/to/folder"
40
46
},
41
47
42
48
// Multiple tsconfigs (Useful for monorepos)
43
49
44
50
// use a glob pattern
45
- " typescript " : {
51
+ " ts " : {
46
52
" directory" : " ./packages/**/tsconfig.json"
47
53
},
48
54
49
55
// use an array
50
- " typescript " : {
56
+ " ts " : {
51
57
" directory" : [
52
58
" ./packages/module-a/tsconfig.json" ,
53
59
" ./packages/module-b/tsconfig.json"
54
60
]
55
61
},
56
62
57
63
// use an array of glob patterns
58
- " typescript " : {
64
+ " ts " : {
59
65
" directory" : [
60
66
" ./packages/**/tsconfig.json" ,
61
67
" ./other-packages/**/tsconfig.json"
@@ -73,5 +79,6 @@ Add the following to your `.eslintrc` config:
73
79
- Make sure that ` npm test ` passes without a failure.
74
80
- Make sure your code is formatted ` npm format ` .
75
81
76
- We have an [ automatic travis build] ( https://travis-ci.org/alexgorbatchev/eslint-import-resolver-typescript ) which will run the above on your PRs.
82
+ We have an [ automatic travis build] ( https://travis-ci.org/rx-ts/eslint-import-resolver-ts ) which will run the above on your PRs.
83
+
77
84
If either fails, we won't be able to merge your PR until it's fixed.
0 commit comments