This plugin adds typescript support to eslint-plugin-import
.
This means you can:
import
/require
files with extension.ts
/.tsx
!- Use
paths
defined intsconfig.json
.
npm install --save-dev eslint-plugin-import typescript-eslint-parser eslint-import-resolver-typescript
Add the following to your .eslintrc
config:
{
"parser": "typescript-eslint-parser",
"plugins": ["import"],
"rules": {
// turn on errors for missing imports
"import/no-unresolved": "error"
},
"settings": {
"import/resolver": {
// use <root>/tsconfig.json
"typescript": {},
// use <root>/path/to/folder/tsconfig.json
"typescript": {
"directory": "./path/to/folder"
}
}
}
}
- Make sure your change is covered by a test import.
- Make sure that
npm test
passes without a failure. - Make sure your code is formatted
npm format
.
We have an automatic travis build which will run the above on your PRs. If either fails, we won't be able to merge your PR until it's fixed.