1
1
# eslint-import-resolver-ts
2
2
3
+ [ ![ GitHub Actions] ( https://github.com/rx-ts/eslint-import-resolver-ts/workflows/Node%20CI/badge.svg )] ( https://github.com/rx-ts/eslint-import-resolver-ts/actions )
3
4
[ ![ Travis] ( https://img.shields.io/travis/com/rx-ts/eslint-import-resolver-ts.svg )] ( https://travis-ci.com/rx-ts/eslint-import-resolver-ts )
5
+ [ ![ type-coverage] ( https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Feslint-import-resolver-ts%2Fmaster%2Fpackage.json )] ( https://github.com/plantain-00/type-coverage )
6
+ [ ![ npm] ( https://img.shields.io/npm/v/eslint-import-resolver-ts.svg )] ( https://www.npmjs.com/package/eslint-import-resolver-ts )
7
+ [ ![ GitHub Release] ( https://img.shields.io/github/release/rx-ts/eslint-import-resolver-ts )] ( https://github.com/rx-ts/eslint-import-resolver-ts/releases )
4
8
5
- This plugin adds typescript support to [ ` eslint-plugin-import ` ] ( https://www.npmjs.com/package/eslint-plugin-import ) .
9
+ [ ![ David Peer] ( https://img.shields.io/david/peer/rx-ts/eslint-import-resolver-ts.svg )] ( https://david-dm.org/rx-ts/eslint-import-resolver-ts?type=peer )
10
+ [ ![ David] ( https://img.shields.io/david/rx-ts/eslint-import-resolver-ts.svg )] ( https://david-dm.org/rx-ts/eslint-import-resolver-ts )
11
+ [ ![ David Dev] ( https://img.shields.io/david/dev/rx-ts/eslint-import-resolver-ts.svg )] ( https://david-dm.org/rx-ts/eslint-import-resolver-ts?type=dev )
12
+
13
+ [ ![ Conventional Commits] ( https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg )] ( https://conventionalcommits.org )
14
+ [ ![ JavaScript Style Guide] ( https://img.shields.io/badge/code_style-standard-brightgreen.svg )] ( https://standardjs.com )
15
+ [ ![ Code Style: Prettier] ( https://img.shields.io/badge/code_style-prettier-ff69b4.svg )] ( https://github.com/prettier/prettier )
16
+ [ ![ codechecks.io] ( https://raw.githubusercontent.com/codechecks/docs/master/images/badges/badge-default.svg?sanitize=true )] ( https://codechecks.io )
17
+
18
+ This plugin adds TypeScript support to [ ` eslint-plugin-import ` ] ( https://www.npmjs.com/package/eslint-plugin-import ) .
6
19
7
20
This means you can:
8
21
9
22
- ` import ` /` require ` files with extension ` .ts ` /` .tsx ` !
10
23
- 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
24
+ - Prefer resolve ` @types/* ` definitions over plain ` .js ` .
25
+ - Multiple tsconfigs support just like normal.
26
+
27
+ ## TOC <!-- omit in toc -->
28
+
29
+ - [ Installation] ( #installation )
30
+ - [ Configuration] ( #configuration )
31
+ - [ Contributing] ( #contributing )
13
32
14
33
## Installation
15
34
@@ -25,7 +44,7 @@ yarn add -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolve
25
44
26
45
Add the following to your ` .eslintrc ` config:
27
46
28
- ``` JSONC
47
+ ``` jsonc
29
48
{
30
49
" plugins" : [" import" ],
31
50
" rules" : {
@@ -38,7 +57,9 @@ Add the following to your `.eslintrc` config:
38
57
},
39
58
" import/resolver" : {
40
59
// use <root>/tsconfig.json
41
- " ts" : {},
60
+ " ts" : {
61
+ " alwaysTryTypes" : true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
62
+ },
42
63
43
64
// use <root>/path/to/folder/tsconfig.json
44
65
" ts" : {
@@ -75,9 +96,10 @@ Add the following to your `.eslintrc` config:
75
96
## Contributing
76
97
77
98
- Make sure your change is covered by a test import.
78
- - Make sure that ` npm test ` passes without a failure.
79
- - Make sure your code is formatted ` npm format ` .
99
+ - Make sure that ` yarn test ` passes without a failure.
100
+ - Make sure that ` yarn lint ` passes without conflicts.
101
+ - Make sure your code changes match our [ type-coverage] ( https://github.com/plantain-00/type-coverage ) settings: ` yarn type-coverage ` .
80
102
81
- We have an [ automatic travis build ] ( https://travis-ci.org /rx-ts/eslint-import-resolver-ts ) which will run the above on your PRs.
103
+ We have [ GitHub Actions ] ( https://github.com /rx-ts/eslint-import-resolver-ts/actions ) which will run the above commands on your PRs.
82
104
83
105
If either fails, we won't be able to merge your PR until it's fixed.
0 commit comments